x64: port atomic_rmw to ISLE (#4389)
* x64: port `atomic_rmw` to ISLE This change ports `atomic_rmw` to ISLE for the x64 backend. It does not change the lowering in any way, though it seems possible that the fixed regs need not be as fixed and that there are opportunities for single instruction lowerings. It does rename `inst_common::AtomicRmwOp` to `MachAtomicRmwOp` to disambiguate with the IR enum with the same name. * x64: remove remaining hardcoded register constraints for `atomic_rmw` * x64: use `SyntheticAmode` in `AtomicRmwSeq` * review: add missing reg collector for amode * review: collect memory registers in the 'late' phase
This commit is contained in:
@@ -306,7 +306,7 @@ impl Amode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add the regs mentioned by `self` to `collector`.
|
||||
/// Add the registers mentioned by `self` to `collector`.
|
||||
pub(crate) fn get_operands<F: Fn(VReg) -> VReg>(
|
||||
&self,
|
||||
collector: &mut OperandCollector<'_, F>,
|
||||
@@ -325,6 +325,25 @@ impl Amode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as `get_operands`, but add the registers in the "late" phase.
|
||||
pub(crate) fn get_operands_late<F: Fn(VReg) -> VReg>(
|
||||
&self,
|
||||
collector: &mut OperandCollector<'_, F>,
|
||||
) {
|
||||
match self {
|
||||
Amode::ImmReg { base, .. } => {
|
||||
collector.reg_late_use(*base);
|
||||
}
|
||||
Amode::ImmRegRegShift { base, index, .. } => {
|
||||
collector.reg_late_use(base.to_reg());
|
||||
collector.reg_late_use(index.to_reg());
|
||||
}
|
||||
Amode::RipRelative { .. } => {
|
||||
// RIP isn't involved in regalloc.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_flags(&self) -> MemFlags {
|
||||
match self {
|
||||
Amode::ImmReg { flags, .. } => *flags,
|
||||
@@ -426,7 +445,7 @@ impl SyntheticAmode {
|
||||
SyntheticAmode::NominalSPOffset { simm32 }
|
||||
}
|
||||
|
||||
/// Add the regs mentioned by `self` to `collector`.
|
||||
/// Add the registers mentioned by `self` to `collector`.
|
||||
pub(crate) fn get_operands<F: Fn(VReg) -> VReg>(
|
||||
&self,
|
||||
collector: &mut OperandCollector<'_, F>,
|
||||
@@ -440,6 +459,20 @@ impl SyntheticAmode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as `get_operands`, but add the register in the "late" phase.
|
||||
pub(crate) fn get_operands_late<F: Fn(VReg) -> VReg>(
|
||||
&self,
|
||||
collector: &mut OperandCollector<'_, F>,
|
||||
) {
|
||||
match self {
|
||||
SyntheticAmode::Real(addr) => addr.get_operands_late(collector),
|
||||
SyntheticAmode::NominalSPOffset { .. } => {
|
||||
// Nothing to do; the base is SP and isn't involved in regalloc.
|
||||
}
|
||||
SyntheticAmode::ConstantOffset(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn finalize(&self, state: &mut EmitState, buffer: &MachBuffer<Inst>) -> Amode {
|
||||
match self {
|
||||
SyntheticAmode::Real(addr) => addr.clone(),
|
||||
|
||||
Reference in New Issue
Block a user