aboutsummaryrefslogtreecommitdiff
path: root/src/vec.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-04-03 18:36:21 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-04-03 18:36:21 +0300
commitf4be2429f38faba0c54862055f808cb242a7eb49 (patch)
tree84f03075952f2c22ccf774646168a08b2f47b8c6 /src/vec.c
parent36de4f902c4eec9f8d918e00cf0bf89d6b670cf5 (diff)
downloadqbt-f4be2429f38faba0c54862055f808cb242a7eb49.tar.gz
qbt-f4be2429f38faba0c54862055f808cb242a7eb49.zip
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.
Diffstat (limited to 'src/vec.c')
-rw-r--r--src/vec.c13
1 files changed, 9 insertions, 4 deletions
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;