fixup! static -> inline in headers, moved instruction/helper/load_store.h function bodies into .cpp file

This commit is contained in:
MerryMage 2016-04-06 23:47:17 +01:00
parent c3967e798b
commit 366a8c5ce9
6 changed files with 93 additions and 61 deletions

View File

@ -287,6 +287,7 @@ if(ARCHITECTURE_x86_64)
arm/jit_x64/instructions/synchronisation.cpp
arm/jit_x64/instructions/status_register.cpp
arm/jit_x64/instructions/thumb.cpp
arm/jit_x64/instructions/helper/load_store.cpp
arm/jit_x64/interface.cpp
arm/jit_x64/interpret.cpp
arm/jit_x64/jit_x64.cpp

View File

@ -122,7 +122,7 @@ enum class Register {
INVALID_REG = 99
};
static Register operator+ (Register arm_reg, int number) {
inline Register operator+ (Register arm_reg, int number) {
ASSERT(arm_reg != Register::INVALID_REG);
int value = static_cast<int>(arm_reg) + number;

View File

@ -43,7 +43,7 @@ constexpr bool IsValidArmReg(ArmReg arm_reg) {
return static_cast<unsigned>(arm_reg) <= 15;
}
static bool IsEvenArmReg(ArmReg arm_reg) {
inline bool IsEvenArmReg(ArmReg arm_reg) {
ASSERT(IsValidArmReg(arm_reg));
return static_cast<unsigned>(arm_reg) % 2 == 0;
}

View File

@ -0,0 +1,73 @@
// Copyright 2016 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/swap.h"
#include "core/arm/jit_x64/instructions/helper/load_store.h"
#include "core/memory.h"
namespace JitX64 {
u64 Load64LE(u32 addr) {
// TODO: Improve this.
return Memory::Read32(addr) | (static_cast<u64>(Memory::Read32(addr + 4)) << 32);
}
u64 Load64BE(u32 addr) {
// TODO: Improve this.
return Common::swap32(Memory::Read32(addr)) | (static_cast<u64>(Common::swap32(Memory::Read32(addr + 4))) << 32);
}
void Store64LE(u32 addr, u32 v1, u32 v2) {
Memory::Write32(addr, v1);
Memory::Write32(addr + 4, v2);
}
void Store64BE(u32 addr, u32 v1, u32 v2) {
Memory::Write32(addr, Common::swap32(v2));
Memory::Write32(addr + 4, Common::swap32(v1));
}
u32 Load32LE(u32 addr) {
return Memory::Read32(addr);
}
u32 Load32BE(u32 addr) {
return Common::swap32(Memory::Read32(addr));
}
void Store32LE(u32 addr, u32 value) {
Memory::Write32(addr, value);
}
void Store32BE(u32 addr, u32 value) {
Memory::Write32(addr, Common::swap32(value));
}
u16 Load16LE(u32 addr) {
return Memory::Read16(addr);
}
u16 Load16BE(u32 addr) {
return Common::swap16(Memory::Read16(addr));
}
void Store16LE(u32 addr, u16 value) {
Memory::Write16(addr, value);
}
void Store16BE(u32 addr, u16 value) {
Memory::Write16(addr, Common::swap16(value));
}
u32 Load8(u32 addr) {
return Memory::Read8(addr);
}
void Store8(u32 addr, u8 value) {
Memory::Write8(addr, value);
}
}

View File

@ -2,10 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/common_types.h"
#include "common/swap.h"
#pragma once
#include "core/memory.h"
#include "common/common_types.h"
namespace JitX64 {
@ -13,64 +12,22 @@ namespace JitX64 {
constexpr u32 RESERVATION_GRANULE_MASK = 0xFFFFFFF8;
static u64 Load64LE(u32 addr) {
// TODO: Improve this.
return Memory::Read32(addr) | (static_cast<u64>(Memory::Read32(addr + 4)) << 32);
}
u64 Load64LE(u32 addr);
u64 Load64BE(u32 addr);
void Store64LE(u32 addr, u32 v1, u32 v2);
void Store64BE(u32 addr, u32 v1, u32 v2);
static u64 Load64BE(u32 addr) {
// TODO: Improve this.
return Common::swap32(Memory::Read32(addr)) | (static_cast<u64>(Common::swap32(Memory::Read32(addr + 4))) << 32);
}
u32 Load32LE(u32 addr);
u32 Load32BE(u32 addr);
void Store32LE(u32 addr, u32 value);
void Store32BE(u32 addr, u32 value);
static void Store64LE(u32 addr, u32 v1, u32 v2) {
Memory::Write32(addr, v1);
Memory::Write32(addr + 4, v2);
}
u16 Load16LE(u32 addr);
u16 Load16BE(u32 addr);
void Store16LE(u32 addr, u16 value);
void Store16BE(u32 addr, u16 value);
static void Store64BE(u32 addr, u32 v1, u32 v2) {
Memory::Write32(addr, Common::swap32(v2));
Memory::Write32(addr + 4, Common::swap32(v1));
}
static u32 Load32LE(u32 addr) {
return Memory::Read32(addr);
}
static u32 Load32BE(u32 addr) {
return Common::swap32(Memory::Read32(addr));
}
static void Store32LE(u32 addr, u32 value) {
Memory::Write32(addr, value);
}
static void Store32BE(u32 addr, u32 value) {
Memory::Write32(addr, Common::swap32(value));
}
static u16 Load16LE(u32 addr) {
return Memory::Read16(addr);
}
static u16 Load16BE(u32 addr) {
return Common::swap16(Memory::Read16(addr));
}
static void Store16LE(u32 addr, u16 value) {
Memory::Write16(addr, value);
}
static void Store16BE(u32 addr, u16 value) {
Memory::Write16(addr, Common::swap16(value));
}
static u32 Load8(u32 addr) {
return Memory::Read8(addr);
}
static void Store8(u32 addr, u8 value) {
Memory::Write8(addr, value);
}
u32 Load8(u32 addr);
void Store8(u32 addr, u8 value);
} // namespace JitX64

View File

@ -8,6 +8,7 @@
#include "core/arm/jit_x64/jit_x64.h"
#include "core/arm/jit_x64/instructions/helper/load_store.h"
#include "core/memory.h"
namespace JitX64 {