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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user