summary refs log tree commit diff
path: root/rv64
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-11-24 11:08:33 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-11-27 21:48:21 +0100
commit9126afa2da0e1635d78429075cc44ca576f68169 (patch)
tree0836f3da0fdfee9af24ca5dabb8244af61e5283e /rv64
parentb5da3f3d64c857baf808220e202dc37c5c039eb8 (diff)
downloadroux-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 'rv64')
-rw-r--r--rv64/emit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/rv64/emit.c b/rv64/emit.c
index 4ce6555..f9e58da 100644
--- a/rv64/emit.c
+++ b/rv64/emit.c
@@ -494,6 +494,9 @@ rv64_emitfn(Fn *fn, FILE *f)
 			emitins(i, fn, f);
 		lbl = 1;
 		switch (b->jmp.type) {
+		case Jhlt:
+			fprintf(f, "\tebreak\n");
+			break;
 		case Jret0:
 			if (fn->dynalloc) {
 				if (frame - 16 <= 2048)