From f4be2429f38faba0c54862055f808cb242a7eb49 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 3 Apr 2024 18:36:21 +0300 Subject: make regalloc work with ssa form + Still not ideal register allocator, but can be improved with some heuristics and potentially completely replaced in the future if so desired with graph coloring or something. --- src/nodes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nodes.c') diff --git a/src/nodes.c b/src/nodes.c index a6ff0b8..05f96fe 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -6,7 +6,8 @@ #include #include -void insadd(struct blk *b, enum insn_type o, enum val_type t, struct val r, struct val a0, struct val a1) +void insadd(struct blk *b, enum insn_type o, enum val_type t, struct val r, + struct val a0, struct val a1) { struct insn i = insn_create(o, t, r, a0, a1); vec_append(&b->insns, &i); @@ -35,7 +36,8 @@ int64_t idmatch(struct fn *f, const char *id) return -1; } -void finish_block(struct blk *b, enum insn_type cmp, struct val a0, struct val a1, const char *label) +void finish_block(struct blk *b, enum insn_type cmp, struct val a0, + struct val a1, const char *label) { assert(cmp >= BEQ && cmp <= RET && "illegal comparison type for block"); b->btype = cmp; @@ -198,7 +200,7 @@ void dump_block(struct blk *b) { printf("//\t/*** block %lld ", (long long)b->id); if (b->name) printf("\"%s\" ", b->name); - + printf("("); foreach_blk_param(pi, b->params) { struct val v = blk_param_at(b->params, pi); -- cgit v1.3