mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 11:33:24 +02:00
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. llvm-svn: 24295
This commit is contained in:
parent
32a3905ffc
commit
e1435b7831
@ -47,11 +47,11 @@ namespace {
|
|||||||
std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;
|
std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;
|
||||||
|
|
||||||
PPCAsmPrinter(std::ostream &O, TargetMachine &TM)
|
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.
|
/// Unique incrementer for label values for referencing Global values.
|
||||||
///
|
///
|
||||||
unsigned LabelNumber;
|
unsigned FunctionNumber;
|
||||||
|
|
||||||
virtual const char *getPassName() const {
|
virtual const char *getPassName() const {
|
||||||
return "PowerPC Assembly Printer";
|
return "PowerPC Assembly Printer";
|
||||||
@ -135,8 +135,8 @@ namespace {
|
|||||||
void printPICLabel(const MachineInstr *MI, unsigned OpNo,
|
void printPICLabel(const MachineInstr *MI, unsigned OpNo,
|
||||||
MVT::ValueType VT) {
|
MVT::ValueType VT) {
|
||||||
// FIXME: should probably be converted to cout.width and cout.fill
|
// FIXME: should probably be converted to cout.width and cout.fill
|
||||||
O << "\"L0000" << LabelNumber << "$pb\"\n";
|
O << "\"L0000" << FunctionNumber << "$pb\"\n";
|
||||||
O << "\"L0000" << LabelNumber << "$pb\":";
|
O << "\"L0000" << FunctionNumber << "$pb\":";
|
||||||
}
|
}
|
||||||
void printSymbolHi(const MachineInstr *MI, unsigned OpNo,
|
void printSymbolHi(const MachineInstr *MI, unsigned OpNo,
|
||||||
MVT::ValueType VT) {
|
MVT::ValueType VT) {
|
||||||
@ -146,7 +146,7 @@ namespace {
|
|||||||
O << "ha16(";
|
O << "ha16(";
|
||||||
printOp(MI->getOperand(OpNo));
|
printOp(MI->getOperand(OpNo));
|
||||||
if (PICEnabled)
|
if (PICEnabled)
|
||||||
O << "-\"L0000" << LabelNumber << "$pb\")";
|
O << "-\"L0000" << FunctionNumber << "$pb\")";
|
||||||
else
|
else
|
||||||
O << ')';
|
O << ')';
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ namespace {
|
|||||||
O << "lo16(";
|
O << "lo16(";
|
||||||
printOp(MI->getOperand(OpNo));
|
printOp(MI->getOperand(OpNo));
|
||||||
if (PICEnabled)
|
if (PICEnabled)
|
||||||
O << "-\"L0000" << LabelNumber << "$pb\")";
|
O << "-\"L0000" << FunctionNumber << "$pb\")";
|
||||||
else
|
else
|
||||||
O << ')';
|
O << ')';
|
||||||
}
|
}
|
||||||
@ -287,14 +287,13 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
|
|||||||
|
|
||||||
case MachineOperand::MO_MachineBasicBlock: {
|
case MachineOperand::MO_MachineBasicBlock: {
|
||||||
MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
|
MachineBasicBlock *MBBOp = MO.getMachineBasicBlock();
|
||||||
O << "LBB" << Mang->getValueName(MBBOp->getParent()->getFunction())
|
O << "LBB" << FunctionNumber << "_" << MBBOp->getNumber() << "\t; "
|
||||||
<< "_" << MBBOp->getNumber() << "\t; "
|
|
||||||
<< MBBOp->getBasicBlock()->getName();
|
<< MBBOp->getBasicBlock()->getName();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MachineOperand::MO_ConstantPoolIndex:
|
case MachineOperand::MO_ConstantPoolIndex:
|
||||||
O << "LCPI" << CurrentFnName << "_" << MO.getConstantPoolIndex();
|
O << "LCPI" << FunctionNumber << '_' << MO.getConstantPoolIndex();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
@ -399,7 +398,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
// Print a label for the basic block.
|
// Print a label for the basic block.
|
||||||
if (I != MF.begin()) {
|
if (I != MF.begin()) {
|
||||||
O << "LBB" << CurrentFnName << "_" << I->getNumber() << ":\t";
|
O << "LBB" << FunctionNumber << '_' << I->getNumber() << ":\t";
|
||||||
if (!I->getBasicBlock()->getName().empty())
|
if (!I->getBasicBlock()->getName().empty())
|
||||||
O << CommentString << " " << I->getBasicBlock()->getName();
|
O << CommentString << " " << I->getBasicBlock()->getName();
|
||||||
O << "\n";
|
O << "\n";
|
||||||
@ -411,7 +410,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
printMachineInstruction(II);
|
printMachineInstruction(II);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++LabelNumber;
|
++FunctionNumber;
|
||||||
|
|
||||||
// We didn't modify anything.
|
// We didn't modify anything.
|
||||||
return false;
|
return false;
|
||||||
@ -436,8 +435,8 @@ void DarwinAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
|
|||||||
emitAlignment(3);
|
emitAlignment(3);
|
||||||
else
|
else
|
||||||
emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
|
emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType()));
|
||||||
O << "LCPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString
|
O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t" << CommentString
|
||||||
<< *CP[i] << "\n";
|
<< *CP[i] << '\n';
|
||||||
emitGlobalConstant(CP[i]);
|
emitGlobalConstant(CP[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -605,8 +604,8 @@ bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
// Print a label for the basic block.
|
// Print a label for the basic block.
|
||||||
O << "LBB" << CurrentFnName << "_" << I->getNumber() << ":\t# "
|
O << "LBB" << CurrentFnName << '_' << I->getNumber() << ":\t# "
|
||||||
<< I->getBasicBlock()->getName() << "\n";
|
<< I->getBasicBlock()->getName() << '\n';
|
||||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||||
II != E; ++II) {
|
II != E; ++II) {
|
||||||
// Print the assembly for the instruction.
|
// Print the assembly for the instruction.
|
||||||
@ -614,7 +613,7 @@ bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
printMachineInstruction(II);
|
printMachineInstruction(II);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++LabelNumber;
|
++FunctionNumber;
|
||||||
|
|
||||||
O << "LT.." << CurrentFnName << ":\n"
|
O << "LT.." << CurrentFnName << ":\n"
|
||||||
<< "\t.long 0\n"
|
<< "\t.long 0\n"
|
||||||
@ -643,8 +642,8 @@ void AIXAsmPrinter::printConstantPool(MachineConstantPool *MCP) {
|
|||||||
O << "\t.const\n";
|
O << "\t.const\n";
|
||||||
O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
|
O << "\t.align " << (unsigned)TD.getTypeAlignment(CP[i]->getType())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
O << "LCPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t;"
|
O << "LCPI" << FunctionNumber << '_' << i << ":\t\t\t\t\t;"
|
||||||
<< *CP[i] << "\n";
|
<< *CP[i] << '\n';
|
||||||
emitGlobalConstant(CP[i]);
|
emitGlobalConstant(CP[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,7 +685,7 @@ bool AIXAsmPrinter::doInitialization(Module &M) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string Name = GV->getName();
|
std::string Name = GV->getName();
|
||||||
std::string Label = "LC.." + utostr(LabelNumber++);
|
std::string Label = "LC.." + utostr(FunctionNumber++);
|
||||||
GVToLabelMap[GV] = Label;
|
GVToLabelMap[GV] = Label;
|
||||||
O << Label << ":\n"
|
O << Label << ":\n"
|
||||||
<< "\t.tc " << Name << "[TC]," << Name;
|
<< "\t.tc " << Name << "[TC]," << Name;
|
||||||
|
Loading…
Reference in New Issue
Block a user