Fixed some errors thrown by gcc/clang

This commit is contained in:
S Gopal Rajagopal 2014-11-10 12:49:48 +05:30
parent 18251b784f
commit 87accc624f
2 changed files with 20 additions and 20 deletions

View file

@ -5094,15 +5094,15 @@ void RecompilationEngine::UpdateControlFlowGraph(ControlFlowGraph & cfg, const E
cfg.branches[this_entry.GetPrimaryAddress()].insert(next_entry->GetPrimaryAddress());
}
} else if (next_entry->type == ExecutionTraceEntry::Type::FunctionCall) {
cfg.calls[this_entry.instruction.address].insert(next_entry->GetPrimaryAddress());
cfg.calls[this_entry.data.instruction.address].insert(next_entry->GetPrimaryAddress());
}
}
} else if (this_entry.type == ExecutionTraceEntry::Type::CompiledBlock) {
if (next_entry) {
if (next_entry->type == ExecutionTraceEntry::Type::Instruction || next_entry->type == ExecutionTraceEntry::Type::CompiledBlock) {
cfg.branches[this_entry.compiled_block.exit_address].insert(next_entry->GetPrimaryAddress());
cfg.branches[this_entry.data.compiled_block.exit_address].insert(next_entry->GetPrimaryAddress());
} else if (next_entry->type == ExecutionTraceEntry::Type::FunctionCall) {
cfg.calls[this_entry.compiled_block.exit_address].insert(next_entry->GetPrimaryAddress());
cfg.calls[this_entry.data.compiled_block.exit_address].insert(next_entry->GetPrimaryAddress());
}
}
}
@ -5190,8 +5190,8 @@ void Tracer::Trace(TraceType trace_type, u32 arg1, u32 arg2) {
case TraceType::Instruction:
// arg1 is the address of the instruction
for (int i = (int)m_stack.back()->entries.size() - 1; i >= 0; i--) {
if ((m_stack.back()->entries[i].type == ExecutionTraceEntry::Type::Instruction && m_stack.back()->entries[i].instruction.address == arg1) ||
(m_stack.back()->entries[i].type == ExecutionTraceEntry::Type::CompiledBlock && m_stack.back()->entries[i].compiled_block.entry_address == arg1)) {
if ((m_stack.back()->entries[i].type == ExecutionTraceEntry::Type::Instruction && m_stack.back()->entries[i].data.instruction.address == arg1) ||
(m_stack.back()->entries[i].type == ExecutionTraceEntry::Type::CompiledBlock && m_stack.back()->entries[i].data.compiled_block.entry_address == arg1)) {
// Found a loop
execution_trace = new ExecutionTrace(m_stack.back()->function_address);
execution_trace->type = ExecutionTrace::Type::Loop;

View file

@ -38,7 +38,7 @@ namespace ppu_recompiler_llvm {
u32 entry_address;
u32 exit_address;
} compiled_block;
};
} data;
/// The type of the entry
enum class Type {
@ -51,14 +51,14 @@ namespace ppu_recompiler_llvm {
: type(type) {
switch (type) {
case Type::Instruction:
instruction.address = arg1;
data.instruction.address = arg1;
break;
case Type::FunctionCall:
function_call.address = arg1;
data.function_call.address = arg1;
break;
case Type::CompiledBlock:
compiled_block.entry_address = arg1;
compiled_block.exit_address = arg2;
data.compiled_block.entry_address = arg1;
data.compiled_block.exit_address = arg2;
break;
default:
assert(0);
@ -69,11 +69,11 @@ namespace ppu_recompiler_llvm {
u32 GetPrimaryAddress() const {
switch (type) {
case Type::Instruction:
return instruction.address;
return data.instruction.address;
case Type::FunctionCall:
return function_call.address;
return data.function_call.address;
case Type::CompiledBlock:
return compiled_block.entry_address;
return data.compiled_block.entry_address;
default:
assert(0);
return 0;
@ -83,11 +83,11 @@ namespace ppu_recompiler_llvm {
std::string ToString() const {
switch (type) {
case Type::Instruction:
return fmt::Format("I:0x%08X", instruction.address);
return fmt::Format("I:0x%08X", data.instruction.address);
case Type::FunctionCall:
return fmt::Format("F:0x%08X", function_call.address);
return fmt::Format("F:0x%08X", data.function_call.address);
case Type::CompiledBlock:
return fmt::Format("C:0x%08X-0x%08X", compiled_block.entry_address, compiled_block.exit_address);
return fmt::Format("C:0x%08X-0x%08X", data.compiled_block.entry_address, data.compiled_block.exit_address);
default:
assert(0);
return "";
@ -98,15 +98,15 @@ namespace ppu_recompiler_llvm {
u64 hash = ((u64)type << 32);
switch (type) {
case Type::Instruction:
hash |= instruction.address;
hash |= data.instruction.address;
break;
case Type::FunctionCall:
hash |= function_call.address;
hash |= data.function_call.address;
break;
case Type::CompiledBlock:
hash = compiled_block.exit_address;
hash = data.compiled_block.exit_address;
hash <<= 32;
hash |= compiled_block.entry_address;
hash |= data.compiled_block.entry_address;
break;
default:
assert(0);