diff options
| author | WormHeamer | 2025-10-27 23:33:21 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-10-27 23:33:21 -0400 |
| commit | 40d164972423056e8302bd67db9494b6e4b076b3 (patch) | |
| tree | 25ff78ade2fcef01cee7339037a0ae745c416d2b /ir.c | |
| parent | dd62801133cddca25d94c9c59f8ca7d0748850c6 (diff) | |
fix a bunch of warnings
Diffstat (limited to 'ir.c')
| -rw-r--r-- | ir.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -2,21 +2,22 @@ #include <assert.h> #include "ir.h" +#include "typ.h" #include "strio.h" /* node lists */ -void nodelist_fit(NodeList *l, uint32_t sz, Arena *a) { +void nodelist_fit(NodeList *l, u32 sz, Arena *a) { if (l->cap) { if (sz > l->cap) { - uint32_t c = l->cap; + u32 c = l->cap; while (sz > c) c <<= 1; l->data = resize(a, l->data, l->cap, c); l->cap = c; } } else { if (sz > 1) { - uint32_t cap = 2; + u32 cap = 2; while (cap < sz) cap <<= 1; Node **data = new_arr(a, Node *, cap); data[0] = l->sbo; @@ -101,12 +102,10 @@ void node_kill(Node *n, Graph *p) { } void node_add_out(Graph *p, Node *a, Node *b) { - assert(b > 0xfffff || !b); nodelist_push(&a->out, b, p->pool->arena); } void node_add_in(Graph *p, Node *a, Node *b) { - assert(b > 0xfffff || !b); nodelist_push(&a->in, b, p->pool->arena); } @@ -179,7 +178,7 @@ Node *node_dedup_lit(Graph *p, Value v) { /* TODO: this is probably real inefficient for large procedure graphs, * but does it matter? how many nodes are direct children of the start node? * how many literals even usually occur in a procedure? */ - for (int i = 0; i < p->start->out.len; i++) { + for (u32 i = 0; i < p->start->out.len; i++) { Node *t = p->start->out.data[i]; if (t->op == N_LIT && type_eql(&t->type, &v.type) && t->val.i == v.i) { return t; @@ -242,7 +241,7 @@ Str type_desc(Type *t, Arena *arena) { void type_err(Node *n, Lexer *l) { Str s = S(""); - for (int i = 0; i < n->in.len; i++) { + for (u32 i = 0; i < n->in.len; i++) { if (i > 0) str_cat(&s, S(", "), &l->arena); str_cat(&s, type_desc(&IN(n, i)->type, &l->arena), &l->arena); } @@ -259,7 +258,7 @@ static int type_ok(Node *n) { switch (n->op) { case N_PHI: n->type = (Type) { .lvl = T_TOP, .t = IN(n, 1)->type.t }; - for (int i = 2; i < n->in.len; i++) { + for (u32 i = 2; i < n->in.len; i++) { if (!type_base_eql(&IN(n, i)->type, &n->type)) { return 0; } @@ -304,7 +303,7 @@ int node_uninit(Node *n) { int node_maybe_uninit(Node *n) { if (node_uninit(n)) return 1; - for (int i = 0; i < n->in.len; i++) { + for (u32 i = 0; i < n->in.len; i++) { if (IN(n,i) && node_maybe_uninit(IN(n,i))) { return 1; } |
