diff options
Diffstat (limited to 'src/nodes.c')
| -rw-r--r-- | src/nodes.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nodes.c b/src/nodes.c index 4c5e97a..294b531 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -48,6 +48,7 @@ struct blk *new_block(struct fn *f) { struct blk *b = calloc(1, sizeof(struct blk)); b->id = ++f->nblk; + b->reachable = false; b->insns = vec_create(sizeof(struct insn)); vec_append(&f->blks, &b); return b; @@ -82,6 +83,13 @@ void finish_function(struct fn *f, const char *name) destroy_block(last_blk); + last_blk = blk_back(f->blks); + /* somewhat arbitrary restriction but I guess but makes the + * implementation a bit simpler */ + assert(last_blk->btype == RET); + last_blk->s1 = NULL; + last_blk->s2 = NULL; + foreach_blk(i, f->blks) { struct blk *b = blk_at(f->blks, i); if (!b->to) |
