[PATCH] D35642: [PEI] Simplify handling of targets with no phys regs. NFC
Francis Visoiu Mistrih via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 14:02:30 PDT 2017
thegameg created this revision.
Make `doSpillCalleeSavedRegs` a member function, instead of passing most of the members of PEI as arguments.
https://reviews.llvm.org/D35642
Files:
lib/CodeGen/PrologEpilogInserter.cpp
Index: lib/CodeGen/PrologEpilogInserter.cpp
===================================================================
--- lib/CodeGen/PrologEpilogInserter.cpp
+++ lib/CodeGen/PrologEpilogInserter.cpp
@@ -48,12 +48,6 @@
#define DEBUG_TYPE "prologepilog"
typedef SmallVector<MachineBasicBlock *, 4> MBBVector;
-static void doSpillCalleeSavedRegs(MachineFunction &MF, RegScavenger *RS,
- unsigned &MinCSFrameIndex,
- unsigned &MaxCXFrameIndex,
- const MBBVector &SaveBlocks,
- const MBBVector &RestoreBlocks);
-
namespace {
class PEI : public MachineFunctionPass {
public:
@@ -77,11 +71,7 @@
bool runOnMachineFunction(MachineFunction &Fn) override;
private:
- std::function<void(MachineFunction &MF, RegScavenger *RS,
- unsigned &MinCSFrameIndex, unsigned &MaxCSFrameIndex,
- const MBBVector &SaveBlocks,
- const MBBVector &RestoreBlocks)>
- SpillCalleeSavedRegisters;
+ std::function<void(MachineFunction &MF)> SpillCalleeSavedRegisters;
std::function<void(MachineFunction &MF, RegScavenger &RS)>
ScavengeFrameVirtualRegs;
@@ -110,7 +100,7 @@
void calculateCallFrameInfo(MachineFunction &Fn);
void calculateSaveRestoreBlocks(MachineFunction &Fn);
-
+ void doSpillCalleeSavedRegs(MachineFunction &MF);
void calculateFrameObjectOffsets(MachineFunction &Fn);
void replaceFrameIndices(MachineFunction &Fn);
void replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
@@ -162,12 +152,12 @@
if (!SpillCalleeSavedRegisters) {
const TargetMachine &TM = Fn.getTarget();
if (!TM.usesPhysRegsForPEI()) {
- SpillCalleeSavedRegisters = [](MachineFunction &, RegScavenger *,
- unsigned &, unsigned &, const MBBVector &,
- const MBBVector &) {};
+ SpillCalleeSavedRegisters = [](MachineFunction &) {};
ScavengeFrameVirtualRegs = [](MachineFunction &, RegScavenger &) {};
} else {
- SpillCalleeSavedRegisters = doSpillCalleeSavedRegs;
+ SpillCalleeSavedRegisters = [this](MachineFunction &Fn) {
+ this->doSpillCalleeSavedRegs(Fn);
+ };
ScavengeFrameVirtualRegs = scavengeFrameVirtualRegs;
UsesCalleeSaves = true;
}
@@ -192,8 +182,7 @@
calculateSaveRestoreBlocks(Fn);
// Handle CSR spilling and restoring, for targets that need it.
- SpillCalleeSavedRegisters(Fn, RS, MinCSFrameIndex, MaxCSFrameIndex,
- SaveBlocks, RestoreBlocks);
+ SpillCalleeSavedRegisters(Fn);
// Allow the target machine to make final modifications to the function
// before the frame layout is finalized.
@@ -533,11 +522,7 @@
}
}
-static void doSpillCalleeSavedRegs(MachineFunction &Fn, RegScavenger *RS,
- unsigned &MinCSFrameIndex,
- unsigned &MaxCSFrameIndex,
- const MBBVector &SaveBlocks,
- const MBBVector &RestoreBlocks) {
+void PEI::doSpillCalleeSavedRegs(MachineFunction &Fn) {
const Function *F = Fn.getFunction();
const TargetFrameLowering *TFI = Fn.getSubtarget().getFrameLowering();
MinCSFrameIndex = std::numeric_limits<unsigned>::max();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35642.107369.patch
Type: text/x-patch
Size: 3399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/9f65032e/attachment.bin>
More information about the llvm-commits
mailing list