diff options
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCExpandISEL.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCExpandISEL.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCExpandISEL.cpp b/llvm/lib/Target/PowerPC/PPCExpandISEL.cpp index b00e98b63e3..6151bee6133 100644 --- a/llvm/lib/Target/PowerPC/PPCExpandISEL.cpp +++ b/llvm/lib/Target/PowerPC/PPCExpandISEL.cpp @@ -126,11 +126,11 @@ public: #endif bool runOnMachineFunction(MachineFunction &MF) override { - DEBUG(dbgs() << "Function: "; MF.dump(); dbgs() << "\n"); + LLVM_DEBUG(dbgs() << "Function: "; MF.dump(); dbgs() << "\n"); initialize(MF); if (!collectISELInstructions()) { - DEBUG(dbgs() << "No ISEL instructions in this function\n"); + LLVM_DEBUG(dbgs() << "No ISEL instructions in this function\n"); return false; } @@ -170,9 +170,10 @@ bool PPCExpandISEL::collectISELInstructions() { #ifndef NDEBUG void PPCExpandISEL::DumpISELInstructions() const { for (const auto &I : ISELInstructions) { - DEBUG(dbgs() << printMBBReference(*MF->getBlockNumbered(I.first)) << ":\n"); + LLVM_DEBUG(dbgs() << printMBBReference(*MF->getBlockNumbered(I.first)) + << ":\n"); for (const auto &VI : I.second) - DEBUG(dbgs() << " "; VI->print(dbgs())); + LLVM_DEBUG(dbgs() << " "; VI->print(dbgs())); } } #endif @@ -192,9 +193,10 @@ void PPCExpandISEL::expandAndMergeISELs() { bool ExpandISELEnabled = isExpandISELEnabled(*MF); for (auto &BlockList : ISELInstructions) { - DEBUG(dbgs() << "Expanding ISEL instructions in " - << printMBBReference(*MF->getBlockNumbered(BlockList.first)) - << "\n"); + LLVM_DEBUG( + dbgs() << "Expanding ISEL instructions in " + << printMBBReference(*MF->getBlockNumbered(BlockList.first)) + << "\n"); BlockISELList &CurrentISELList = BlockList.second; auto I = CurrentISELList.begin(); auto E = CurrentISELList.end(); @@ -210,7 +212,8 @@ void PPCExpandISEL::expandAndMergeISELs() { // as it would be ISEL %R0, %ZERO, %R0, %CRN. if (useSameRegister(Dest, TrueValue) && useSameRegister(Dest, FalseValue)) { - DEBUG(dbgs() << "Remove redudant ISEL instruction: " << **I << "\n"); + LLVM_DEBUG(dbgs() << "Remove redudant ISEL instruction: " << **I + << "\n"); // FIXME: if the CR field used has no other uses, we could eliminate the // instruction that defines it. This would have to be done manually // since this pass runs too late to run DCE after it. @@ -223,8 +226,9 @@ void PPCExpandISEL::expandAndMergeISELs() { // condition as it would be ISEL %RX, %ZERO, %R0, %CRN, which makes it // safe to fold ISEL to MR(OR) instead of ADDI. MachineBasicBlock *MBB = (*I)->getParent(); - DEBUG(dbgs() << "Fold the ISEL instruction to an unconditonal copy:\n"); - DEBUG(dbgs() << "ISEL: " << **I << "\n"); + LLVM_DEBUG( + dbgs() << "Fold the ISEL instruction to an unconditonal copy:\n"); + LLVM_DEBUG(dbgs() << "ISEL: " << **I << "\n"); NumFolded++; // Note: we're using both the TrueValue and FalseValue operands so as // not to lose the kill flag if it is set on either of them. @@ -235,8 +239,8 @@ void PPCExpandISEL::expandAndMergeISELs() { (*I)->eraseFromParent(); I++; } else if (ExpandISELEnabled) { // Normal cases expansion enabled - DEBUG(dbgs() << "Expand ISEL instructions:\n"); - DEBUG(dbgs() << "ISEL: " << **I << "\n"); + LLVM_DEBUG(dbgs() << "Expand ISEL instructions:\n"); + LLVM_DEBUG(dbgs() << "ISEL: " << **I << "\n"); BlockISELList SubISELList; SubISELList.push_back(*I++); // Collect the ISELs that can be merged together. @@ -244,7 +248,7 @@ void PPCExpandISEL::expandAndMergeISELs() { // may be redundant or foldable to a register copy. So we still keep // the handleSpecialCases() downstream to handle them. while (I != E && canMerge(SubISELList.back(), *I)) { - DEBUG(dbgs() << "ISEL: " << **I << "\n"); + LLVM_DEBUG(dbgs() << "ISEL: " << **I << "\n"); SubISELList.push_back(*I++); } @@ -264,7 +268,7 @@ void PPCExpandISEL::handleSpecialCases(BlockISELList &BIL, auto MI = BIL.begin(); while (MI != BIL.end()) { assert(isISEL(**MI) && "Expecting an ISEL instruction"); - DEBUG(dbgs() << "ISEL: " << **MI << "\n"); + LLVM_DEBUG(dbgs() << "ISEL: " << **MI << "\n"); MachineOperand &Dest = (*MI)->getOperand(0); MachineOperand &TrueValue = (*MI)->getOperand(1); @@ -281,7 +285,7 @@ void PPCExpandISEL::handleSpecialCases(BlockISELList &BIL, // Special case 1, all registers used by ISEL are the same one. if (!IsADDIInstRequired && !IsORIInstRequired) { - DEBUG(dbgs() << "Remove redudant ISEL instruction."); + LLVM_DEBUG(dbgs() << "Remove redudant ISEL instruction."); // FIXME: if the CR field used has no other uses, we could eliminate the // instruction that defines it. This would have to be done manually // since this pass runs too late to run DCE after it. @@ -300,7 +304,8 @@ void PPCExpandISEL::handleSpecialCases(BlockISELList &BIL, // be zero. In this case, the useSameRegister method will return false, // thereby preventing this ISEL from being folded. if (useSameRegister(TrueValue, FalseValue) && (BIL.size() == 1)) { - DEBUG(dbgs() << "Fold the ISEL instruction to an unconditonal copy."); + LLVM_DEBUG( + dbgs() << "Fold the ISEL instruction to an unconditonal copy."); NumFolded++; // Note: we're using both the TrueValue and FalseValue operands so as // not to lose the kill flag if it is set on either of them. @@ -439,11 +444,10 @@ void PPCExpandISEL::populateBlocks(BlockISELList &BIL) { // condition is false MachineOperand &ConditionRegister = MI->getOperand(3); // Condition - DEBUG(dbgs() << "Dest: " << Dest << "\n"); - DEBUG(dbgs() << "TrueValue: " << TrueValue << "\n"); - DEBUG(dbgs() << "FalseValue: " << FalseValue << "\n"); - DEBUG(dbgs() << "ConditionRegister: " << ConditionRegister << "\n"); - + LLVM_DEBUG(dbgs() << "Dest: " << Dest << "\n"); + LLVM_DEBUG(dbgs() << "TrueValue: " << TrueValue << "\n"); + LLVM_DEBUG(dbgs() << "FalseValue: " << FalseValue << "\n"); + LLVM_DEBUG(dbgs() << "ConditionRegister: " << ConditionRegister << "\n"); // If the Dest Register and True Value Register are not the same one, we // need the True Block. |