Fixed compilation issues

This commit is contained in:
S Gopal Rajagopal 2014-10-25 06:56:57 +05:30
parent 6bc0ce8046
commit 160b58cf61
3 changed files with 12 additions and 14 deletions

View file

@ -4748,7 +4748,7 @@ CompiledCodeFragment RecompilationEngine::GetCompiledCodeFragment(u32 address) {
return nullptr;
}
void ReleaseCompiledCodeFragment(CompiledCodeFragment compiled_code_fragment) {
void RecompilationEngine::ReleaseCompiledCodeFragment(CompiledCodeFragment compiled_code_fragment) {
}
@ -4778,7 +4778,6 @@ void Tracer::Trace(BranchType branch_type, u32 address) {
ExecutionTrace * execution_trace = nullptr;
BlockId block_id;
int function;
int start;
block_id.address = address;
block_id.type = branch_type;
@ -4810,13 +4809,11 @@ void Tracer::Trace(BranchType branch_type, u32 address) {
function = m_stack.back();
m_stack.pop_back();
start = function;
execution_trace = new ExecutionTrace();
execution_trace->function_address = m_trace[function].address;
execution_trace->type = ExecutionTrace::Linear;
execution_trace->blocks.insert(execution_trace->blocks.begin(), m_trace.begin() + start, m_trace.end());
m_trace.erase(m_trace.begin() + start + 1, m_trace.end());
execution_trace->blocks.insert(execution_trace->blocks.begin(), m_trace.begin() + function, m_trace.end());
m_trace.erase(m_trace.begin() + function + 1, m_trace.end());
break;
case None:
break;
@ -4908,7 +4905,7 @@ u8 ppu_recompiler_llvm::ExecutionEngine::DecodeMemory(const u32 address) {
return ret;
}
BranchType GetBranchTypeFromInstruction(u32 instruction) {
BranchType ppu_recompiler_llvm::GetBranchTypeFromInstruction(u32 instruction) {
auto type = BranchType::None;
auto field1 = instruction >> 26;
auto lk = instruction & 1;

View file

@ -11,9 +11,10 @@
//#define PPU_LLVM_RECOMPILER_UNIT_TESTS 1
using namespace llvm;
using namespace ppu_recompiler_llvm;
#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER(fn, tc, input, ...) \
VerifyInstructionAgainstInterpreter(fmt::Format("%s.%d", #fn, tc).c_str(), &PPULLVMRecompiler::fn, &PPUInterpreter::fn, input, __VA_ARGS__)
VerifyInstructionAgainstInterpreter(fmt::Format("%s.%d", #fn, tc).c_str(), &Compiler::fn, &PPUInterpreter::fn, input, __VA_ARGS__)
#define VERIFY_INSTRUCTION_AGAINST_INTERPRETER_USING_RANDOM_INPUT(fn, s, n, ...) { \
PPUState input; \
@ -24,7 +25,7 @@ VerifyInstructionAgainstInterpreter(fmt::Format("%s.%d", #fn, tc).c_str(), &PPUL
}
/// Register state of a PPU
struct PPUState {
struct ppu_recompiler_llvm::PPUState {
/// Floating point registers
PPCdouble FPR[32];
@ -201,8 +202,8 @@ static PPUThread * s_ppu_state = nullptr;
static PPUInterpreter * s_interpreter = nullptr;
#endif // PPU_LLVM_RECOMPILER_UNIT_TESTS
template <class PPULLVMRecompilerFn, class PPUInterpreterFn, class... Args>
void PPULLVMRecompiler::VerifyInstructionAgainstInterpreter(const char * name, PPULLVMRecompilerFn recomp_fn, PPUInterpreterFn interp_fn, PPUState & input_state, Args... args) {
template <class CompilerFn, class PPUInterpreterFn, class... Args>
void Compiler::VerifyInstructionAgainstInterpreter(const char * name, CompilerFn recomp_fn, PPUInterpreterFn interp_fn, PPUState & input_state, Args... args) {
#ifdef PPU_LLVM_RECOMPILER_UNIT_TESTS
auto test_case = [&]() {
(this->*recomp_fn)(args...);
@ -232,7 +233,7 @@ void PPULLVMRecompiler::VerifyInstructionAgainstInterpreter(const char * name, P
#endif // PPU_LLVM_RECOMPILER_UNIT_TESTS
}
void PPULLVMRecompiler::RunTest(const char * name, std::function<void()> test_case, std::function<void()> input, std::function<bool(std::string & msg)> check_result) {
void Compiler::RunTest(const char * name, std::function<void()> test_case, std::function<void()> input, std::function<bool(std::string & msg)> check_result) {
#ifdef PPU_LLVM_RECOMPILER_UNIT_TESTS
// Create the unit test function
m_current_function = (Function *)m_module->getOrInsertFunction(name, m_ir_builder->getVoidTy(),
@ -311,7 +312,7 @@ void PPULLVMRecompiler::RunTest(const char * name, std::function<void()> test_ca
#endif // PPU_LLVM_RECOMPILER_UNIT_TESTS
}
void PPULLVMRecompiler::RunAllTests(PPUThread * ppu_state, PPUInterpreter * interpreter) {
void Compiler::RunAllTests(PPUThread * ppu_state, PPUInterpreter * interpreter) {
#ifdef PPU_LLVM_RECOMPILER_UNIT_TESTS
s_ppu_state = ppu_state;
s_interpreter = interpreter;

View file

@ -112,7 +112,7 @@ void PPUThread::DoRun()
case 2:
if (!m_dec) {
m_dec = new PPULLVMEmulator(*this);
m_dec = new ppu_recompiler_llvm::ExecutionEngine(*this);
}
break;