[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Nov 10 13:59:36 PST 2005
Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.105 -> 1.106
---
Log message:
Make BB and CPI labels use the function number, not the function name as a
uniquing id. This makes things happy when the function name is quoted,
preventing labels like LBB"foo"_2.
---
Diffs of the changes: (+18 -19)
PPCAsmPrinter.cpp | 37 ++++++++++++++++++-------------------
1 files changed, 18 insertions(+), 19 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.105 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.106
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.105 Thu Nov 10 13:33:43 2005
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Nov 10 15:59:25 2005
@@ -47,11 +47,11 @@
std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;
PPCAsmPrinter(std::ostream &O, TargetMachine &TM)
- : AsmPrinter(O, TM), LabelNumber(0) {}
+ : AsmPrinter(O, TM), FunctionNumber(0) {}
/// Unique incrementer for label values for referencing Global values.
///
- unsigned LabelNumber;
+ unsigned FunctionNumber;
virtual const char *getPassName() const {
return "PowerPC Assembly Printer";
@@ -135,8 +135,8 @@
void printPICLabel(const MachineInstr *MI, unsigned OpNo,
MVT::ValueType VT) {
// FIXME: should probably be converted to cout.width and cout.fill
- O << "\"L0000" << LabelNumber << "$pb\"\n";
- O << "\"L0000" << LabelNumber << "$pb\":";
+ O << "\"L0000" << FunctionNumber << "$pb\"\n";
+ O << "\"L0000" << FunctionNumber << "$pb\":";
}
void printSymbolHi(const MachineInstr *MI, unsigned OpNo,
MVT::ValueType VT) {
@@ -146,7 +146,7 @@
O << "ha16(";
printOp(MI->getOperand(OpNo));
if (PICEnabled)
- O << "-\"L0000" << LabelNumber << "$pb\")";
+ O << "-\"L0000" << FunctionNumber << "$pb\")";
else
O << ')';
}
@@ -159,7 +159,7 @@
O << "lo16(";
printOp(MI->getOperand(OpNo));
if (PICEnabled)
- O << "-\"L0000" << LabelNumber << "$pb\")";
+ O << "-\"L0000" << FunctionNumber << "$pb\")";
else
O << ')';
}
@@ -287,14 +287,13 @@
case MachineOperand::MO_MachineBasicBlock: {
MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
- O << "LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
- << "_" << MBBOp->getNumber() << "\t; "
+ O << "LBB" << FunctionNumber << "_" << MBBOp->getNumber() << "\t; "
<< MBBOp->getBasicBlock()->getName();
return;
}
case MachineOperand::MO_ConstantPoolIndex:
- O << "LCPI" << CurrentFnName << "_" << MO.getConstantPoolIndex();
+ O << "LCPI" << FunctionNumber << '_' << MO.getConstantPoolIndex();
return;
case MachineOperand::MO_ExternalSymbol:
@@ -399,7 +398,7 @@
I != E; ++I) {
// Print a label for the basic block.
if (I != MF.begin()) {
- O << "LBB" << CurrentFnName << "_" << I->getNumber() << ":\t";
+ O << "LBB" << FunctionNumber << '_' << I->getNumber() << ":\t";
if (!I->getBasicBlock()->getName().empty())
O << CommentString << " " << I->getBasicBlock()->getName();
O << "\n";
@@ -411,7 +410,7 @@
printMachineInstruction(II);
}
}
- ++LabelNumber;
+ ++FunctionNumber;
// We didn't modify anything.
return false;
@@ -436,8 +435,8 @@
emitAlignment(3);
else
emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
- O << "LCPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString
- << *CP[i] << "\n";
+ O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t" << CommentString
+ << *CP[i] << '\n';
emitGlobalConstant(CP[i]);
}
}
@@ -605,8 +604,8 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- O << "LBB" << CurrentFnName << "_" << I->getNumber() << ":\t# "
- << I->getBasicBlock()->getName() << "\n";
+ O << "LBB" << CurrentFnName << '_' << I->getNumber() << ":\t# "
+ << I->getBasicBlock()->getName() << '\n';
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
@@ -614,7 +613,7 @@
printMachineInstruction(II);
}
}
- ++LabelNumber;
+ ++FunctionNumber;
O << "LT.." << CurrentFnName << ":\n"
<< "\t.long 0\n"
@@ -643,8 +642,8 @@
O << "\t.const\n";
O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
<< "\n";
- O << "LCPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t;"
- << *CP[i] << "\n";
+ O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t;"
+ << *CP[i] << '\n';
emitGlobalConstant(CP[i]);
}
}
@@ -686,7 +685,7 @@
continue;
std::string Name = GV->getName();
- std::string Label = "LC.." + utostr(LabelNumber++);
+ std::string Label = "LC.." + utostr(FunctionNumber++);
GVToLabelMap[GV] = Label;
O << Label << ":\n"
<< "\t.tc " << Name << "[TC]," << Name;
More information about the llvm-commits
mailing list