Hooking up code emission.

This commit is contained in:
Ben Vanik
2014-01-02 20:41:13 -08:00
parent 7969349126
commit e14d3379cb
12 changed files with 280 additions and 17 deletions

View File

@@ -72,7 +72,7 @@ void LIRBuilder::Dump(StringBuffer* str) {
continue;
}
if (i->opcode == &LIR_OPCODE_COMMENT_info) {
str->Append(" ; %s\n", (char*)i->arg[0].i64);
str->Append(" ; %s\n", i->arg[0].string);
i = i->next;
continue;
}
@@ -189,7 +189,19 @@ LIRInstr* LIRBuilder::AppendInstr(
}
void LIRBuilder::Comment(const char* format, ...) {
char buffer[1024];
va_list args;
va_start(args, format);
xevsnprintfa(buffer, 1024, format, args);
va_end(args);
size_t len = xestrlena(buffer);
if (!len) {
return;
}
void* p = arena_->Alloc(len + 1);
xe_copy_struct(p, buffer, len + 1);
auto instr = AppendInstr(LIR_OPCODE_COMMENT_info);
instr->arg[0].string = (char*)p;
}
void LIRBuilder::Nop() {

View File

@@ -76,6 +76,7 @@ typedef union {
float f32;
double f64;
uint64_t offset;
char* string;
} LIROperand;