diff options
author | Quentin Carbonneaux <quentin@c9x.me> | 2022-11-24 11:08:33 +0100 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2022-11-27 21:48:21 +0100 |
commit | 9126afa2da0e1635d78429075cc44ca576f68169 (patch) | |
tree | 0836f3da0fdfee9af24ca5dabb8244af61e5283e /arm64 | |
parent | b5da3f3d64c857baf808220e202dc37c5c039eb8 (diff) | |
download | roux-9126afa2da0e1635d78429075cc44ca576f68169.tar.gz |
new hlt block terminator
It is handy to express when the end of a block cannot be reached. If a hlt terminator is executed, it traps the program. We don't go the llvm way and specify execution semantics as undefined behavior.
Diffstat (limited to 'arm64')
-rw-r--r-- | arm64/emit.c | 3 | ||||
-rw-r--r-- | arm64/isel.c | 13 |
2 files changed, 7 insertions, 9 deletions
diff --git a/arm64/emit.c b/arm64/emit.c index 38b7e1a..4a0316c 100644 --- a/arm64/emit.c +++ b/arm64/emit.c @@ -561,6 +561,9 @@ arm64_emitfn(Fn *fn, FILE *out) emitins(i, e); lbl = 1; switch (b->jmp.type) { + case Jhlt: + fprintf(e->f, "\tbrk\t#1000\n"); + break; case Jret0: s = (e->frame - e->padding) / 4; for (r=arm64_rclob; *r>=0; r++) diff --git a/arm64/isel.c b/arm64/isel.c index 9b062d8..062beb3 100644 --- a/arm64/isel.c +++ b/arm64/isel.c @@ -239,16 +239,11 @@ seljmp(Blk *b, Fn *fn) Ins *i, *ir; int ck, cc, use; - switch (b->jmp.type) { - default: - assert(0 && "TODO 2"); - break; - case Jret0: - case Jjmp: + if (b->jmp.type == Jret0 + || b->jmp.type == Jjmp + || b->jmp.type == Jhlt) return; - case Jjnz: - break; - } + assert(b->jmp.type == Jjnz); r = b->jmp.arg; use = -1; b->jmp.arg = R; |