Add a stack_check instruction.

This instruction loads a stack limit from a global variable and compares
it to the stack pointer, trapping if the stack has grown beyond the
limit.

Also add a expand_flags transform group containing legalization patterns
for ISAs with CPU flags.

Fixes #234.
This commit is contained in:
Jakob Stoklund Olesen
2018-02-12 13:50:22 -08:00
parent a73fcb2691
commit 3ccc3f4f9b
8 changed files with 107 additions and 13 deletions

View File

@@ -12,9 +12,8 @@ ebb0(v1: i32):
trapz v1, user67
return
; check: $ebb0($v1: i32
; nextln: brnz $v1, $(new=$EBB)
; nextln: trap user67
; check: $new:
; nextln: $(f=$V) = ifcmp_imm $v1, 0
; nextln: trapif eq $f, user67
; nextln: return
}
@@ -23,9 +22,8 @@ ebb0(v1: i32):
trapnz v1, int_ovf
return
; check: $ebb0($v1: i32
; nextln: brz $v1, $(new=$EBB)
; nextln: trap int_ovf
; check: $new:
; nextln: $(f=$V) = ifcmp_imm $v1, 0
; nextln: trapif ne $f, int_ovf
; nextln: return
}