diff options
| author | Owen Anderson <resistor@mac.com> | 2009-01-29 22:13:06 +0000 | 
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-01-29 22:13:06 +0000 | 
| commit | bf77d2eb9d3e703211d19fa58650cde274e899df (patch) | |
| tree | 5cc833acdf32d40be546a0216caf02a4d765c464 /llvm/lib | |
| parent | 14d55f0a5c6cad9a2fe0ad2ca7532f380c524630 (diff) | |
| download | bcm5719-llvm-bf77d2eb9d3e703211d19fa58650cde274e899df.tar.gz bcm5719-llvm-bf77d2eb9d3e703211d19fa58650cde274e899df.zip | |
Correct the algorithms for choosing spill and restore points so that we don't try to insert loads/stores between call frame setup and the actual call.
This fixes the last known failure for the pre-alloc-splitter.
llvm-svn: 63339
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/PreAllocSplitting.cpp | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/llvm/lib/CodeGen/PreAllocSplitting.cpp b/llvm/lib/CodeGen/PreAllocSplitting.cpp index 4dc8b82972a..1180dee7b79 100644 --- a/llvm/lib/CodeGen/PreAllocSplitting.cpp +++ b/llvm/lib/CodeGen/PreAllocSplitting.cpp @@ -50,6 +50,7 @@ namespace {      MachineFunction       *CurrMF;      const TargetMachine   *TM;      const TargetInstrInfo *TII; +    const TargetRegisterInfo* TRI;      MachineFrameInfo      *MFI;      MachineRegisterInfo   *MRI;      LiveIntervals         *LIs; @@ -223,12 +224,21 @@ PreAllocSplitting::findSpillPoint(MachineBasicBlock *MBB, MachineInstr *MI,          Pt = MII;          SpillIndex = Gap;          break; -      } +       +      // We can't insert the spill between the barrier (a call), and its +      // corresponding call frame setup. +      } else if (prior(MII)->getOpcode() == TRI->getCallFrameSetupOpcode() && +                 MII == MachineBasicBlock::iterator(MI)) +        break;      } while (MII != EndPt);    } else {      MachineBasicBlock::iterator MII = MI;      MachineBasicBlock::iterator EndPt = DefMI        ? MachineBasicBlock::iterator(DefMI) : MBB->begin(); +     +    // We can't insert the spill between the barrier (a call), and its +    // corresponding call frame setup. +    if (prior(MII)->getOpcode() == TRI->getCallFrameSetupOpcode()) --MII;      while (MII != EndPt && !RefsInMBB.count(MII)) {        unsigned Index = LIs->getInstructionIndex(MII);        if (LIs->hasGapBeforeInstr(Index)) { @@ -269,12 +279,22 @@ PreAllocSplitting::findRestorePoint(MachineBasicBlock *MBB, MachineInstr *MI,          Pt = MII;          RestoreIndex = Gap;          break; -      } +       +      // We can't insert a restore between the barrier (a call) and its  +      // corresponding call frame teardown. +      } else if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode() && +                 prior(MII) == MachineBasicBlock::iterator(MI)) +        break;        --MII;      } while (MII != EndPt);    } else {      MachineBasicBlock::iterator MII = MI;      MII = ++MII; +    // We can't insert a restore between the barrier (a call) and its  +    // corresponding call frame teardown. +    if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode()) +      ++MII; +          // FIXME: Limit the number of instructions to examine to reduce      // compile time?      while (MII != MBB->getFirstTerminator()) { @@ -1291,6 +1311,7 @@ bool PreAllocSplitting::createsNewJoin(LiveRange* LR,  bool PreAllocSplitting::runOnMachineFunction(MachineFunction &MF) {    CurrMF = &MF;    TM     = &MF.getTarget(); +  TRI    = TM->getRegisterInfo();    TII    = TM->getInstrInfo();    MFI    = MF.getFrameInfo();    MRI    = &MF.getRegInfo(); | 

