Skip to content

Commit e18681c

Browse files
committed
Minor cleanups
This commit includes very minor clean-ups, these are mechanical changes only. * Rename `shift_rr` to `shift`, as we're still passing the context in, the callee can decide what to do with the instruction arguments. * Delete the un-used `Into<AluOp> for ShiftKind`
1 parent 133be33 commit e18681c

5 files changed

Lines changed: 5 additions & 19 deletions

File tree

winch/codegen/src/codegen/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<'a> CodeGenContext<'a> {
341341
);
342342
self.stack.push(typed_reg.into());
343343
} else {
344-
masm.shift_rr(self, kind, OperandSize::S32);
344+
masm.shift(self, kind, OperandSize::S32);
345345
}
346346
}
347347

@@ -366,7 +366,7 @@ impl<'a> CodeGenContext<'a> {
366366
);
367367
self.stack.push(typed_reg.into());
368368
} else {
369-
masm.shift_rr(self, kind, OperandSize::S64);
369+
masm.shift(self, kind, OperandSize::S64);
370370
};
371371
}
372372

winch/codegen/src/isa/aarch64/asm.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ impl From<OperandSize> for inst::OperandSize {
2929
}
3030
}
3131

32-
impl Into<ALUOp> for ShiftKind {
33-
fn into(self) -> ALUOp {
34-
match self {
35-
ShiftKind::Shl => ALUOp::Lsl,
36-
ShiftKind::ShrS => ALUOp::Asr,
37-
ShiftKind::ShrU => ALUOp::Lsr,
38-
ShiftKind::Rotr => ALUOp::RotR,
39-
// Rotl is implemented as neg+ROR.
40-
ShiftKind::Rotl => unimplemented!(),
41-
}
42-
}
43-
}
44-
4532
impl Into<ScalarSize> for OperandSize {
4633
fn into(self) -> ScalarSize {
4734
match self {

winch/codegen/src/isa/aarch64/masm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@ impl Masm for MacroAssembler {
405405
self.asm.shift_ir(imm, lhs, dst, kind, size)
406406
}
407407

408-
fn shift_rr(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize) {
409-
// Number of bits to shift must be in the CL register.
408+
fn shift(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize) {
410409
let src = context.pop_to_reg(self, None);
411410
let dst = context.pop_to_reg(self, None);
412411

winch/codegen/src/isa/x64/masm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ impl Masm for MacroAssembler {
535535
self.asm.shift_ir(imm as u8, dst, kind, size)
536536
}
537537

538-
fn shift_rr(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize) {
538+
fn shift(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize) {
539539
// Number of bits to shift must be in the CL register.
540540
let src = context.pop_to_reg(self, Some(regs::rcx()));
541541
let dst = context.pop_to_reg(self, None);

winch/codegen/src/masm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ pub(crate) trait MacroAssembler {
704704
/// caller from having to deal with the architecture specific constraints
705705
/// we give this function access to the code generation context, allowing
706706
/// each implementation to decide the lowering path.
707-
fn shift_rr(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize);
707+
fn shift(&mut self, context: &mut CodeGenContext, kind: ShiftKind, size: OperandSize);
708708

709709
/// Perform division operation.
710710
/// Division is special in that some architectures have specific

0 commit comments

Comments
 (0)