Adding tracing methods.

This commit is contained in:
Ben Vanik
2013-01-24 00:10:24 -08:00
parent 385a4ee23b
commit 47481fecf7
8 changed files with 107 additions and 14 deletions

View File

@@ -177,6 +177,16 @@ void ModuleGenerator::AddMissingImport(FunctionSymbol* fn) {
// TODO(benvanik): log errors.
BasicBlock* block = BasicBlock::Create(context, "entry", f);
IRBuilder<> builder(block);
if (FLAGS_trace_kernel_calls) {
Value* traceKernelCall = m->getGlobalVariable("XeTraceKernelCall");
builder.CreateCall3(
traceKernelCall,
f->arg_begin(),
builder.getInt32(fn->start_address),
builder.getInt32(0));
}
builder.CreateRetVoid();
OptimizeFunction(m, f);