/// printBasicBlockLabel - This method prints the label for the specified
/// MachineBasicBlock
- virtual void printBasicBlockLabel(const MachineBasicBlock *MBB) const;
+ virtual void printBasicBlockLabel(const MachineBasicBlock *MBB,
+ bool printColon = false,
+ bool printComment = true) const;
private:
void EmitXXStructorList(Constant *List);
/// printBasicBlockLabel - This method prints the label for the specified
/// MachineBasicBlock
-void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB) const {
+void AsmPrinter::printBasicBlockLabel(const MachineBasicBlock *MBB,
+ bool printColon,
+ bool printComment) const {
O << PrivateGlobalPrefix << "LBB"
<< Mang->getValueName(MBB->getParent()->getFunction())
- << "_" << MBB->getNumber() << '\t' << CommentString
- << MBB->getBasicBlock()->getName();
+ << "_" << MBB->getNumber();
+ if (printColon)
+ O << ':';
+ if (printComment)
+ O << '\t' << CommentString << MBB->getBasicBlock()->getName();
}
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
- // Print a label for the basic block.
- O << PrivateGlobalPrefix << "LBB" << CurrentFnName << "_" << I->getNumber()
- << ":\t" << CommentString << " " << I->getBasicBlock()->getName() << "\n";
+ printBasicBlockLabel(I, true);
+ O << '\n';
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
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 << "LBB" << 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.
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;
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()
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) {
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (I != MF.begin())
- O << ".LBB" << Mang->getValueName(MF.getFunction ())
- << "_" << I->getNumber () << ":\t! "
- << I->getBasicBlock ()->getName () << "\n";
+ if (I != MF.begin()) {
+ printBasicBlockLabel(I, true);
+ O << '\n';
+ }
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
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.
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
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
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.