mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-24 15:12:36 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28050 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5425267e84
commit
cdf38c4edb
@ -276,7 +276,9 @@ namespace llvm {
|
|||||||
|
|
||||||
/// printBasicBlockLabel - This method prints the label for the specified
|
/// printBasicBlockLabel - This method prints the label for the specified
|
||||||
/// MachineBasicBlock
|
/// MachineBasicBlock
|
||||||
virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const;
|
virtual void printBasicBlockLabel(const MachineBasicBlock *MBB,
|
||||||
|
bool printColon = false,
|
||||||
|
bool printComment = true) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void EmitXXStructorList(Constant *List);
|
void EmitXXStructorList(Constant *List);
|
||||||
|
@ -728,9 +728,14 @@ bool AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
|||||||
|
|
||||||
/// printBasicBlockLabel - This method prints the label for the specified
|
/// printBasicBlockLabel - This method prints the label for the specified
|
||||||
/// MachineBasicBlock
|
/// MachineBasicBlock
|
||||||
void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const {
|
void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
|
||||||
|
bool printColon,
|
||||||
|
bool printComment) const {
|
||||||
O << PrivateGlobalPrefix << "LBB"
|
O << PrivateGlobalPrefix << "LBB"
|
||||||
<< Mang->getValueName(MBB->getParent()->getFunction())
|
<< Mang->getValueName(MBB->getParent()->getFunction())
|
||||||
<< "_" << MBB->getNumber() << '\t' << CommentString
|
<< "_" << MBB->getNumber();
|
||||||
<< MBB->getBasicBlock()->getName();
|
if (printColon)
|
||||||
|
O << ':';
|
||||||
|
if (printComment)
|
||||||
|
O << '\t' << CommentString << MBB->getBasicBlock()->getName();
|
||||||
}
|
}
|
||||||
|
@ -191,9 +191,8 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
// Print out code for the function.
|
// Print out code for the function.
|
||||||
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.
|
printBasicBlockLabel(I, true);
|
||||||
O << PrivateGlobalPrefix << "LBB" << CurrentFnName << "_" << I->getNumber()
|
O << '\n';
|
||||||
<< ":\t" << CommentString << " " << 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.
|
||||||
|
@ -153,10 +153,10 @@ bool IA64AsmPrinter::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 if there are any predecessors.
|
// Print a label for the basic block if there are any predecessors.
|
||||||
if (I->pred_begin() != I->pred_end())
|
if (I->pred_begin() != I->pred_end()) {
|
||||||
O << PrivateGlobalPrefix << "LBB" << CurrentFnName << "_"
|
printBasicBlockLabel(I, true);
|
||||||
<< I->getNumber() << ":\t"
|
O << '\n';
|
||||||
<< CommentString << " " << 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.
|
||||||
|
@ -233,7 +233,9 @@ namespace {
|
|||||||
printOperand(MI, OpNo+1);
|
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 runOnMachineFunction(MachineFunction &F) = 0;
|
||||||
virtual bool doFinalization(Module &M) = 0;
|
virtual bool doFinalization(Module &M) = 0;
|
||||||
@ -505,10 +507,15 @@ void PPCAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const {
|
void PPCAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
|
||||||
|
bool printColon,
|
||||||
|
bool printComment) const {
|
||||||
O << PrivateGlobalPrefix << "BB" << getFunctionNumber() << "_"
|
O << PrivateGlobalPrefix << "BB" << getFunctionNumber() << "_"
|
||||||
<< MBB->getNumber() << '\t' << CommentString
|
<< MBB->getNumber();
|
||||||
<< MBB->getBasicBlock()->getName();
|
if (printColon)
|
||||||
|
O << ':';
|
||||||
|
if (printComment)
|
||||||
|
O << '\t' << CommentString << MBB->getBasicBlock()->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runOnMachineFunction - This uses the printMachineInstruction()
|
/// runOnMachineFunction - This uses the printMachineInstruction()
|
||||||
@ -557,11 +564,8 @@ 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 << PrivateGlobalPrefix << "BB" << getFunctionNumber() << '_'
|
printBasicBlockLabel(I, true);
|
||||||
<< I->getNumber() << ":\t";
|
O << '\n';
|
||||||
if (!I->getBasicBlock()->getName().empty())
|
|
||||||
O << CommentString << " " << I->getBasicBlock()->getName();
|
|
||||||
O << "\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) {
|
||||||
|
@ -116,10 +116,10 @@ bool SparcAsmPrinter::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.
|
||||||
if (I != MF.begin())
|
if (I != MF.begin()) {
|
||||||
O << ".LBB" << Mang->getValueName(MF.getFunction ())
|
printBasicBlockLabel(I, true);
|
||||||
<< "_" << I->getNumber () << ":\t! "
|
O << '\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.
|
||||||
|
@ -80,10 +80,10 @@ bool X86ATTAsmPrinter::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.
|
||||||
if (I->pred_begin() != I->pred_end())
|
if (I->pred_begin() != I->pred_end()) {
|
||||||
O << PrivateGlobalPrefix << "BB" << CurrentFnName << "_" << I->getNumber()
|
printBasicBlockLabel(I, true);
|
||||||
<< ":\t" << CommentString << " " << I->getBasicBlock()->getName()
|
O << '\n';
|
||||||
<< "\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.
|
||||||
|
@ -206,12 +206,16 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
|||||||
return false; // success
|
return false; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86SharedAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB)
|
void X86SharedAsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
|
||||||
const {
|
bool printColon,
|
||||||
|
bool printComment) const {
|
||||||
O << PrivateGlobalPrefix << "BB"
|
O << PrivateGlobalPrefix << "BB"
|
||||||
<< Mang->getValueName(MBB->getParent()->getFunction())
|
<< Mang->getValueName(MBB->getParent()->getFunction()) << "_"
|
||||||
<< "_" << MBB->getNumber() << '\t' << CommentString
|
<< MBB->getNumber();
|
||||||
<< MBB->getBasicBlock()->getName();
|
if (printColon)
|
||||||
|
O << ':';
|
||||||
|
if (printComment)
|
||||||
|
O << '\t' << CommentString << MBB->getBasicBlock()->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
|
/// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
|
||||||
|
@ -89,7 +89,9 @@ struct X86SharedAsmPrinter : public AsmPrinter {
|
|||||||
MI->getOperand(Op+3).isConstantPoolIndex());
|
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
|
} // end namespace llvm
|
||||||
|
@ -72,10 +72,10 @@ bool X86IntelAsmPrinter::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 if there are any predecessors.
|
// Print a label for the basic block if there are any predecessors.
|
||||||
if (I->pred_begin() != I->pred_end())
|
if (I->pred_begin() != I->pred_end()) {
|
||||||
O << PrivateGlobalPrefix << "BB" << CurrentFnName << "_" << I->getNumber()
|
printBasicBlockLabel(I, true);
|
||||||
<< ":\t"
|
O << '\n';
|
||||||
<< CommentString << " " << 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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user