diff options
author | Nicola Zaghen <nicola.zaghen@imgtec.com> | 2018-05-14 12:53:11 +0000 |
---|---|---|
committer | Nicola Zaghen <nicola.zaghen@imgtec.com> | 2018-05-14 12:53:11 +0000 |
commit | d34e60ca8532511acb8c93ef26297e349fbec86a (patch) | |
tree | 1a095bc8694498d94232e81b95c1da05d462d3ec /llvm/lib/CodeGen/RegisterCoalescer.cpp | |
parent | affbc99bea94e77f7ebccd8ba887e33051bd04ee (diff) | |
download | bcm5719-llvm-d34e60ca8532511acb8c93ef26297e349fbec86a.tar.gz bcm5719-llvm-d34e60ca8532511acb8c93ef26297e349fbec86a.zip |
Rename DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM
- Manual change to APInt
- Manually chage DOCS as regex doesn't match it.
In the transition period the DEBUG() macro is still present and aliased
to the LLVM_DEBUG() one.
Differential Revision: https://reviews.llvm.org/D43624
llvm-svn: 332240
Diffstat (limited to 'llvm/lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegisterCoalescer.cpp | 196 |
1 files changed, 101 insertions, 95 deletions
diff --git a/llvm/lib/CodeGen/RegisterCoalescer.cpp b/llvm/lib/CodeGen/RegisterCoalescer.cpp index a9565fae8f1..db5258e6270 100644 --- a/llvm/lib/CodeGen/RegisterCoalescer.cpp +++ b/llvm/lib/CodeGen/RegisterCoalescer.cpp @@ -568,7 +568,7 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP, // in IntB, we can merge them. if (ValS+1 != BS) return false; - DEBUG(dbgs() << "Extending: " << printReg(IntB.reg, TRI)); + LLVM_DEBUG(dbgs() << "Extending: " << printReg(IntB.reg, TRI)); SlotIndex FillerStart = ValS->end, FillerEnd = BS->start; // We are about to delete CopyMI, so need to remove it as the 'instruction @@ -594,7 +594,7 @@ bool RegisterCoalescer::adjustCopiesBackFrom(const CoalescerPair &CP, S.MergeValueNumberInto(SubBValNo, SubValSNo); } - DEBUG(dbgs() << " result = " << IntB << '\n'); + LLVM_DEBUG(dbgs() << " result = " << IntB << '\n'); // If the source instruction was killing the source register before the // merge, unset the isKill marker given the live range has been extended. @@ -742,8 +742,8 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP, return false; } - DEBUG(dbgs() << "\tremoveCopyByCommutingDef: " << AValNo->def << '\t' - << *DefMI); + LLVM_DEBUG(dbgs() << "\tremoveCopyByCommutingDef: " << AValNo->def << '\t' + << *DefMI); // At this point we have decided that it is legal to do this // transformation. Start by commuting the instruction. @@ -812,7 +812,7 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP, VNInfo *DVNI = IntB.getVNInfoAt(DefIdx); if (!DVNI) continue; - DEBUG(dbgs() << "\t\tnoop: " << DefIdx << '\t' << *UseMI); + LLVM_DEBUG(dbgs() << "\t\tnoop: " << DefIdx << '\t' << *UseMI); assert(DVNI->def == DefIdx); BValNo = IntB.MergeValueNumberInto(DVNI, BValNo); for (LiveInterval::SubRange &S : IntB.subranges()) { @@ -853,11 +853,11 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP, BValNo->def = AValNo->def; addSegmentsWithValNo(IntB, BValNo, IntA, AValNo); - DEBUG(dbgs() << "\t\textended: " << IntB << '\n'); + LLVM_DEBUG(dbgs() << "\t\textended: " << IntB << '\n'); LIS->removeVRegDefAt(IntA, AValNo->def); - DEBUG(dbgs() << "\t\ttrimmed: " << IntA << '\n'); + LLVM_DEBUG(dbgs() << "\t\ttrimmed: " << IntA << '\n'); ++numCommutes; return true; } @@ -1003,8 +1003,8 @@ bool RegisterCoalescer::removePartialRedundancy(const CoalescerPair &CP, return false; } - DEBUG(dbgs() << "\tremovePartialRedundancy: Move the copy to " - << printMBBReference(*CopyLeftBB) << '\t' << CopyMI); + LLVM_DEBUG(dbgs() << "\tremovePartialRedundancy: Move the copy to " + << printMBBReference(*CopyLeftBB) << '\t' << CopyMI); // Insert new copy to CopyLeftBB. MachineInstr *NewCopyMI = BuildMI(*CopyLeftBB, InsPos, CopyMI.getDebugLoc(), @@ -1021,8 +1021,8 @@ bool RegisterCoalescer::removePartialRedundancy(const CoalescerPair &CP, // the deleted list. ErasedInstrs.erase(NewCopyMI); } else { - DEBUG(dbgs() << "\tremovePartialRedundancy: Remove the copy from " - << printMBBReference(MBB) << '\t' << CopyMI); + LLVM_DEBUG(dbgs() << "\tremovePartialRedundancy: Remove the copy from " + << printMBBReference(MBB) << '\t' << CopyMI); } // Remove CopyMI. @@ -1277,8 +1277,9 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, bool UpdatedSubRanges = false; for (LiveInterval::SubRange &SR : DstInt.subranges()) { if ((SR.LaneMask & DstMask).none()) { - DEBUG(dbgs() << "Removing undefined SubRange " - << PrintLaneMask(SR.LaneMask) << " : " << SR << "\n"); + LLVM_DEBUG(dbgs() + << "Removing undefined SubRange " + << PrintLaneMask(SR.LaneMask) << " : " << SR << "\n"); // VNI is in ValNo - remove any segments in this SubRange that have this ValNo if (VNInfo *RmValNo = SR.getVNInfoAt(CurrIdx.getRegSlot())) { SR.removeValNo(RmValNo); @@ -1335,7 +1336,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, LR->createDeadDef(NewMIIdx.getRegSlot(), LIS->getVNInfoAllocator()); } - DEBUG(dbgs() << "Remat: " << NewMI); + LLVM_DEBUG(dbgs() << "Remat: " << NewMI); ++NumReMats; // The source interval can become smaller because we removed a use. @@ -1350,7 +1351,7 @@ bool RegisterCoalescer::reMaterializeTrivialDef(const CoalescerPair &CP, // Move the debug value directly after the def of the rematerialized // value in DstReg. MBB->splice(std::next(NewMI.getIterator()), UseMI->getParent(), UseMI); - DEBUG(dbgs() << "\t\tupdated: " << *UseMI); + LLVM_DEBUG(dbgs() << "\t\tupdated: " << *UseMI); } } eliminateDeadDefs(); @@ -1388,7 +1389,7 @@ bool RegisterCoalescer::eliminateUndefCopy(MachineInstr *CopyMI) { } else if (SrcLI.liveAt(Idx)) return false; - DEBUG(dbgs() << "\tEliminating copy of <undef> value\n"); + LLVM_DEBUG(dbgs() << "\tEliminating copy of <undef> value\n"); // Remove any DstReg segments starting at the instruction. LiveInterval &DstLI = LIS->getInterval(DstReg); @@ -1435,7 +1436,7 @@ bool RegisterCoalescer::eliminateUndefCopy(MachineInstr *CopyMI) { if (isLive) continue; MO.setIsUndef(true); - DEBUG(dbgs() << "\tnew undef: " << UseIdx << '\t' << MI); + LLVM_DEBUG(dbgs() << "\tnew undef: " << UseIdx << '\t' << MI); } // A def of a subregister may be a use of the other subregisters, so @@ -1550,12 +1551,12 @@ void RegisterCoalescer::updateRegDefsUses(unsigned SrcReg, MO.substVirtReg(DstReg, SubIdx, *TRI); } - DEBUG({ - dbgs() << "\t\tupdated: "; - if (!UseMI->isDebugValue()) - dbgs() << LIS->getInstructionIndex(*UseMI) << "\t"; - dbgs() << *UseMI; - }); + LLVM_DEBUG({ + dbgs() << "\t\tupdated: "; + if (!UseMI->isDebugValue()) + dbgs() << LIS->getInstructionIndex(*UseMI) << "\t"; + dbgs() << *UseMI; + }); } } @@ -1564,7 +1565,7 @@ bool RegisterCoalescer::canJoinPhys(const CoalescerPair &CP) { // reserved register. This doesn't increase register pressure, so it is // always beneficial. if (!MRI->isReserved(CP.getDstReg())) { - DEBUG(dbgs() << "\tCan only merge into reserved registers.\n"); + LLVM_DEBUG(dbgs() << "\tCan only merge into reserved registers.\n"); return false; } @@ -1572,17 +1573,18 @@ bool RegisterCoalescer::canJoinPhys(const CoalescerPair &CP) { if (JoinVInt.containsOneValue()) return true; - DEBUG(dbgs() << "\tCannot join complex intervals into reserved register.\n"); + LLVM_DEBUG( + dbgs() << "\tCannot join complex intervals into reserved register.\n"); return false; } bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { Again = false; - DEBUG(dbgs() << LIS->getInstructionIndex(*CopyMI) << '\t' << *CopyMI); + LLVM_DEBUG(dbgs() << LIS->getInstructionIndex(*CopyMI) << '\t' << *CopyMI); CoalescerPair CP(*TRI); if (!CP.setRegisters(CopyMI)) { - DEBUG(dbgs() << "\tNot coalescable.\n"); + LLVM_DEBUG(dbgs() << "\tNot coalescable.\n"); return false; } @@ -1597,7 +1599,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { } if (!TRI->shouldCoalesce(CopyMI, SrcRC, SrcIdx, DstRC, DstIdx, CP.getNewRC(), *LIS)) { - DEBUG(dbgs() << "\tSubtarget bailed on coalescing.\n"); + LLVM_DEBUG(dbgs() << "\tSubtarget bailed on coalescing.\n"); return false; } } @@ -1606,7 +1608,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // sometimes dead copies slip through, and we can't generate invalid live // ranges. if (!CP.isPhys() && CopyMI->allDefsAreDead()) { - DEBUG(dbgs() << "\tCopy is dead.\n"); + LLVM_DEBUG(dbgs() << "\tCopy is dead.\n"); DeadDefs.push_back(CopyMI); eliminateDeadDefs(); return true; @@ -1623,7 +1625,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // When that happens, just join the values and remove the copy. if (CP.getSrcReg() == CP.getDstReg()) { LiveInterval &LI = LIS->getInterval(CP.getSrcReg()); - DEBUG(dbgs() << "\tCopy already coalesced: " << LI << '\n'); + LLVM_DEBUG(dbgs() << "\tCopy already coalesced: " << LI << '\n'); const SlotIndex CopyIdx = LIS->getInstructionIndex(*CopyMI); LiveQueryResult LRQ = LI.Query(CopyIdx); if (VNInfo *DefVNI = LRQ.valueDefined()) { @@ -1640,7 +1642,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { S.MergeValueNumberInto(SDefVNI, SReadVNI); } } - DEBUG(dbgs() << "\tMerged values: " << LI << '\n'); + LLVM_DEBUG(dbgs() << "\tMerged values: " << LI << '\n'); } deleteInstr(CopyMI); return true; @@ -1648,9 +1650,9 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // Enforce policies. if (CP.isPhys()) { - DEBUG(dbgs() << "\tConsidering merging " << printReg(CP.getSrcReg(), TRI) - << " with " << printReg(CP.getDstReg(), TRI, CP.getSrcIdx()) - << '\n'); + LLVM_DEBUG(dbgs() << "\tConsidering merging " + << printReg(CP.getSrcReg(), TRI) << " with " + << printReg(CP.getDstReg(), TRI, CP.getSrcIdx()) << '\n'); if (!canJoinPhys(CP)) { // Before giving up coalescing, if definition of source is defined by // trivial computation, try rematerializing it. @@ -1667,7 +1669,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { LIS->getInterval(CP.getDstReg()).size()) CP.flip(); - DEBUG({ + LLVM_DEBUG({ dbgs() << "\tConsidering merging to " << TRI->getRegClassName(CP.getNewRC()) << " with "; if (CP.getDstIdx() && CP.getSrcIdx()) @@ -1703,7 +1705,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { if (adjustCopiesBackFrom(CP, CopyMI) || removeCopyByCommutingDef(CP, CopyMI)) { deleteInstr(CopyMI); - DEBUG(dbgs() << "\tTrivial!\n"); + LLVM_DEBUG(dbgs() << "\tTrivial!\n"); return true; } } @@ -1715,7 +1717,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { return true; // Otherwise, we are unable to join the intervals. - DEBUG(dbgs() << "\tInterference!\n"); + LLVM_DEBUG(dbgs() << "\tInterference!\n"); Again = true; // May be possible to coalesce later. return false; } @@ -1749,8 +1751,8 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { for (LiveInterval::SubRange &S : LI.subranges()) { if ((S.LaneMask & ShrinkMask).none()) continue; - DEBUG(dbgs() << "Shrink LaneUses (Lane " << PrintLaneMask(S.LaneMask) - << ")\n"); + LLVM_DEBUG(dbgs() << "Shrink LaneUses (Lane " << PrintLaneMask(S.LaneMask) + << ")\n"); LIS->shrinkToUses(S, LI.reg); } LI.removeEmptySubRanges(); @@ -1767,7 +1769,7 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) { // Update regalloc hint. TRI->updateRegAllocHint(CP.getSrcReg(), CP.getDstReg(), *MF); - DEBUG({ + LLVM_DEBUG({ dbgs() << "\tSuccess: " << printReg(CP.getSrcReg(), TRI, CP.getSrcIdx()) << " -> " << printReg(CP.getDstReg(), TRI, CP.getDstIdx()) << '\n'; dbgs() << "\tResult = "; @@ -1788,7 +1790,7 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { assert(CP.isPhys() && "Must be a physreg copy"); assert(MRI->isReserved(DstReg) && "Not a reserved register"); LiveInterval &RHS = LIS->getInterval(SrcReg); - DEBUG(dbgs() << "\t\tRHS = " << RHS << '\n'); + LLVM_DEBUG(dbgs() << "\t\tRHS = " << RHS << '\n'); assert(RHS.containsOneValue() && "Invalid join with reserved register"); @@ -1807,7 +1809,8 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { return false; } if (RHS.overlaps(LIS->getRegUnit(*UI))) { - DEBUG(dbgs() << "\t\tInterference: " << printRegUnit(*UI, TRI) << '\n'); + LLVM_DEBUG(dbgs() << "\t\tInterference: " << printRegUnit(*UI, TRI) + << '\n'); return false; } } @@ -1816,7 +1819,7 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { BitVector RegMaskUsable; if (LIS->checkRegMaskInterference(RHS, RegMaskUsable) && !RegMaskUsable.test(DstReg)) { - DEBUG(dbgs() << "\t\tRegMask interference\n"); + LLVM_DEBUG(dbgs() << "\t\tRegMask interference\n"); return false; } } @@ -1846,12 +1849,12 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { // %y = def // ... if (!MRI->hasOneNonDBGUse(SrcReg)) { - DEBUG(dbgs() << "\t\tMultiple vreg uses!\n"); + LLVM_DEBUG(dbgs() << "\t\tMultiple vreg uses!\n"); return false; } if (!LIS->intervalIsInOneMBB(RHS)) { - DEBUG(dbgs() << "\t\tComplex control flow!\n"); + LLVM_DEBUG(dbgs() << "\t\tComplex control flow!\n"); return false; } @@ -1869,7 +1872,7 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { SI != CopyRegIdx; SI = Indexes->getNextNonNullIndex(SI)) { MachineInstr *MI = LIS->getInstructionFromIndex(SI); if (MI->readsRegister(DstReg, TRI)) { - DEBUG(dbgs() << "\t\tInterference (read): " << *MI); + LLVM_DEBUG(dbgs() << "\t\tInterference (read): " << *MI); return false; } } @@ -1877,8 +1880,8 @@ bool RegisterCoalescer::joinReservedPhysReg(CoalescerPair &CP) { // We're going to remove the copy which defines a physical reserved // register, so remove its valno, etc. - DEBUG(dbgs() << "\t\tRemoving phys reg def of " << printReg(DstReg, TRI) - << " at " << CopyRegIdx << "\n"); + LLVM_DEBUG(dbgs() << "\t\tRemoving phys reg def of " + << printReg(DstReg, TRI) << " at " << CopyRegIdx << "\n"); LIS->removePhysRegDefAt(DstReg, CopyRegIdx); // Create a new dead def at the new def location. @@ -2386,9 +2389,10 @@ JoinVals::analyzeValue(unsigned ValNo, JoinVals &Other) { // to erase the IMPLICIT_DEF instruction. if (OtherV.ErasableImplicitDef && DefMI && DefMI->getParent() != Indexes->getMBBFromIndex(V.OtherVNI->def)) { - DEBUG(dbgs() << "IMPLICIT_DEF defined at " << V.OtherVNI->def - << " extends into " << printMBBReference(*DefMI->getParent()) - << ", keeping it.\n"); + LLVM_DEBUG(dbgs() << "IMPLICIT_DEF defined at " << V.OtherVNI->def + << " extends into " + << printMBBReference(*DefMI->getParent()) + << ", keeping it.\n"); OtherV.ErasableImplicitDef = false; } @@ -2498,11 +2502,11 @@ void JoinVals::computeAssignment(unsigned ValNo, JoinVals &Other) { assert(V.OtherVNI && "OtherVNI not assigned, can't merge."); assert(Other.Vals[V.OtherVNI->id].isAnalyzed() && "Missing recursion"); Assignments[ValNo] = Other.Assignments[V.OtherVNI->id]; - DEBUG(dbgs() << "\t\tmerge " << printReg(Reg) << ':' << ValNo << '@' - << LR.getValNumInfo(ValNo)->def << " into " - << printReg(Other.Reg) << ':' << V.OtherVNI->id << '@' - << V.OtherVNI->def << " --> @" - << NewVNInfo[Assignments[ValNo]]->def << '\n'); + LLVM_DEBUG(dbgs() << "\t\tmerge " << printReg(Reg) << ':' << ValNo << '@' + << LR.getValNumInfo(ValNo)->def << " into " + << printReg(Other.Reg) << ':' << V.OtherVNI->id << '@' + << V.OtherVNI->def << " --> @" + << NewVNInfo[Assignments[ValNo]]->def << '\n'); break; case CR_Replace: case CR_Unresolved: { @@ -2528,8 +2532,8 @@ bool JoinVals::mapValues(JoinVals &Other) { for (unsigned i = 0, e = LR.getNumValNums(); i != e; ++i) { computeAssignment(i, Other); if (Vals[i].Resolution == CR_Impossible) { - DEBUG(dbgs() << "\t\tinterference at " << printReg(Reg) << ':' << i - << '@' << LR.getValNumInfo(i)->def << '\n'); + LLVM_DEBUG(dbgs() << "\t\tinterference at " << printReg(Reg) << ':' << i + << '@' << LR.getValNumInfo(i)->def << '\n'); return false; } } @@ -2551,13 +2555,13 @@ taintExtent(unsigned ValNo, LaneBitmask TaintedLanes, JoinVals &Other, // lanes escape the block. SlotIndex End = OtherI->end; if (End >= MBBEnd) { - DEBUG(dbgs() << "\t\ttaints global " << printReg(Other.Reg) << ':' - << OtherI->valno->id << '@' << OtherI->start << '\n'); + LLVM_DEBUG(dbgs() << "\t\ttaints global " << printReg(Other.Reg) << ':' + << OtherI->valno->id << '@' << OtherI->start << '\n'); return false; } - DEBUG(dbgs() << "\t\ttaints local " << printReg(Other.Reg) << ':' - << OtherI->valno->id << '@' << OtherI->start - << " to " << End << '\n'); + LLVM_DEBUG(dbgs() << "\t\ttaints local " << printReg(Other.Reg) << ':' + << OtherI->valno->id << '@' << OtherI->start << " to " + << End << '\n'); // A dead def is not a problem. if (End.isDead()) break; @@ -2598,8 +2602,8 @@ bool JoinVals::resolveConflicts(JoinVals &Other) { assert(V.Resolution != CR_Impossible && "Unresolvable conflict"); if (V.Resolution != CR_Unresolved) continue; - DEBUG(dbgs() << "\t\tconflict at " << printReg(Reg) << ':' << i - << '@' << LR.getValNumInfo(i)->def << '\n'); + LLVM_DEBUG(dbgs() << "\t\tconflict at " << printReg(Reg) << ':' << i << '@' + << LR.getValNumInfo(i)->def << '\n'); if (SubRangeJoin) return false; @@ -2636,7 +2640,7 @@ bool JoinVals::resolveConflicts(JoinVals &Other) { while (true) { assert(MI != MBB->end() && "Bad LastMI"); if (usesLanes(*MI, Other.Reg, Other.SubIdx, TaintedLanes)) { - DEBUG(dbgs() << "\t\ttainted lanes used by: " << *MI); + LLVM_DEBUG(dbgs() << "\t\ttainted lanes used by: " << *MI); return false; } // LastMI is the last instruction to use the current value. @@ -2709,8 +2713,8 @@ void JoinVals::pruneValues(JoinVals &Other, if (!EraseImpDef) EndPoints.push_back(Def); } - DEBUG(dbgs() << "\t\tpruned " << printReg(Other.Reg) << " at " << Def - << ": " << Other.LR << '\n'); + LLVM_DEBUG(dbgs() << "\t\tpruned " << printReg(Other.Reg) << " at " << Def + << ": " << Other.LR << '\n'); break; } case CR_Erase: @@ -2721,8 +2725,8 @@ void JoinVals::pruneValues(JoinVals &Other, // computeAssignment(), the value that was originally copied could have // been replaced. LIS->pruneValue(LR, Def, &EndPoints); - DEBUG(dbgs() << "\t\tpruned all of " << printReg(Reg) << " at " - << Def << ": " << LR << '\n'); + LLVM_DEBUG(dbgs() << "\t\tpruned all of " << printReg(Reg) << " at " + << Def << ": " << LR << '\n'); } break; case CR_Unresolved: @@ -2746,7 +2750,8 @@ void JoinVals::pruneSubRegValues(LiveInterval &LI, LaneBitmask &ShrinkMask) { // Check subranges at the point where the copy will be removed. SlotIndex Def = LR.getValNumInfo(i)->def; // Print message so mismatches with eraseInstrs() can be diagnosed. - DEBUG(dbgs() << "\t\tExpecting instruction removal at " << Def << '\n'); + LLVM_DEBUG(dbgs() << "\t\tExpecting instruction removal at " << Def + << '\n'); for (LiveInterval::SubRange &S : LI.subranges()) { LiveQueryResult Q = S.Query(Def); @@ -2754,8 +2759,8 @@ void JoinVals::pruneSubRegValues(LiveInterval &LI, LaneBitmask &ShrinkMask) { // copied and we must remove that subrange value as well. VNInfo *ValueOut = Q.valueOutOrDead(); if (ValueOut != nullptr && Q.valueIn() == nullptr) { - DEBUG(dbgs() << "\t\tPrune sublane " << PrintLaneMask(S.LaneMask) - << " at " << Def << "\n"); + LLVM_DEBUG(dbgs() << "\t\tPrune sublane " << PrintLaneMask(S.LaneMask) + << " at " << Def << "\n"); LIS->pruneValue(S, Def, nullptr); DidPrune = true; // Mark value number as unused. @@ -2765,8 +2770,9 @@ void JoinVals::pruneSubRegValues(LiveInterval &LI, LaneBitmask &ShrinkMask) { // If a subrange ends at the copy, then a value was copied but only // partially used later. Shrink the subregister range appropriately. if (Q.valueIn() != nullptr && Q.valueOut() == nullptr) { - DEBUG(dbgs() << "\t\tDead uses at sublane " << PrintLaneMask(S.LaneMask) - << " at " << Def << "\n"); + LLVM_DEBUG(dbgs() << "\t\tDead uses at sublane " + << PrintLaneMask(S.LaneMask) << " at " << Def + << "\n"); ShrinkMask |= S.LaneMask; } } @@ -2878,7 +2884,7 @@ void JoinVals::eraseInstrs(SmallPtrSetImpl<MachineInstr*> &ErasedInstrs, std::prev(S)->end = NewEnd; } } - DEBUG({ + LLVM_DEBUG({ dbgs() << "\t\tremoved " << i << '@' << Def << ": " << LR << '\n'; if (LI != nullptr) dbgs() << "\t\t LHS = " << *LI << '\n'; @@ -2896,7 +2902,7 @@ void JoinVals::eraseInstrs(SmallPtrSetImpl<MachineInstr*> &ErasedInstrs, ShrinkRegs.push_back(Reg); } ErasedInstrs.insert(MI); - DEBUG(dbgs() << "\t\terased:\t" << Def << '\t' << *MI); + LLVM_DEBUG(dbgs() << "\t\terased:\t" << Def << '\t' << *MI); LIS->RemoveMachineInstrFromMaps(*MI); MI->eraseFromParent(); break; @@ -2951,13 +2957,13 @@ void RegisterCoalescer::joinSubRegRanges(LiveRange &LRange, LiveRange &RRange, LRange.join(RRange, LHSVals.getAssignments(), RHSVals.getAssignments(), NewVNInfo); - DEBUG(dbgs() << "\t\tjoined lanes: " << LRange << "\n"); + LLVM_DEBUG(dbgs() << "\t\tjoined lanes: " << LRange << "\n"); if (EndPoints.empty()) return; // Recompute the parts of the live range we had to remove because of // CR_Replace conflicts. - DEBUG({ + LLVM_DEBUG({ dbgs() << "\t\trestoring liveness to " << EndPoints.size() << " points: "; for (unsigned i = 0, n = EndPoints.size(); i != n; ++i) { dbgs() << EndPoints[i]; @@ -2996,9 +3002,7 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) { JoinVals LHSVals(LHS, CP.getDstReg(), CP.getDstIdx(), LaneBitmask::getNone(), NewVNInfo, CP, LIS, TRI, false, TrackSubRegLiveness); - DEBUG(dbgs() << "\t\tRHS = " << RHS - << "\n\t\tLHS = " << LHS - << '\n'); + LLVM_DEBUG(dbgs() << "\t\tRHS = " << RHS << "\n\t\tLHS = " << LHS << '\n'); // First compute NewVNInfo and the simple value mappings. // Detect impossible conflicts early. @@ -3029,8 +3033,8 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) { R.LaneMask = Mask; } } - DEBUG(dbgs() << "\t\tLHST = " << printReg(CP.getDstReg()) - << ' ' << LHS << '\n'); + LLVM_DEBUG(dbgs() << "\t\tLHST = " << printReg(CP.getDstReg()) << ' ' << LHS + << '\n'); // Determine lanemasks of RHS in the coalesced register and merge subranges. unsigned SrcIdx = CP.getSrcIdx(); @@ -3045,7 +3049,7 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) { mergeSubRangeInto(LHS, R, Mask, CP); } } - DEBUG(dbgs() << "\tJoined SubRanges " << LHS << "\n"); + LLVM_DEBUG(dbgs() << "\tJoined SubRanges " << LHS << "\n"); // Pruning implicit defs from subranges may result in the main range // having stale segments. @@ -3083,7 +3087,7 @@ bool RegisterCoalescer::joinVirtRegs(CoalescerPair &CP) { if (!EndPoints.empty()) { // Recompute the parts of the live range we had to remove because of // CR_Replace conflicts. - DEBUG({ + LLVM_DEBUG({ dbgs() << "\t\trestoring liveness to " << EndPoints.size() << " points: "; for (unsigned i = 0, n = EndPoints.size(); i != n; ++i) { dbgs() << EndPoints[i]; @@ -3231,7 +3235,8 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const { continue; // Check that OtherReg interfere with DstReg. if (LIS->getInterval(OtherReg).overlaps(DstLI)) { - DEBUG(dbgs() << "Apply terminal rule for: " << printReg(DstReg) << '\n'); + LLVM_DEBUG(dbgs() << "Apply terminal rule for: " << printReg(DstReg) + << '\n'); return true; } } @@ -3240,7 +3245,7 @@ bool RegisterCoalescer::applyTerminalRule(const MachineInstr &Copy) const { void RegisterCoalescer::copyCoalesceInMBB(MachineBasicBlock *MBB) { - DEBUG(dbgs() << MBB->getName() << ":\n"); + LLVM_DEBUG(dbgs() << MBB->getName() << ":\n"); // Collect all copy-like instructions in MBB. Don't start coalescing anything // yet, it might invalidate the iterator. @@ -3305,7 +3310,7 @@ void RegisterCoalescer::coalesceLocals() { } void RegisterCoalescer::joinAllIntervals() { - DEBUG(dbgs() << "********** JOINING INTERVALS ***********\n"); + LLVM_DEBUG(dbgs() << "********** JOINING INTERVALS ***********\n"); assert(WorkList.empty() && LocalWorkList.empty() && "Old data still around."); std::vector<MBBPriorityInfo> MBBs; @@ -3361,8 +3366,8 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) { // splitting optimization. JoinSplitEdges = EnableJoinSplits; - DEBUG(dbgs() << "********** SIMPLE REGISTER COALESCING **********\n" - << "********** Function: " << MF->getName() << '\n'); + LLVM_DEBUG(dbgs() << "********** SIMPLE REGISTER COALESCING **********\n" + << "********** Function: " << MF->getName() << '\n'); if (VerifyCoalescing) MF->verify(this, "Before register coalescing"); @@ -3379,14 +3384,15 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) { array_pod_sort(InflateRegs.begin(), InflateRegs.end()); InflateRegs.erase(std::unique(InflateRegs.begin(), InflateRegs.end()), InflateRegs.end()); - DEBUG(dbgs() << "Trying to inflate " << InflateRegs.size() << " regs.\n"); + LLVM_DEBUG(dbgs() << "Trying to inflate " << InflateRegs.size() + << " regs.\n"); for (unsigned i = 0, e = InflateRegs.size(); i != e; ++i) { unsigned Reg = InflateRegs[i]; if (MRI->reg_nodbg_empty(Reg)) continue; if (MRI->recomputeRegClass(Reg)) { - DEBUG(dbgs() << printReg(Reg) << " inflated to " - << TRI->getRegClassName(MRI->getRegClass(Reg)) << '\n'); + LLVM_DEBUG(dbgs() << printReg(Reg) << " inflated to " + << TRI->getRegClassName(MRI->getRegClass(Reg)) << '\n'); ++NumInflated; LiveInterval &LI = LIS->getInterval(Reg); @@ -3409,7 +3415,7 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) { } } - DEBUG(dump()); + LLVM_DEBUG(dump()); if (VerifyCoalescing) MF->verify(this, "After register coalescing"); return true; |