[llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86IntelAsmPrinter.cpp
Nate Begeman
natebegeman at mac.com
Mon May 1 22:37:49 PDT 2006
Changes in directory llvm/lib/Target/X86:
X86ATTAsmPrinter.cpp updated: 1.37 -> 1.38
X86AsmPrinter.cpp updated: 1.173 -> 1.174
X86AsmPrinter.h updated: 1.15 -> 1.16
X86IntelAsmPrinter.cpp updated: 1.35 -> 1.36
---
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: (+20 -14)
X86ATTAsmPrinter.cpp | 8 ++++----
X86AsmPrinter.cpp | 14 +++++++++-----
X86AsmPrinter.h | 4 +++-
X86IntelAsmPrinter.cpp | 8 ++++----
4 files changed, 20 insertions(+), 14 deletions(-)
Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.37 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.38
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.37 Fri Apr 28 18:19:39 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Tue May 2 00:37:32 2006
@@ -80,10 +80,10 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (I->pred_begin() != I->pred_end())
- O << PrivateGlobalPrefix << "BB" << CurrentFnName << "_" << I->getNumber()
- << ":\t" << CommentString << " " << I->getBasicBlock()->getName()
- << "\n";
+ if (I->pred_begin() != I->pred_end()) {
+ printBasicBlockLabel(I, true);
+ O << '\n';
+ }
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.173 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.174
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.173 Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue May 2 00:37:32 2006
@@ -206,12 +206,16 @@
return false; // success
}
-void X86SharedAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB)
- const {
+void X86SharedAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
+ bool printColon,
+ bool printComment) const {
O << PrivateGlobalPrefix << "BB"
- << Mang->getValueName(MBB->getParent()->getFunction())
- << "_" << MBB->getNumber() << '\t' << CommentString
- << MBB->getBasicBlock()->getName();
+ << Mang->getValueName(MBB->getParent()->getFunction()) << "_"
+ << MBB->getNumber();
+ if (printColon)
+ O << ':';
+ if (printComment)
+ O << '\t' << CommentString << MBB->getBasicBlock()->getName();
}
/// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.15 llvm/lib/Target/X86/X86AsmPrinter.h:1.16
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.15 Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Tue May 2 00:37:32 2006
@@ -89,7 +89,9 @@
MI->getOperand(Op+3).isConstantPoolIndex());
}
- virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const;
+ virtual void printBasicBlockLabel(const MachineBasicBlock *MBB,
+ bool printColon = false,
+ bool printComment = true) const;
};
} // end namespace llvm
Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.35 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.36
--- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.35 Mon May 1 22:58:45 2006
+++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Tue May 2 00:37:32 2006
@@ -72,10 +72,10 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block if there are any predecessors.
- if (I->pred_begin() != I->pred_end())
- O << PrivateGlobalPrefix << "BB" << CurrentFnName << "_" << I->getNumber()
- << ":\t"
- << CommentString << " " << I->getBasicBlock()->getName() << "\n";
+ if (I->pred_begin() != I->pred_end()) {
+ printBasicBlockLabel(I, true);
+ O << '\n';
+ }
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
More information about the llvm-commits
mailing list