[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Nate Begeman natebegeman at mac.com
Mon May 1 22:37:49 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.164 -> 1.165
---
Log message:

Extend printBasicBlockLabel a bit so that it can be used to print all 
basic block labels, consolidating the code to do so in one place for each
target.


---
Diffs of the changes:  (+13 -9)

 PPCAsmPrinter.cpp |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.164 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.165
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.164	Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Tue May  2 00:37:32 2006
@@ -233,7 +233,9 @@
       printOperand(MI, OpNo+1);
     }
     
-    virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const; 
+    virtual void printBasicBlockLabel(const MachineBasicBlock *MBB,
+                                      bool printColon = false,
+                                      bool printComment = true) const;
     
     virtual bool runOnMachineFunction(MachineFunction &F) = 0;
     virtual bool doFinalization(Module &M) = 0;
@@ -505,10 +507,15 @@
   return;
 }
 
-void PPCAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const {
+void PPCAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
+                                         bool printColon,
+                                         bool printComment) const {
   O << PrivateGlobalPrefix << "BB" << getFunctionNumber() << "_"
-    << MBB->getNumber() << '\t' << CommentString
-    << MBB->getBasicBlock()->getName();
+    << MBB->getNumber();
+  if (printColon)
+    O << ':';
+  if (printComment)
+    O << '\t' << CommentString << MBB->getBasicBlock()->getName();
 }
 
 /// runOnMachineFunction - This uses the printMachineInstruction()
@@ -557,11 +564,8 @@
        I != E; ++I) {
     // Print a label for the basic block.
     if (I != MF.begin()) {
-      O << PrivateGlobalPrefix << "BB" << getFunctionNumber() << '_'
-        << I->getNumber() << ":\t";
-      if (!I->getBasicBlock()->getName().empty())
-        O << CommentString << " " << I->getBasicBlock()->getName();
-      O << "\n";
+      printBasicBlockLabel(I, true);
+      O << '\n';
     }
     for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
          II != E; ++II) {






More information about the llvm-commits mailing list