diff options
Diffstat (limited to 'ir')
| -rw-r--r-- | ir/builder.c | 8 | ||||
| -rw-r--r-- | ir/dump.c | 2 | ||||
| -rw-r--r-- | ir/ir.h | 3 | ||||
| -rw-r--r-- | ir/regalloc.c | 4 |
4 files changed, 13 insertions, 4 deletions
diff --git a/ir/builder.c b/ir/builder.c index 640c1fd..1d73314 100644 --- a/ir/builder.c +++ b/ir/builder.c @@ -207,11 +207,19 @@ putcondbranch(struct function *fn, union ref arg, struct block *t, struct block void putreturn(struct function *fn, union ref r0, union ref r1) { + assert(fn->curblk); adduse(fn->curblk, USERJUMP, r0); adduse(fn->curblk, USERJUMP, r1); putjump(fn, Jret, r0, r1, NULL, NULL); } +void +puttrap(struct function *fn) +{ + assert(fn->curblk); + putjump(fn, Jtrap, NOREF, NOREF, NULL, NULL); +} + #undef putjump /* vim:set ts=3 sw=3 expandtab: */ @@ -176,7 +176,7 @@ dumpinst(const struct instr *ins) void dumpblk(struct function *fn, struct block *blk) { - static const char *jnames[] = { 0, "b", "ret" }; + static const char *jnames[] = { 0, "b", "ret", "trap" }; int i; efmt(" @%d:\n", blk->id); for (i = 0; i < blk->phi.n; ++i) { @@ -113,7 +113,7 @@ struct instr { union ref l, r; /* args */ }; -enum jumpkind { JXXX, Jb, Jret, }; +enum jumpkind { JXXX, Jb, Jret, Jtrap, }; struct block { int id; @@ -263,6 +263,7 @@ void useblk(struct function *, struct block *); void putbranch(struct function *, struct block *); void putcondbranch(struct function *, union ref arg, struct block *t, struct block *f); void putreturn(struct function *, union ref r0, union ref r1); +void puttrap(struct function *); /** fold.c **/ bool foldbinop(union ref *to, enum op, enum irclass, union ref l, union ref r); diff --git a/ir/regalloc.c b/ir/regalloc.c index f43bcc7..ca3ddcc 100644 --- a/ir/regalloc.c +++ b/ir/regalloc.c @@ -1134,10 +1134,10 @@ fini(struct rega *ra) * b @blk * @blk: * NOP - * ret + * ret/trap */ assert(p->s1 == blk); - p->jmp.t = Jret; + p->jmp.t = blk->jmp.t; p->s1 = NULL; } else if (blk->s1) { /* simplify: |