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:
@@ -3748,15 +3748,15 @@
|
||||
(MInst.EmitIsland needed_space)))
|
||||
|
||||
;; Helper for emitting `br_table` sequences.
|
||||
(decl br_table_impl (u64 Reg VecMachLabel) InstOutput)
|
||||
(decl br_table_impl (u64 Reg VecMachLabel) Unit)
|
||||
(rule (br_table_impl (imm12_from_u64 jt_size) ridx targets)
|
||||
(let ((jt_info BoxJTSequenceInfo (targets_jt_info targets)))
|
||||
(side_effect (with_flags_side_effect
|
||||
(emit_side_effect (with_flags_side_effect
|
||||
(cmp_imm (OperandSize.Size32) ridx jt_size)
|
||||
(jt_sequence ridx jt_info)))))
|
||||
(rule -1 (br_table_impl jt_size ridx targets)
|
||||
(let ((jt_size Reg (imm $I64 (ImmExtend.Zero) jt_size))
|
||||
(jt_info BoxJTSequenceInfo (targets_jt_info targets)))
|
||||
(side_effect (with_flags_side_effect
|
||||
(emit_side_effect (with_flags_side_effect
|
||||
(cmp (OperandSize.Size32) ridx jt_size)
|
||||
(jt_sequence ridx jt_info)))))
|
||||
|
||||
Reference in New Issue
Block a user