From b033aba61bf05719c8481a38c06d88c3805b45a9 Mon Sep 17 00:00:00 2001 From: Trevor Elliott Date: Tue, 30 Aug 2022 09:14:20 -0700 Subject: [PATCH] Move the nop lowering to ISLE, and remove the final return from lower.rs (#4809) Lower nop in ISLE in the x64 backend, and remove the final Ok(()) from the lower function to assert that all cases that aren't handled in ISLE will panic. --- cranelift/codegen/src/isa/x64/lower.isle | 6 ++++++ cranelift/codegen/src/isa/x64/lower.rs | 9 ++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cranelift/codegen/src/isa/x64/lower.isle b/cranelift/codegen/src/isa/x64/lower.isle index 23f18a73f0..b86c2fe792 100644 --- a/cranelift/codegen/src/isa/x64/lower.isle +++ b/cranelift/codegen/src/isa/x64/lower.isle @@ -3758,3 +3758,9 @@ ;; SHUFPS xmm_y, xmm_xmp, 0x88 (x64_shufps dst zeros 0x88))) + +;; Rules for `nop` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(rule (lower (nop)) + (invalid_reg)) + diff --git a/cranelift/codegen/src/isa/x64/lower.rs b/cranelift/codegen/src/isa/x64/lower.rs index 6d1a0bec61..88ef7e500c 100644 --- a/cranelift/codegen/src/isa/x64/lower.rs +++ b/cranelift/codegen/src/isa/x64/lower.rs @@ -459,7 +459,8 @@ fn lower_insn_to_regs( | Opcode::Isplit | Opcode::TlsValue | Opcode::SqmulRoundSat - | Opcode::Uunarrow => { + | Opcode::Uunarrow + | Opcode::Nop => { let ty = if outputs.len() > 0 { Some(ctx.output_ty(insn, 0)) } else { @@ -572,13 +573,7 @@ fn lower_insn_to_regs( | Opcode::BrTable => { panic!("Branch opcode reached non-branch lowering logic!"); } - - Opcode::Nop => { - // Nothing. - } } - - Ok(()) } //=============================================================================