diff options
author | Francis Visoiu Mistrih <fvisoiumistrih@apple.com> | 2017-07-20 02:47:05 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <fvisoiumistrih@apple.com> | 2017-07-20 02:47:05 +0000 |
commit | 185b2e3d32f7dcd6de88b6b524bc8fabb540f8b5 (patch) | |
tree | d7d28abf712511cf073131765bc42c2fb7938872 /llvm/lib/CodeGen/PrologEpilogInserter.cpp | |
parent | b3ddc1686ba3fe0fec3a398c0928318c4b66d96a (diff) | |
download | bcm5719-llvm-185b2e3d32f7dcd6de88b6b524bc8fabb540f8b5.tar.gz bcm5719-llvm-185b2e3d32f7dcd6de88b6b524bc8fabb540f8b5.zip |
Revert "[PEI] Simplify handling of targets with no phys regs. NFC"
This reverts commit ce30ab6e5598f3c24f59ad016dc9526bc9a1d450.
sanitizer-ppc64le-linux seems to segfault when testing the sanitizers.
llvm-svn: 308581
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 9bc3f90fbea..85f67c90992 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -49,6 +49,12 @@ using namespace llvm; #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: @@ -72,7 +78,11 @@ public: bool runOnMachineFunction(MachineFunction &Fn) override; private: - std::function<void(MachineFunction &MF)> SpillCalleeSavedRegisters; + std::function<void(MachineFunction &MF, RegScavenger *RS, + unsigned &MinCSFrameIndex, unsigned &MaxCSFrameIndex, + const MBBVector &SaveBlocks, + const MBBVector &RestoreBlocks)> + SpillCalleeSavedRegisters; std::function<void(MachineFunction &MF, RegScavenger &RS)> ScavengeFrameVirtualRegs; @@ -104,7 +114,7 @@ private: 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, @@ -158,12 +168,12 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) { if (!SpillCalleeSavedRegisters) { const TargetMachine &TM = Fn.getTarget(); if (!TM.usesPhysRegsForPEI()) { - SpillCalleeSavedRegisters = [](MachineFunction &) {}; + SpillCalleeSavedRegisters = [](MachineFunction &, RegScavenger *, + unsigned &, unsigned &, const MBBVector &, + const MBBVector &) {}; ScavengeFrameVirtualRegs = [](MachineFunction &, RegScavenger &) {}; } else { - SpillCalleeSavedRegisters = [this](MachineFunction &Fn) { - this->doSpillCalleeSavedRegs(Fn); - }; + SpillCalleeSavedRegisters = doSpillCalleeSavedRegs; ScavengeFrameVirtualRegs = scavengeFrameVirtualRegs; UsesCalleeSaves = true; } @@ -189,7 +199,8 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) { calculateSaveRestoreBlocks(Fn); // Handle CSR spilling and restoring, for targets that need it. - SpillCalleeSavedRegisters(Fn); + SpillCalleeSavedRegisters(Fn, RS, MinCSFrameIndex, MaxCSFrameIndex, + SaveBlocks, RestoreBlocks); // Allow the target machine to make final modifications to the function // before the frame layout is finalized. @@ -529,7 +540,11 @@ static void insertCSRSpillsAndRestores(MachineFunction &Fn, } } -void PEI::doSpillCalleeSavedRegs(MachineFunction &Fn) { +static void doSpillCalleeSavedRegs(MachineFunction &Fn, RegScavenger *RS, + unsigned &MinCSFrameIndex, + unsigned &MaxCSFrameIndex, + const MBBVector &SaveBlocks, + const MBBVector &RestoreBlocks) { const Function *F = Fn.getFunction(); const TargetFrameLowering *TFI = Fn.getSubtarget().getFrameLowering(); MinCSFrameIndex = std::numeric_limits<unsigned>::max(); |