Simplify LowerBackend interface (#5432)
* Refactor lower_branch to have Unit result Branches cannot have any output, so it is more straightforward to have the ISLE term return Unit instead of InstOutput. Also provide a new `emit_side_effect` term to simplify implementation of `lower_branch` rules with Unit result. * Simplify LowerBackend interface Move all remaining asserts from the LowerBackend::lower and ::lower_branch_group into the common call site. Change return value of ::lower to Option<InstOutput>, and return value of ::lower_branch_group to Option<()> to match ISLE term signature. Only pass the first branch into ::lower_branch_group and rename it to ::lower_branch. As a result of all those changes, LowerBackend routines now consists solely to calls to the corresponding ISLE routines.
This commit is contained in:
@@ -1865,22 +1865,22 @@
|
||||
(decl vec_label_get (VecMachLabel u8) MachLabel )
|
||||
(extern constructor vec_label_get vec_label_get)
|
||||
|
||||
(decl partial lower_branch (Inst VecMachLabel) InstOutput)
|
||||
(decl partial lower_branch (Inst VecMachLabel) Unit)
|
||||
(rule (lower_branch (jump _ _) targets )
|
||||
(side_effect (SideEffectNoResult.Inst (gen_jump (vec_label_get targets 0)))))
|
||||
(emit_side_effect (SideEffectNoResult.Inst (gen_jump (vec_label_get targets 0)))))
|
||||
|
||||
;;; cc a b targets Type
|
||||
(decl lower_br_icmp (IntCC ValueRegs ValueRegs VecMachLabel Type) InstOutput)
|
||||
(decl lower_br_icmp (IntCC ValueRegs ValueRegs VecMachLabel Type) Unit)
|
||||
(extern constructor lower_br_icmp lower_br_icmp)
|
||||
|
||||
(decl lower_br_fcmp (FloatCC Reg Reg VecMachLabel Type) InstOutput)
|
||||
(decl lower_br_fcmp (FloatCC Reg Reg VecMachLabel Type) Unit)
|
||||
(extern constructor lower_br_fcmp lower_br_fcmp)
|
||||
|
||||
;; int scalar zero regs.
|
||||
(decl int_zero_reg (Type) ValueRegs)
|
||||
(extern constructor int_zero_reg int_zero_reg)
|
||||
|
||||
(decl lower_brz_or_nz (IntCC ValueRegs VecMachLabel Type) InstOutput)
|
||||
(decl lower_brz_or_nz (IntCC ValueRegs VecMachLabel Type) Unit)
|
||||
(extern constructor lower_brz_or_nz lower_brz_or_nz)
|
||||
|
||||
;; Normalize a value for comparision.
|
||||
@@ -1940,7 +1940,7 @@
|
||||
(lower_br_fcmp cc a b targets ty))
|
||||
|
||||
;;;
|
||||
(decl lower_br_table (Reg VecMachLabel) InstOutput)
|
||||
(decl lower_br_table (Reg VecMachLabel) Unit)
|
||||
(extern constructor lower_br_table lower_br_table)
|
||||
|
||||
(rule
|
||||
|
||||
Reference in New Issue
Block a user