Skip to content

Commit

Permalink
[MachineCombiner] Add const to shouldReduceRegisterPressure argum…
Browse files Browse the repository at this point in the history
…ents. NFC

Differential Revision: https://reviews.llvm.org/D137174
  • Loading branch information
asi-sc committed Nov 2, 2022
1 parent a667aa4 commit 0c1f9b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGen/TargetInstrInfo.h
Expand Up @@ -1148,8 +1148,8 @@ class TargetInstrInfo : public MCInstrInfo {
/// 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;
}

Expand Down
14 changes: 6 additions & 8 deletions llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
Expand Up @@ -613,7 +613,7 @@ void PPCInstrInfo::finalizeInsInstrs(
}

bool PPCInstrInfo::shouldReduceRegisterPressure(
MachineBasicBlock *MBB, RegisterClassInfo *RegClassInfo) const {
const MachineBasicBlock *MBB, const RegisterClassInfo *RegClassInfo) const {

if (!EnableFMARegPressureReduction)
return false;
Expand All @@ -635,21 +635,19 @@ bool PPCInstrInfo::shouldReduceRegisterPressure(
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);

// Initialize the register pressure tracker.
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;
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/PowerPC/PPCInstrInfo.h
Expand Up @@ -471,9 +471,9 @@ class PPCInstrInfo : public PPCGenInstrInfo {
/// 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.
Expand Down

0 comments on commit 0c1f9b3

Please sign in to comment.