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/vec.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/vec.c') diff --git a/src/vec.c b/src/vec.c index 4ba92fb..e487162 100644 --- a/src/vec.c +++ b/src/vec.c @@ -7,13 +7,18 @@ struct vec vec_create(size_t ns) { return (struct vec) { - .n = 0, - .s = 1, - .ns = ns, - .buf = malloc(ns), + .n = 0, + .s = 1, + .ns = ns, + .buf = malloc(ns), }; } +void vec_reset(struct vec *v) +{ + v->n = 0; +} + size_t vec_len(struct vec *v) { return v->n; -- cgit v1.3