[PATCH] D154347: [PEI][Mips] Switch to backwards frame index elimination
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 10:33:07 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfa78983bcb35: [PEI][Mips] Switch to backwards frame index elimination (authored by foad).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154347/new/
https://reviews.llvm.org/D154347
Files:
llvm/lib/CodeGen/PrologEpilogInserter.cpp
llvm/lib/Target/Mips/MipsRegisterInfo.h
Index: llvm/lib/Target/Mips/MipsRegisterInfo.h
===================================================================
--- llvm/lib/Target/Mips/MipsRegisterInfo.h
+++ llvm/lib/Target/Mips/MipsRegisterInfo.h
@@ -70,6 +70,8 @@
/// Return GPR register class.
virtual const TargetRegisterClass *intRegClass(unsigned Size) const = 0;
+ bool supportsBackwardScavenger() const override { return true; }
+
private:
virtual void eliminateFI(MachineBasicBlock::iterator II, unsigned OpNo,
int FrameIndex, uint64_t StackSize,
Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp
===================================================================
--- llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -1459,13 +1459,23 @@
assert(MF.getSubtarget().getRegisterInfo() &&
"getRegisterInfo() must be implemented!");
+ const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
+ const TargetFrameLowering &TFI = *MF.getSubtarget().getFrameLowering();
- RS->enterBasicBlockEnd(*BB);
+ RegScavenger *LocalRS = FrameIndexEliminationScavenging ? RS : nullptr;
+ if (LocalRS)
+ LocalRS->enterBasicBlockEnd(*BB);
for (MachineInstr &MI : make_early_inc_range(reverse(*BB))) {
+ if (TII.isFrameInstr(MI)) {
+ TFI.eliminateCallFramePseudoInstr(MF, *BB, &MI);
+ continue;
+ }
+
// Step backwards to get the liveness state at (immedately after) MI.
- RS->backward(MI);
+ if (LocalRS)
+ LocalRS->backward(MI);
for (unsigned i = 0; i != MI.getNumOperands(); ++i) {
if (!MI.getOperand(i).isFI())
@@ -1478,9 +1488,12 @@
//
// Save and restore the scavenger's position around the call to
// eliminateFrameIndex in case it erases MI and invalidates the iterator.
- MachineBasicBlock::iterator Save = std::next(RS->getCurrentPosition());
+ MachineBasicBlock::iterator Save;
+ if (LocalRS)
+ Save = std::next(LocalRS->getCurrentPosition());
bool Removed = TRI.eliminateFrameIndex(MI, SPAdj, i, RS);
- RS->skipTo(std::prev(Save));
+ if (LocalRS)
+ LocalRS->skipTo(std::prev(Save));
if (Removed)
break;
@@ -1496,7 +1509,7 @@
const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
- if (RS && TRI.supportsBackwardScavenger())
+ if (TRI.supportsBackwardScavenger())
return replaceFrameIndicesBackward(BB, MF, SPAdj);
if (RS && FrameIndexEliminationScavenging)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154347.538195.patch
Type: text/x-patch
Size: 2626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230707/d52c0043/attachment.bin>
More information about the llvm-commits
mailing list