Cleaning up build warnings.

This commit is contained in:
Ben Vanik
2013-01-29 20:27:24 -08:00
parent 80d74dbe03
commit f117f870fb
7 changed files with 101 additions and 24 deletions

View File

@@ -152,7 +152,7 @@ void FunctionGenerator::GenerateBasicBlocks() {
for (std::map<uint32_t, FunctionBlock*>::iterator it = fn_->blocks.begin();
it != fn_->blocks.end(); ++it) {
FunctionBlock* block = it->second;
PrepareBasicBlock(block);
XEIGNORE(PrepareBasicBlock(block));
}
// Setup all local variables now that we know what we need.
@@ -217,7 +217,7 @@ void FunctionGenerator::GenerateSharedBlocks() {
}
}
void FunctionGenerator::PrepareBasicBlock(FunctionBlock* block) {
int FunctionGenerator::PrepareBasicBlock(FunctionBlock* block) {
// Create the basic block that will end up getting filled during
// generation.
char name[32];
@@ -247,7 +247,11 @@ void FunctionGenerator::PrepareBasicBlock(FunctionBlock* block) {
// and haven't implemented the disassemble method yet.
ppc::InstrDisasm d;
XEASSERTNOTNULL(i.type->disassemble);
XEASSERTZERO(i.type->disassemble(i, d));
int result_code = i.type->disassemble(i, d);
XEASSERTZERO(result_code);
if (result_code) {
return result_code;
}
// Accumulate access bits.
access_bits.Extend(d.access_bits);
@@ -255,6 +259,8 @@ void FunctionGenerator::PrepareBasicBlock(FunctionBlock* block) {
// Add in access bits to function access bits.
access_bits_.Extend(access_bits);
return 0;
}
void FunctionGenerator::GenerateBasicBlock(FunctionBlock* block) {

View File

@@ -245,28 +245,46 @@ void XeIndirectBranch(xe_ppc_state_t* state, uint64_t target, uint64_t br_ia) {
}
void XeInvalidInstruction(xe_ppc_state_t* state, uint32_t cia, uint32_t data) {
// TODO(benvanik): handle better
XELOGCPU("INVALID INSTRUCTION %.8X %.8X", cia, data);
ppc::InstrData i;
i.address = cia;
i.code = data;
i.type = ppc::GetInstrType(i.code);
if (!i.type) {
XELOGCPU(XT("INVALID INSTRUCTION %.8X: %.8X ???"),
i.address, i.code);
} else if (i.type->disassemble) {
ppc::InstrDisasm d;
i.type->disassemble(i, d);
std::string disasm;
d.Dump(disasm);
XELOGCPU(XT("INVALID INSTRUCTION %.8X: %.8X %s"),
i.address, i.code, disasm.c_str());
} else {
XELOGCPU(XT("INVALID INSTRUCTION %.8X: %.8X %s"),
i.address, i.code, i.type->name);
}
}
void XeTraceKernelCall(xe_ppc_state_t* state, uint64_t cia, uint64_t call_ia,
KernelExport* kernel_export) {
XELOGCPU("TRACE: %.8X -> k.%.8X (%s)", (uint32_t)call_ia - 4, (uint32_t)cia,
XELOGCPU(XT("TRACE: %.8X -> k.%.8X (%s)"),
(uint32_t)call_ia - 4, (uint32_t)cia,
kernel_export ? kernel_export->name : "unknown");
}
void XeTraceUserCall(xe_ppc_state_t* state, uint64_t cia, uint64_t call_ia,
FunctionSymbol* fn) {
XELOGCPU("TRACE: %.8X -> u.%.8X (%s)", (uint32_t)call_ia - 4, (uint32_t)cia,
fn->name);
XELOGCPU(XT("TRACE: %.8X -> u.%.8X (%s)"),
(uint32_t)call_ia - 4, (uint32_t)cia, fn->name);
}
void XeTraceInstruction(xe_ppc_state_t* state, uint32_t cia, uint32_t data) {
ppc::InstrType* type = ppc::GetInstrType(data);
XELOGCPU("TRACE: %.8X %.8X %s %s",
cia, data,
type && type->emit ? " " : "X",
type ? type->name : "<unknown>");
XELOGCPU(XT("TRACE: %.8X %.8X %s %s"),
cia, data,
type && type->emit ? " " : "X",
type ? type->name : "<unknown>");
// TODO(benvanik): better disassembly, printing of current register values/etc
}