#include "ir.h" #include "ir_lib.h" #include "ir_type.h" #include #include typedef struct ir_dump { FILE* fp; } ir_dump_t; void dump_ir_node(ir_node_t* node, ir_dump_t* dump) { fprintf(dump->fp, "%%%p", node); switch (node->tag) { case IR_NODE_ALLOC: { node->type = NULL; // fprintf(dump->fp, "%p\n", ); break; } case IR_NODE_BRANCH: { node->data.branch.cond = NULL; node->data.branch.true_bblock = NULL; node->data.branch.false_bblock = NULL; break; } case IR_NODE_CALL: { vector_init(node->data.call.args); node->data.call.callee = NULL; break; } case IR_NODE_CONST_INT: { node->data.const_int.val = 0; break; } case IR_NODE_JUMP: { node->data.jump.target_bblock = NULL; break; } case IR_NODE_LOAD: { node->data.load.target = NULL; break; } case IR_NODE_STORE: { node->data.store.target = NULL; node->data.store.value = NULL; break; } case IR_NODE_OP: { node->data.op.op = 0; node->data.op.lhs = NULL; node->data.op.rhs = NULL; break; } case IR_NODE_RET: { node->data.ret.ret_val = NULL; break; } case IR_NODE_GET_PTR: { } default: { assert(0); } } } void dump_ir_bblock(ir_bblock_t* block) { } void dump_ir_func(ir_func_t* func) { } void dump_ir_prog(ir_prog_t* prog) { }