diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.h | 4 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/RegisterCoalescer.cpp | 10 | 
3 files changed, 16 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 786f3534a11..3e31051dbc3 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -64,7 +64,8 @@ void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const {    MachineFunctionPass::getAnalysisUsage(AU);  } -LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0) { +LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(0), +                                           EmitDone(false), ModifiedMF(false) {    initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry());  } @@ -701,12 +702,17 @@ bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) {      return false;    if (!pImpl)      pImpl = new LDVImpl(this); -  return static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf); +  ModifiedMF = static_cast<LDVImpl*>(pImpl)->runOnMachineFunction(mf); +  return ModifiedMF;  }  void LiveDebugVariables::releaseMemory() { -  if (pImpl) +  if (pImpl) {      static_cast<LDVImpl*>(pImpl)->clear(); +    // Make sure we call emitDebugValues if the machine function was modified. +    assert((!ModifiedMF || EmitDone) && +           "Dbg values are not emitted in LDV"); +  }  }  LiveDebugVariables::~LiveDebugVariables() { @@ -1014,8 +1020,10 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {  }  void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) { -  if (pImpl) +  if (pImpl) {      static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM); +    EmitDone = true; +  }  } diff --git a/llvm/lib/CodeGen/LiveDebugVariables.h b/llvm/lib/CodeGen/LiveDebugVariables.h index 3ce3c398bd4..bb4c160b30e 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.h +++ b/llvm/lib/CodeGen/LiveDebugVariables.h @@ -31,6 +31,10 @@ class VirtRegMap;  class LiveDebugVariables : public MachineFunctionPass {    void *pImpl; +  /// Whether emitDebugValues is called. +  bool EmitDone; +  /// Whether the machine function is modified during the pass. +  bool ModifiedMF;  public:    static char ID; // Pass identification, replacement for typeid diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index 36d81014227..e682d63c8fe 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -15,7 +15,6 @@  #define DEBUG_TYPE "regalloc"  #include "RegisterCoalescer.h" -#include "LiveDebugVariables.h"  #include "llvm/ADT/OwningPtr.h"  #include "llvm/ADT/STLExtras.h"  #include "llvm/ADT/SmallSet.h" @@ -84,7 +83,6 @@ namespace {      const TargetRegisterInfo* TRI;      const TargetInstrInfo* TII;      LiveIntervals *LIS; -    LiveDebugVariables *LDV;      const MachineLoopInfo* Loops;      AliasAnalysis *AA;      RegisterClassInfo RegClassInfo; @@ -208,7 +206,6 @@ char &llvm::RegisterCoalescerID = RegisterCoalescer::ID;  INITIALIZE_PASS_BEGIN(RegisterCoalescer, "simple-register-coalescing",                        "Simple Register Coalescing", false, false)  INITIALIZE_PASS_DEPENDENCY(LiveIntervals) -INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables)  INITIALIZE_PASS_DEPENDENCY(SlotIndexes)  INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)  INITIALIZE_AG_DEPENDENCY(AliasAnalysis) @@ -394,8 +391,6 @@ void RegisterCoalescer::getAnalysisUsage(AnalysisUsage &AU) const {    AU.addRequired<AliasAnalysis>();    AU.addRequired<LiveIntervals>();    AU.addPreserved<LiveIntervals>(); -  AU.addRequired<LiveDebugVariables>(); -  AU.addPreserved<LiveDebugVariables>();    AU.addPreserved<SlotIndexes>();    AU.addRequired<MachineLoopInfo>();    AU.addPreserved<MachineLoopInfo>(); @@ -883,9 +878,6 @@ void RegisterCoalescer::updateRegDefsUses(unsigned SrcReg,    bool DstIsPhys = TargetRegisterInfo::isPhysicalRegister(DstReg);    LiveInterval *DstInt = DstIsPhys ? 0 : &LIS->getInterval(DstReg); -  // Update LiveDebugVariables. -  LDV->renameRegister(SrcReg, DstReg, SubIdx); -    SmallPtrSet<MachineInstr*, 8> Visited;    for (MachineRegisterInfo::reg_iterator I = MRI->reg_begin(SrcReg);         MachineInstr *UseMI = I.skipInstruction();) { @@ -2136,7 +2128,6 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {    TRI = TM->getRegisterInfo();    TII = TM->getInstrInfo();    LIS = &getAnalysis<LiveIntervals>(); -  LDV = &getAnalysis<LiveDebugVariables>();    AA = &getAnalysis<AliasAnalysis>();    Loops = &getAnalysis<MachineLoopInfo>(); @@ -2182,7 +2173,6 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {    }    DEBUG(dump()); -  DEBUG(LDV->dump());    if (VerifyCoalescing)      MF->verify(this, "After register coalescing");    return true;  | 

