Tweaking output.

This commit is contained in:
Ben Vanik 2013-02-01 00:21:59 -08:00
parent 44b39c797b
commit b6a9dfe7e0
6 changed files with 110 additions and 13 deletions

86
TODO.md
View File

@ -44,6 +44,92 @@ KeBugCheck:
```
rlwimix
rldiclx
addcx
addex
addicx
andisx
cntlzdx
dcbf
dcbz
divdux
divdx
divwx
eieio
eqvx
extshx
extswx
fabsx
faddsx
faddx
fcfidx
fcmpu
fctidzx
fctiwzx
fdivsx
fdivx
fmaddsx
fmaddx
fmrx
fmsubsx
fmsubx
fmulsx
fmulx
fnegx
fnmsubsx
fnmsubx
frspx
fselx
fsqrtx
fsubsx
fsubx
ldarx
ldx
lfd
lfdx
lfs
lfsu
lfsux
lfsx
lha
lhax
lhzu
lhzx
lwa
lwarx
lwax
lwbrx
lwzux
mftb
mulldx
nandx
negx
orcx
rldiclx
rldicrx
rldimix
rlwnmx
sldx
sradix
sradx
srawx
srdx
srwx
stbx
stdcx
stdx
stfd
stfdu
stfdx
stfiwx
stfs
stfsu
stfsx
stwbrx
stwcx
stwux
subfcx
subfzex
sync
```
### XER CA bit (carry)

View File

@ -12,7 +12,7 @@
# LLVM paths.
# TODO(benvanik): switch based on configuration.
'llvm_path': 'build/llvm/debug/',
'llvm_path': 'build/llvm/release/',
'llvm_config': '<(llvm_path)bin/llvm-config',
'llvm_includedir': '<(llvm_path)/include',
'llvm_cxxflags': [

View File

@ -23,7 +23,7 @@
#define XE_OPTION_LOG_INFO 1
#define XE_OPTION_LOG_DEBUG 1
#define XE_OPTION_LOG_CPU 1
#define XE_OPTION_LOG_SDB 1
#define XE_OPTION_LOG_SDB 0
#define XE_OPTION_LOG_GPU 1
#define XE_OPTION_LOG_KERNEL 1
#define XE_OPTION_LOG_FS 1

View File

@ -24,6 +24,8 @@ using namespace xe::cpu::sdb;
DEFINE_bool(memory_address_verification, false,
"Whether to add additional checks to generated memory load/stores.");
DEFINE_bool(log_codegen, false,
"Log codegen to stdout.");
/**
@ -75,6 +77,10 @@ FunctionGenerator::FunctionGenerator(
for (size_t n = 0; n < XECOUNT(locals_.gpr); n++) {
locals_.gpr[n] = NULL;
}
if (FLAGS_log_codegen) {
printf("%s:\n", fn->name);
}
}
FunctionGenerator::~FunctionGenerator() {
@ -269,7 +275,9 @@ void FunctionGenerator::GenerateBasicBlock(FunctionBlock* block) {
BasicBlock* bb = GetBasicBlock(block->start_address);
XEASSERTNOTNULL(bb);
printf(" bb %.8X-%.8X:\n", block->start_address, block->end_address);
if (FLAGS_log_codegen) {
printf(" bb %.8X-%.8X:\n", block->start_address, block->end_address);
}
fn_block_ = block;
bb_ = bb;
@ -311,14 +319,16 @@ void FunctionGenerator::GenerateBasicBlock(FunctionBlock* block) {
continue;
}
if (i.type->disassemble) {
ppc::InstrDisasm d;
i.type->disassemble(i, d);
std::string disasm;
d.Dump(disasm);
printf(" %.8X: %.8X %s\n", ia, i.code, disasm.c_str());
} else {
printf(" %.8X: %.8X %s ???\n", ia, i.code, i.type->name);
if (FLAGS_log_codegen) {
if (i.type->disassemble) {
ppc::InstrDisasm d;
i.type->disassemble(i, d);
std::string disasm;
d.Dump(disasm);
printf(" %.8X: %.8X %s\n", ia, i.code, disasm.c_str());
} else {
printf(" %.8X: %.8X %s ???\n", ia, i.code, i.type->name);
}
}
// TODO(benvanik): debugging information? source/etc?

View File

@ -301,8 +301,6 @@ void ModuleGenerator::PrepareFunction(FunctionSymbol* fn) {
void ModuleGenerator::BuildFunction(CodegenFunction* cgf) {
FunctionSymbol* fn = cgf->symbol;
printf("%s:\n", fn->name);
// Setup the generation context.
FunctionGenerator fgen(
memory_, sdb_, fn, context_, gen_module_, cgf->function);

View File

@ -120,8 +120,11 @@ void* XModule::GetProcAddressByOrdinal(uint16_t ordinal) {
X_STATUS XModule::Launch(uint32_t flags) {
const xe_xex2_header_t* header = xex_header();
XELOGI(XT("Launching module..."));
// Set as the main module, while running.
kernel_state()->SetExecutableModule(this);
fflush(stdout);
// Create a thread to run in.
XThread* thread = new XThread(