Skip to content

Commit

Permalink
Move the nop lowering to ISLE, and remove the final return from lower…
Browse files Browse the repository at this point in the history
….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.
  • Loading branch information
elliottt authored Aug 30, 2022
1 parent 3d9d759 commit b033aba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 6 additions & 0 deletions cranelift/codegen/src/isa/x64/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -3758,3 +3758,9 @@

;; SHUFPS xmm_y, xmm_xmp, 0x88
(x64_shufps dst zeros 0x88)))

;; Rules for `nop` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(rule (lower (nop))
(invalid_reg))

9 changes: 2 additions & 7 deletions cranelift/codegen/src/isa/x64/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -572,13 +573,7 @@ fn lower_insn_to_regs(
| Opcode::BrTable => {
panic!("Branch opcode reached non-branch lowering logic!");
}

Opcode::Nop => {
// Nothing.
}
}

Ok(())
}

//=============================================================================
Expand Down

0 comments on commit b033aba

Please sign in to comment.