Remove trapif and trapff (#5162)

This branch removes the trapif and trapff instructions, in favor of using an explicit comparison and trapnz. This moves us closer to removing iflags and fflags, but introduces the need to implement instructions like iadd_cout in the x64 and aarch64 backends.
This commit is contained in:
Trevor Elliott
2022-11-03 09:25:11 -07:00
committed by GitHub
parent 311b01875f
commit aeceea28e2
19 changed files with 30 additions and 215 deletions

View File

@@ -1682,26 +1682,6 @@
(rule (lower (trap trap_code))
(side_effect (udf trap_code)))
;;;; Rules for `trapif` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(rule (lower (trapif cc insn @ (iadd_ifcout x y) trap_code))
;; The flags must not have been clobbered by any other instruction, as
;; verified by the CLIF validator; so we can simply use the flags here.
(let ((insn ProducesFlags (flags_to_producesflags insn)))
(trap_if insn trap_code (cond_code cc))))
;; Verification ensures the input is always a single-def ifcmp.
(rule (lower (trapif cc insn @ (ifcmp x @ (value_type ty) y) trap_code))
(let ((cond Cond (cond_code cc)))
(trap_if (lower_icmp_into_flags cc x y ty) trap_code cond)))
;;;; Rules for `trapff` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Verification ensures the input is always a single-def ffcmp.
(rule (lower (trapff cc insn @ (ffcmp x @ (value_type ty) y) trap_code))
(let ((cond Cond (fp_cond_code cc)))
(trap_if (fpu_cmp (scalar_size ty) x y) trap_code cond)))
;;;; Rules for `resumable_trap` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(rule (lower (resumable_trap trap_code))