/// Return true if target supports reassociation of instructions in machine
/// combiner pass to reduce register pressure for a given BB.
virtual bool
- shouldReduceRegisterPressure(MachineBasicBlock *MBB,
- RegisterClassInfo *RegClassInfo) const {
+ shouldReduceRegisterPressure(const MachineBasicBlock *MBB,
+ const RegisterClassInfo *RegClassInfo) const {
return false;
}
}
bool PPCInstrInfo::shouldReduceRegisterPressure(
- MachineBasicBlock *MBB, RegisterClassInfo *RegClassInfo) const {
+ const MachineBasicBlock *MBB, const RegisterClassInfo *RegClassInfo) const {
if (!EnableFMARegPressureReduction)
return false;
return false;
const TargetRegisterInfo *TRI = &getRegisterInfo();
- MachineFunction *MF = MBB->getParent();
- MachineRegisterInfo *MRI = &MF->getRegInfo();
+ const MachineFunction *MF = MBB->getParent();
+ const MachineRegisterInfo *MRI = &MF->getRegInfo();
- auto GetMBBPressure = [&](MachineBasicBlock *MBB) -> std::vector<unsigned> {
+ auto GetMBBPressure =
+ [&](const MachineBasicBlock *MBB) -> std::vector<unsigned> {
RegionPressure Pressure;
RegPressureTracker RPTracker(Pressure);
RPTracker.init(MBB->getParent(), RegClassInfo, nullptr, MBB, MBB->end(),
/*TrackLaneMasks*/ false, /*TrackUntiedDefs=*/true);
- for (MachineBasicBlock::iterator MII = MBB->instr_end(),
- MIE = MBB->instr_begin();
- MII != MIE; --MII) {
- MachineInstr &MI = *std::prev(MII);
+ for (const auto &MI : reverse(*MBB)) {
if (MI.isDebugValue() || MI.isDebugLabel())
continue;
RegisterOperands RegOpers;
/// when the register pressure is high for one BB.
/// Return true if register pressure for \p MBB is high and ABI is supported
/// to reduce register pressure. Otherwise return false.
- bool
- shouldReduceRegisterPressure(MachineBasicBlock *MBB,
- RegisterClassInfo *RegClassInfo) const override;
+ bool shouldReduceRegisterPressure(
+ const MachineBasicBlock *MBB,
+ const RegisterClassInfo *RegClassInfo) const override;
/// Fixup the placeholders we put in genAlternativeCodeSequence() for
/// MachineCombiner.