aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-17 21:43:43 +0000
committerChris Lattner <sabre@nondot.org>2010-01-17 21:43:43 +0000
commit10b318bcb39218d2ed525e4862c854bc8d1baf63 (patch)
tree414ec32f01b35456c581d19ab8214974df2d211c /lib/Target
parent6edec7b34a7f16e0af7fa5947b69805238d6fe6c (diff)
downloadexternal_llvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.tar.gz
external_llvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.tar.bz2
external_llvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.zip
now that MCSymbol::print doesn't use it's MAI argument, we can
remove it and change all the code that prints MCSymbols to use << instead, which is much simpler and cleaner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp152
-rw-r--r--lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp46
-rw-r--r--lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp42
-rw-r--r--lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp69
-rw-r--r--lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp61
-rw-r--r--lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp67
-rw-r--r--lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp26
-rw-r--r--lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp226
-rw-r--r--lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp52
-rw-r--r--lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp67
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp182
-rw-r--r--lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp80
12 files changed, 315 insertions, 755 deletions
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 300d2eda93..5f99a3aaf8 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -187,11 +187,11 @@ namespace {
bool isIndirect = Subtarget->isTargetDarwin() &&
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
if (!isIndirect)
- GetGlobalValueSymbol(GV)->print(O, MAI);
+ O << *GetGlobalValueSymbol(GV);
else {
// FIXME: Remove this when Darwin transition to @GOT like syntax.
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
- Sym->print(O, MAI);
+ O << *Sym;
MachineModuleInfoMachO &MMIMachO =
MMI->getObjFileInfo<MachineModuleInfoMachO>();
@@ -203,7 +203,7 @@ namespace {
}
} else {
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
- GetExternalSymbolSymbol(ACPV->getSymbol())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(ACPV->getSymbol());
}
if (ACPV->hasModifier()) O << "(" << ACPV->getModifier() << ")";
@@ -256,9 +256,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::InternalLinkage:
break;
case Function::ExternalLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.globl\t" << *CurrentFnSym << "\n";
break;
case Function::LinkerPrivateLinkage:
case Function::WeakAnyLinkage:
@@ -266,16 +264,10 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << "\n";
- O << "\t.weak_definition\t";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.globl\t" << *CurrentFnSym << "\n";
+ O << "\t.weak_definition\t" << *CurrentFnSym << "\n";
} else {
- O << MAI->getWeakRefDirective();
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << MAI->getWeakRefDirective() << *CurrentFnSym << "\n";
}
break;
}
@@ -287,17 +279,14 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
EmitAlignment(FnAlign, F, AFI->getAlign());
O << "\t.code\t16\n";
O << "\t.thumb_func";
- if (Subtarget->isTargetDarwin()) {
- O << "\t";
- CurrentFnSym->print(O, MAI);
- }
+ if (Subtarget->isTargetDarwin())
+ O << "\t" << *CurrentFnSym;
O << "\n";
} else {
EmitAlignment(FnAlign, F);
}
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
// Emit pre-function debug information.
DW->BeginFunction(&MF);
@@ -324,13 +313,8 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
printMachineInstruction(II);
}
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size ";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << "\n";
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
// Emit post-function debug information.
DW->EndFunction(&MF);
@@ -379,7 +363,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
break;
}
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress: {
bool isCallOp = Modifier && !strcmp(Modifier, "call");
@@ -391,7 +375,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
else if ((Modifier && strcmp(Modifier, "hi16") == 0) ||
(TF & ARMII::MO_HI16))
O << ":upper16:";
- GetGlobalValueSymbol(GV)->print(O, MAI);
+ O << *GetGlobalValueSymbol(GV);
printOffset(MO.getOffset());
@@ -402,7 +386,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
}
case MachineOperand::MO_ExternalSymbol: {
bool isCallOp = Modifier && !strcmp(Modifier, "call");
- GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(MO.getSymbolName());
if (isCallOp && Subtarget->isTargetELF() &&
TM.getRelocationModel() == Reloc::PIC_)
@@ -949,11 +933,11 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
<< '_' << JTI << '_' << MO2.getImm()
<< "_set_" << MBB->getNumber();
else if (TM.getRelocationModel() == Reloc::PIC_) {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
- O << '-' << MAI->getPrivateGlobalPrefix() << "JTI"
+ O << *GetMBBSymbol(MBB->getNumber())
+ << '-' << MAI->getPrivateGlobalPrefix() << "JTI"
<< getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
} else {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MBB->getNumber());
}
if (i != e-1)
O << '\n';
@@ -984,13 +968,11 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) {
else if (HalfWordOffset)
O << MAI->getData16bitsDirective();
if (ByteOffset || HalfWordOffset) {
- O << '(';
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << '(' << GetMBBSymbol(MBB->getNumber());
O << "-" << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << JTI << '_' << MO2.getImm() << ")/2";
} else {
- O << "\tb.w ";
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << "\tb.w " << *GetMBBSymbol(MBB->getNumber());
}
if (i != e-1)
O << '\n';
@@ -1211,11 +1193,8 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
printVisibility(GVarSym, GVar->getVisibility());
- if (Subtarget->isTargetELF()) {
- O << "\t.type ";
- GVarSym->print(O, MAI);
- O << ",%object\n";
- }
+ if (Subtarget->isTargetELF())
+ O << "\t.type " << *GVarSym << ",%object\n";
const MCSection *TheSection =
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
@@ -1227,12 +1206,9 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
!TheSection->getKind().isMergeableCString()) {
if (GVar->hasExternalLinkage()) {
if (const char *Directive = MAI->getZeroFillDirective()) {
- O << "\t.globl\t";
- GVarSym->print(O, MAI);
- O << "\n";
- O << Directive << "__DATA, __common, ";
- GVarSym->print(O, MAI);
- O << ", " << Size << ", " << Align << "\n";
+ O << "\t.globl\t" << *GVarSym << "\n";
+ O << Directive << "__DATA, __common, " << *GVarSym
+ << ", " << Size << ", " << Align << "\n";
return;
}
}
@@ -1242,23 +1218,17 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (isDarwin) {
if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size << ',' << Align;
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size
+ << ',' << Align;
} else if (GVar->hasCommonLinkage()) {
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size << ',' << Align;
+ O << MAI->getCOMMDirective() << *GVarSym << ',' << Size
+ << ',' << Align;
} else {
OutStreamer.SwitchSection(TheSection);
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n' << MAI->getWeakDefDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
+ O << *GVarSym << '\n';
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
@@ -1270,25 +1240,16 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
}
} else if (MAI->getLCOMMDirective() != NULL) {
if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVarSym->print(O, MAI);
- O << "," << Size;
+ O << MAI->getLCOMMDirective() << *GVarSym << "," << Size;
} else {
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << "," << Size;
+ O << MAI->getCOMMDirective() << *GVarSym << "," << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
} else {
- if (GVar->hasLocalLinkage()) {
- O << "\t.local\t";
- GVarSym->print(O, MAI);
- O << '\n';
- }
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << "," << Size;
+ if (GVar->hasLocalLinkage())
+ O << "\t.local\t" << *GVarSym << '\n';
+ O << MAI->getCOMMDirective() << *GVarSym << "," << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << "," << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
@@ -1310,24 +1271,17 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkerPrivateLinkage:
if (isDarwin) {
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << "\n\t.weak_definition ";
- GVarSym->print(O, MAI);
- O << "\n";
+ O << "\t.globl " << *GVarSym
+ << "\n\t.weak_definition " << *GVarSym << "\n";
} else {
- O << "\t.weak ";
- GVarSym->print(O, MAI);
- O << "\n";
+ O << "\t.weak " << *GVarSym << "\n";
}
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << "\n";
+ O << "\t.globl " << *GVarSym << "\n";
break;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
@@ -1337,19 +1291,15 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
}
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
}
O << "\n";
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size ";
- GVarSym->print(O, MAI);
- O << ", " << Size << "\n";
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size " << *GVarSym << ", " << Size << "\n";
EmitGlobalConstant(C);
O << '\n';
@@ -1374,10 +1324,8 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
EmitAlignment(2);
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- Stubs[i].first->print(O, MAI);
- O << ":\n\t.indirect_symbol ";
- Stubs[i].second->print(O, MAI);
- O << "\n\t.long\t0\n";
+ O << *Stubs[i].first << ":\n\t.indirect_symbol ";
+ O << *Stubs[i].second << "\n\t.long\t0\n";
}
}
@@ -1385,12 +1333,8 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
if (!Stubs.empty()) {
OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(2);
- for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- Stubs[i].first->print(O, MAI);
- O << ":\n\t.long ";
- Stubs[i].second->print(O, MAI);
- O << "\n";
- }
+ for (unsigned i = 0, e = Stubs.size(); i != e; ++i)
+ O << *Stubs[i].first << ":\n\t.long " << *Stubs[i].second << "\n";
}
// Funny Darwin hack: This flag tells the linker that no global symbols
diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
index e280a457b7..48078006ac 100644
--- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
+++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
@@ -94,7 +94,7 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_ConstantPoolIndex:
@@ -107,7 +107,7 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
return;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
return;
case MachineOperand::MO_JumpTableIndex:
@@ -148,35 +148,28 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::LinkerPrivateLinkage:
break;
case Function::ExternalLinkage:
- O << "\t.globl ";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.globl " << *CurrentFnSym << '\n';
break;
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
- O << MAI->getWeakRefDirective();
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << MAI->getWeakRefDirective() << *CurrentFnSym << '\n';
break;
}
printVisibility(CurrentFnSym, F->getVisibility());
- O << "\t.ent ";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.ent " << *CurrentFnSym << "\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
- if (I != MF.begin()) {
+ if (I != MF.begin())
EmitBasicBlockStart(I);
- }
+
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
// Print the assembly for the instruction.
@@ -191,9 +184,7 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
- O << "\t.end ";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.end " << *CurrentFnSym << "\n";
// We didn't modify anything.
return false;
@@ -235,15 +226,11 @@ void AlphaAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonLinkage:
- O << MAI->getWeakRefDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << MAI->getWeakRefDirective() << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
case GlobalValue::ExternalLinkage:
- O << MAI->getGlobalDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << MAI->getGlobalDirective() << *GVarSym << '\n';
break;
case GlobalValue::InternalLinkage:
case GlobalValue::PrivateLinkage:
@@ -255,18 +242,13 @@ void AlphaAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
// 3: Type, Size, Align
if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.type\t";
- GVarSym->print(O, MAI);
- O << ", @object\n";
- O << "\t.size\t";
- GVarSym->print(O, MAI);
- O << ", " << Size << "\n";
+ O << "\t.type\t" << *GVarSym << ", @object\n";
+ O << "\t.size\t" << *GVarSym << ", " << Size << "\n";
}
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":\n";
+ O << *GVarSym << ":\n";
EmitGlobalConstant(C);
O << '\n';
diff --git a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
index 7fdf1e713c..8afa65025b 100644
--- a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
+++ b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
@@ -79,20 +79,14 @@ void BlackfinAsmPrinter::emitLinkage(const MCSymbol *GVSym,
case GlobalValue::LinkerPrivateLinkage:
break;
case GlobalValue::ExternalLinkage:
- O << MAI->getGlobalDirective();
- GVSym->print(O, MAI);
- O << "\n";
+ O << MAI->getGlobalDirective() << *GVSym << "\n";
break;
case GlobalValue::LinkOnceAnyLinkage:
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
- O << MAI->getGlobalDirective();
- GVSym->print(O, MAI);
- O << "\n";
- O << MAI->getWeakDefDirective();
- GVSym->print(O, MAI);
- O << "\n";
+ O << MAI->getGlobalDirective() << *GVSym << "\n";
+ O << MAI->getWeakDefDirective() << *GVSym << "\n";
break;
}
}
@@ -112,15 +106,10 @@ void BlackfinAsmPrinter::PrintGlobalVariable(const GlobalVariable* GV) {
EmitAlignment(TD->getPreferredAlignmentLog(GV), GV);
printVisibility(GVSym, GV->getVisibility());
- O << "\t.type ";
- GVSym->print(O, MAI);
- O << ", STT_OBJECT\n";
- O << "\t.size ";
- GVSym->print(O, MAI);
- O << "\n";
+ O << "\t.type " << *GVSym << ", STT_OBJECT\n";
+ O << "\t.size " << *GVSym << "\n";
O << ',' << TD->getTypeAllocSize(C->getType()) << '\n';
- GVSym->print(O, MAI);
- O << ":\n";
+ O << *GVSym << ":\n";
EmitGlobalConstant(C);
}
@@ -138,11 +127,8 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
emitLinkage(CurrentFnSym, F->getLinkage());
printVisibility(CurrentFnSym, F->getVisibility());
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ", STT_FUNC\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << "\t.type\t" << *CurrentFnSym << ", STT_FUNC\n";
+ O << *CurrentFnSym << ":\n";
if (DW)
DW->BeginFunction(&MF);
@@ -168,11 +154,7 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
- O << "\t.size ";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
if (DW)
DW->EndFunction(&MF);
@@ -193,14 +175,14 @@ void BlackfinAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
O << MO.getImm();
break;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
printOffset(MO.getOffset());
break;
case MachineOperand::MO_ExternalSymbol:
- GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(MO.getSymbolName());
break;
case MachineOperand::MO_ConstantPoolIndex:
O << MAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
index 6e3b54ea0e..b8ee8c0323 100644
--- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
+++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
@@ -315,7 +315,7 @@ void SPUAsmPrinter::printOp(const MachineOperand &MO) {
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_JumpTableIndex:
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -332,7 +332,7 @@ void SPUAsmPrinter::printOp(const MachineOperand &MO) {
<< "$non_lazy_ptr";
return;
}
- GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(MO.getSymbolName());
return;
case MachineOperand::MO_GlobalAddress:
// External or weakly linked global variables need non-lazily-resolved
@@ -341,11 +341,11 @@ void SPUAsmPrinter::printOp(const MachineOperand &MO) {
GlobalValue *GV = MO.getGlobal();
if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
GV->hasLinkOnceLinkage() || GV->hasCommonLinkage()))) {
- GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr")->print(O, MAI);
+ O << *GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
return;
}
}
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
return;
default:
O << "<unknown operand type: " << MO.getType() << ">";
@@ -427,27 +427,19 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::InternalLinkage: // Symbols default to internal.
break;
case Function::ExternalLinkage:
- O << "\t.global\t";
- CurrentFnSym->print(O, MAI);
- O << "\n" << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ", @function\n";
+ O << "\t.global\t" << *CurrentFnSym << "\n" << "\t.type\t";
+ O << *CurrentFnSym << ", @function\n";
break;
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
- O << "\t.global\t";
- CurrentFnSym->print(O, MAI);
- O << "\n";
- O << "\t.weak_definition\t";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.global\t" << *CurrentFnSym << "\n";
+ O << "\t.weak_definition\t" << *CurrentFnSym << "\n";
break;
}
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
// Emit pre-function debug information.
DW->BeginFunction(&MF);
@@ -466,11 +458,7 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ",.-";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.size\t" << *CurrentFnSym << ",.-" << *CurrentFnSym << "\n";
// Print out jump tables referenced by the function.
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
@@ -518,23 +506,14 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << '\n';
- O << "\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n";
- GVarSym->print(O, MAI);
- O << ":\n";
+ O << "\t.global " << *GVarSym << '\n';
+ O << "\t.type " << *GVarSym << ", @object\n";
+ O << *GVarSym << ":\n";
O << "\t.zero " << Size << '\n';
} else if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
} else {
- O << ".comm ";
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << ".comm " << *GVarSym << ',' << Size;
}
O << "\t\t" << MAI->getCommentString() << " '";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -549,24 +528,15 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonLinkage:
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << "\n\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n" << "\t.weak ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.global " << *GVarSym << "\n\t.type " << *GVarSym << ", @object\n";
+ O << "\t.weak " << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << "\n\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n";
+ O << "\t.global " << *GVarSym << "\n\t.type " << *GVarSym << ", @object\n";
break;
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
@@ -577,8 +547,7 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
}
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":\t\t\t\t" << MAI->getCommentString() << " '";
+ O << *GVarSym << ":\t\t\t\t" << MAI->getCommentString() << " '";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
O << "'\n";
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
index c9a3520de8..19b8867852 100644
--- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
+++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
@@ -106,9 +106,7 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
printVisibility(GVarSym, GVar->getVisibility());
- O << "\t.type\t";
- GVarSym->print(O, MAI);
- O << ",@object\n";
+ O << "\t.type\t" << *GVarSym << ",@object\n";
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
TM));
@@ -119,15 +117,10 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (GVar->hasLocalLinkage()) {
- O << "\t.local\t";
- GVarSym->print(O, MAI);
- O << '\n';
- }
+ if (GVar->hasLocalLinkage())
+ O << "\t.local\t" << *GVarSym << '\n';
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
@@ -146,9 +139,7 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
- O << "\t.weak\t";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *GVarSym << '\n';
break;
case GlobalValue::DLLExportLinkage:
case GlobalValue::AppendingLinkage:
@@ -156,9 +147,7 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << '\n';
// FALL THROUGH
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
@@ -170,8 +159,7 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// Use 16-bit alignment by default to simplify bunch of stuff
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
@@ -181,11 +169,8 @@ void MSP430AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
EmitGlobalConstant(C);
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- GVarSym->print(O, MAI);
- O << ", " << Size << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *GVarSym << ", " << Size << '\n';
}
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
@@ -203,27 +188,20 @@ void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::LinkerPrivateLinkage:
break;
case Function::ExternalLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
break;
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
- O << "\t.weak\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *CurrentFnSym << '\n';
break;
}
printVisibility(CurrentFnSym, F->getVisibility());
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ",@function\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << "\t.type\t" << *CurrentFnSym << ",@function\n";
+ O << *CurrentFnSym << ":\n";
}
bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
@@ -245,13 +223,8 @@ bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
printMachineInstruction(II);
}
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
// We didn't modify anything
return false;
@@ -284,7 +257,7 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
O << MO.getImm();
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress: {
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
@@ -294,7 +267,7 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
if (Offset)
O << '(' << Offset << '+';
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
if (Offset)
O << ')';
diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
index a7baf14440..c254932e96 100644
--- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
+++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
@@ -217,23 +217,15 @@ void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
// 2 bits aligned
EmitAlignment(MF.getAlignment(), F);
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- O << "\t.ent\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
+ O << "\t.ent\t" << *CurrentFnSym << '\n';
printVisibility(CurrentFnSym, F->getVisibility());
- if ((MAI->hasDotTypeDotSizeDirective()) && Subtarget->isLinux()) {
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ", @function\n";
- }
+ if ((MAI->hasDotTypeDotSizeDirective()) && Subtarget->isLinux())
+ O << "\t.type\t" << *CurrentFnSym << ", @function\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
emitFrameDirective(MF);
printSavedRegsBitmask(MF);
@@ -249,16 +241,9 @@ void MipsAsmPrinter::emitFunctionEnd(MachineFunction &MF) {
O << "\t.set\tmacro\n";
O << "\t.set\treorder\n";
- O << "\t.end\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- if (MAI->hasDotTypeDotSizeDirective() && !Subtarget->isLinux()) {
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- }
+ O << "\t.end\t" << *CurrentFnSym << '\n';
+ if (MAI->hasDotTypeDotSizeDirective() && !Subtarget->isLinux())
+ O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
}
/// runOnMachineFunction - This uses the printMachineInstruction()
@@ -359,15 +344,15 @@ void MipsAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
break;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
break;
case MachineOperand::MO_ExternalSymbol:
- GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(MO.getSymbolName());
break;
case MachineOperand::MO_JumpTableIndex:
@@ -478,15 +463,10 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
(GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (GVar->hasLocalLinkage()) {
- O << "\t.local\t";
- GVarSym->print(O, MAI);
- O << '\n';
- }
+ if (GVar->hasLocalLinkage())
+ O << "\t.local\t" << *GVarSym << '\n';
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (1 << Align);
@@ -502,18 +482,14 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
case GlobalValue::WeakODRLinkage:
// FIXME: Verify correct for weak.
// Nonnull linkonce -> weak
- O << "\t.weak ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak " << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of their name
// or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << MAI->getGlobalDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << MAI->getGlobalDirective() << *GVarSym << '\n';
// Fall Through
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
@@ -534,16 +510,11 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
EmitAlignment(Align, GVar);
if (MAI->hasDotTypeDotSizeDirective() && printSizeAndType) {
- O << "\t.type ";
- GVarSym->print(O, MAI);
- O << ",@object\n";
- O << "\t.size ";
- GVarSym->print(O, MAI);
- O << ',' << Size << '\n';
+ O << "\t.type " << *GVarSym << ",@object\n";
+ O << "\t.size " << *GVarSym << ',' << Size << '\n';
}
- GVarSym->print(O, MAI);
- O << ":\n";
+ O << *GVarSym << ":\n";
EmitGlobalConstant(C);
}
diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
index af2169ef52..0463596b82 100644
--- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
+++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
@@ -124,8 +124,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << "\tretlw high(" << PAN::getFrameLabel(CurrentFnSym->getName()) << ")\n";
// Emit function start label.
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
DebugLoc CurDL;
O << "\n";
@@ -191,7 +190,7 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
if (PAN::isMemIntrinsic(Sym->getName()))
LibcallDecls.push_back(createESName(Sym->getName()));
- Sym->print(O, MAI);
+ O << *Sym;
break;
}
case MachineOperand::MO_ExternalSymbol: {
@@ -212,7 +211,7 @@ void PIC16AsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
break;
}
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
default:
@@ -349,11 +348,8 @@ void PIC16AsmPrinter::EmitUndefinedVars(Module &M) {
if (!Items.size()) return;
O << "\n" << MAI->getCommentString() << "Imported Variables - BEGIN" << "\n";
- for (unsigned j = 0; j < Items.size(); j++) {
- O << MAI->getExternDirective();
- GetGlobalValueSymbol(Items[j])->print(O, MAI);
- O << "\n";
- }
+ for (unsigned j = 0; j < Items.size(); j++)
+ O << MAI->getExternDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
O << MAI->getCommentString() << "Imported Variables - END" << "\n";
}
@@ -363,11 +359,8 @@ void PIC16AsmPrinter::EmitDefinedVars(Module &M) {
if (!Items.size()) return;
O << "\n" << MAI->getCommentString() << "Exported Variables - BEGIN" << "\n";
- for (unsigned j = 0; j < Items.size(); j++) {
- O << MAI->getGlobalDirective();
- GetGlobalValueSymbol(Items[j])->print(O, MAI);
- O << "\n";
- }
+ for (unsigned j = 0; j < Items.size(); j++)
+ O << MAI->getGlobalDirective() << *GetGlobalValueSymbol(Items[j]) << "\n";
O << MAI->getCommentString() << "Exported Variables - END" << "\n";
}
@@ -446,7 +439,7 @@ void PIC16AsmPrinter::EmitInitializedDataSection(const PIC16Section *S) {
for (unsigned j = 0; j < Items.size(); j++) {
Constant *C = Items[j]->getInitializer();
int AddrSpace = Items[j]->getType()->getAddressSpace();
- GetGlobalValueSymbol(Items[j])->print(O, MAI);
+ O << *GetGlobalValueSymbol(Items[j]);
EmitGlobalConstant(C, AddrSpace);
}
}
@@ -465,8 +458,7 @@ EmitUninitializedDataSection(const PIC16Section *S) {
Constant *C = Items[j]->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypeAllocSize(Ty);
- GetGlobalValueSymbol(Items[j])->print(O, MAI);
- O << " RES " << Size << "\n";
+ O << *GetGlobalValueSymbol(Items[j]) << " RES " << Size << "\n";
}
}
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index b62c812e48..db37a1ab66 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -238,7 +238,7 @@ namespace {
// Dynamically-resolved functions need a stub for the function.
FnStubInfo &FnInfo = FnStubs[GetGlobalValueSymbol(GV)];
FnInfo.Init(GV, this);
- FnInfo.Stub->print(O, MAI);
+ O << *FnInfo.Stub;
return;
}
}
@@ -246,7 +246,7 @@ namespace {
FnStubInfo &FnInfo =
FnStubs[GetExternalSymbolSymbol(MO.getSymbolName())];
FnInfo.Init(MO.getSymbolName(), Mang, OutContext);
- FnInfo.Stub->print(O, MAI);
+ O << *FnInfo.Stub;
return;
}
}
@@ -342,8 +342,7 @@ namespace {
GetOrCreateSymbol(StringRef(MAI->getPrivateGlobalPrefix()) + "C" +
Twine(LabelID++));
- TOCEntry->print(O, MAI);
- O << "@toc";
+ O << *TOCEntry << "@toc";
}
void printPredicateOperand(const MachineInstr *MI, unsigned OpNo,
@@ -413,7 +412,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
llvm_unreachable("printOp() does not handle immediate values");
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_JumpTableIndex:
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -425,20 +424,20 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
<< '_' << MO.getIndex();
return;
case MachineOperand::MO_BlockAddress:
- GetBlockAddressSymbol(MO.getBlockAddress())->print(O, MAI);
+ O << *GetBlockAddressSymbol(MO.getBlockAddress());
return;
case MachineOperand::MO_ExternalSymbol: {
// Computing the address of an external symbol, not calling it.
const MCSymbol *SymName = GetExternalSymbolSymbol(MO.getSymbolName());
if (TM.getRelocationModel() == Reloc::Static) {
- SymName->print(O, MAI);
+ O << *SymName;
return;
}
const MCSymbol *NLPSym =
OutContext.GetOrCreateSymbol(StringRef(MAI->getGlobalPrefix())+
MO.getSymbolName()+"$non_lazy_ptr");
GVStubs[SymName] = NLPSym;
- NLPSym->print(O, MAI);
+ O << *NLPSym;
return;
}
case MachineOperand::MO_GlobalAddress: {
@@ -463,7 +462,7 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
SymToPrint = GetGlobalValueSymbol(GV);
}
- SymToPrint->print(O, MAI);
+ O << *SymToPrint;
printOffset(MO.getOffset());
return;
@@ -635,23 +634,16 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::InternalLinkage: // Symbols default to internal.
break;
case Function::ExternalLinkage:
- O << "\t.global\t";
- CurrentFnSym->print(O, MAI);
- O << '\n' << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ", @function\n";
+ O << "\t.global\t" << *CurrentFnSym << '\n' << "\t.type\t";
+ O << *CurrentFnSym << ", @function\n";
break;
case Function::LinkerPrivateLinkage:
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
- O << "\t.global\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- O << "\t.weak\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.global\t" << *CurrentFnSym << '\n';
+ O << "\t.weak\t" << *CurrentFnSym << '\n';
break;
}
@@ -664,18 +656,12 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// FIXME 64-bit SVR4: Use MCSection here!
O << "\t.section\t\".opd\",\"aw\"\n";
O << "\t.align 3\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
- O << "\t.quad .L.";
- CurrentFnSym->print(O, MAI);
- O << ",.TOC.@tocbase\n";
+ O << *CurrentFnSym << ":\n";
+ O << "\t.quad .L." << *CurrentFnSym << ",.TOC.@tocbase\n";
O << "\t.previous\n";
- O << ".L.";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << ".L." << *CurrentFnSym << ":\n";
} else {
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
}
// Emit pre-function debug information.
@@ -695,11 +681,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ",.-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.size\t" << *CurrentFnSym << ",.-" << *CurrentFnSym << '\n';
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
@@ -742,23 +724,14 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << '\n';
- O << "\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n";
- GVarSym->print(O, MAI);
- O << ":\n";
+ O << "\t.global " << *GVarSym << '\n';
+ O << "\t.type " << *GVarSym << ", @object\n";
+ O << *GVarSym << ":\n";
O << "\t.zero " << Size << '\n';
} else if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size;
} else {
- O << ".comm ";
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << ".comm " << *GVarSym << ',' << Size;
}
if (VerboseAsm) {
O << "\t\t" << MAI->getCommentString() << " '";
@@ -776,24 +749,16 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonLinkage:
case GlobalValue::LinkerPrivateLinkage:
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << "\n\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n\t.weak ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.global " << *GVarSym;
+ O << "\n\t.type " << *GVarSym << ", @object\n\t.weak " << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.global ";
- GVarSym->print(O, MAI);
- O << "\n\t.type ";
- GVarSym->print(O, MAI);
- O << ", @object\n";
+ O << "\t.global " << *GVarSym;
+ O << "\n\t.type " << *GVarSym << ", @object\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
case GlobalValue::PrivateLinkage:
@@ -803,8 +768,7 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
}
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O << "\t\t\t\t" << MAI->getCommentString() << " '";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -828,13 +792,8 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
// FIXME: This is nondeterminstic!
for (DenseMap<const MCSymbol*, const MCSymbol*>::iterator I = TOC.begin(),
E = TOC.end(); I != E; ++I) {
- I->second->print(O, MAI);
- O << ":\n";
- O << "\t.tc ";
- I->first->print(O, MAI);
- O << "[TC],";
- I->first->print(O, MAI);
- O << '\n';
+ O << *I->second << ":\n";
+ O << "\t.tc " << *I->first << "[TC]," << *I->first << '\n';
}
}
@@ -863,29 +822,22 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
case Function::InternalLinkage: // Symbols default to internal.
break;
case Function::ExternalLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
break;
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
case Function::LinkerPrivateLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- O << "\t.weak_definition\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
+ O << "\t.weak_definition\t" << *CurrentFnSym << '\n';
break;
}
printVisibility(CurrentFnSym, F->getVisibility());
EmitAlignment(MF.getAlignment(), F);
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << *CurrentFnSym << ":\n";
// Emit pre-function debug information.
DW->BeginFunction(&MF);
@@ -1006,25 +958,16 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n';
- O << "\t.zerofill __DATA, __common, ";
- GVarSym->print(O, MAI);
- O << ", " << Size << ", " << Align;
+ O << "\t.globl " << *GVarSym << '\n';
+ O << "\t.zerofill __DATA, __common, " << *GVarSym << ", "
+ << Size << ", " << Align;
} else if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size << ',' << Align;
+ O << MAI->getLCOMMDirective() << *GVarSym << ',' << Size << ',' << Align;
} else if (!GVar->hasCommonLinkage()) {
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n' << MAI->getWeakDefDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << '\n' << MAI->getWeakDefDirective();
+ O << *GVarSym << '\n';
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O << "\t\t\t\t" << MAI->getCommentString() << " ";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -1033,9 +976,7 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
EmitGlobalConstant(C);
return;
} else {
- O << ".comm ";
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << ".comm " << *GVarSym << ',' << Size;
// Darwin 9 and above support aligned common data.
if (Subtarget.isDarwin9())
O << ',' << Align;
@@ -1056,20 +997,14 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
case GlobalValue::WeakODRLinkage:
case GlobalValue::CommonLinkage:
case GlobalValue::LinkerPrivateLinkage:
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << "\n\t.weak_definition ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << "\n\t.weak_definition " << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << '\n';
// FALL THROUGH
case GlobalValue::InternalLinkage:
case GlobalValue::PrivateLinkage:
@@ -1079,8 +1014,7 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
}
EmitAlignment(Align, GVar);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O << "\t\t\t\t" << MAI->getCommentString() << " '";
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
@@ -1120,38 +1054,23 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
OutStreamer.SwitchSection(StubSection);
EmitAlignment(4);
const FnStubInfo &Info = I->second;
- Info.Stub->print(O, MAI);
- O << ":\n";
- O << "\t.indirect_symbol ";
- I->first->print(O, MAI);
- O << '\n';
+ O << *Info.Stub << ":\n";
+ O << "\t.indirect_symbol " << *I->first << '\n';
O << "\tmflr r0\n";
- O << "\tbcl 20,31,";
- Info.AnonSymbol->print(O, MAI);
- O << '\n';
- Info.AnonSymbol->print(O, MAI);
- O << ":\n";
+ O << "\tbcl 20,31," << *Info.AnonSymbol << '\n';
+ O << *Info.AnonSymbol << ":\n";
O << "\tmflr r11\n";
- O << "\taddis r11,r11,ha16(";
- Info.LazyPtr->print(O, MAI);
- O << '-';
- Info.AnonSymbol->print(O, MAI);
- O << ")\n";
+ O << "\taddis r11,r11,ha16(" << *Info.LazyPtr << '-' << *Info.AnonSymbol
+ << ")\n";
O << "\tmtlr r0\n";
- O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(";
- Info.LazyPtr->print(O, MAI);
- O << '-';
- Info.AnonSymbol->print(O, MAI);
- O << ")(r11)\n";
+ O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(" << *Info.LazyPtr
+ << '-' << *Info.AnonSymbol << ")(r11)\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
OutStreamer.SwitchSection(LSPSection);
- Info.LazyPtr->print(O, MAI);
- O << ":\n";
- O << "\t.indirect_symbol ";
- I->first->print(O, MAI);
- O << '\n';
+ O << *Info.LazyPtr << ":\n";
+ O << "\t.indirect_symbol " << *I->first << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
}
} else if (!FnStubs.empty()) {
@@ -1167,25 +1086,16 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
OutStreamer.SwitchSection(StubSection);
EmitAlignment(4);
const FnStubInfo &Info = I->second;
- Info.Stub->print(O, MAI);
- O << ":\n";
- O << "\t.indirect_symbol ";
- I->first->print(O, MAI);
- O << '\n';
- O << "\tlis r11,ha16(";
- Info.LazyPtr->print(O, MAI);
- O << ")\n";
- O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(";
- Info.LazyPtr->print(O, MAI);
- O << ")(r11)\n";
+ O << *Info.Stub << ":\n";
+ O << "\t.indirect_symbol " << *I->first << '\n';
+ O << "\tlis r11,ha16(" << *Info.LazyPtr << ")\n";
+ O << (isPPC64 ? "\tldu" : "\tlwzu") << " r12,lo16(" << *Info.LazyPtr
+ << ")(r11)\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
OutStreamer.SwitchSection(LSPSection);
- Info.LazyPtr->print(O, MAI);
- O << ":\n";
- O << "\t.indirect_symbol ";
- I->first->print(O, MAI);
- O << '\n';
+ O << *Info.LazyPtr << ":\n";
+ O << "\t.indirect_symbol " << *I->first << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
}
}
@@ -1213,11 +1123,8 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
// FIXME: This is nondeterminstic.
for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) {
- I->second->print(O, MAI);
- O << ":\n";
- O << "\t.indirect_symbol ";
- I->first->print(O, MAI);
- O << '\n';
+ O << *I->second << ":\n";
+ O << "\t.indirect_symbol " << *I->first << '\n';
O << (isPPC64 ? "\t.quad\t0\n" : "\t.long\t0\n");
}
}
@@ -1228,11 +1135,8 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
// FIXME: This is nondeterminstic.
for (DenseMap<const MCSymbol *, const MCSymbol *>::iterator
I = HiddenGVStubs.begin(), E = HiddenGVStubs.end(); I != E; ++I) {
- I->second->print(O, MAI);
- O << ":\n";
- O << (isPPC64 ? "\t.quad\t" : "\t.long\t");
- I->first->print(O, MAI);
- O << '\n';
+ O << *I->second << ":\n";
+ O << (isPPC64 ? "\t.quad\t" : "\t.long\t") << *I->first << '\n';
}
}
diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
index bb9c75df01..ca586f68ea 100644
--- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
@@ -137,11 +137,7 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
DW->EndFunction(&MF);
// We didn't modify anything.
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
return false;
}
@@ -159,9 +155,7 @@ void SparcAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
// Function is externally visible
- O << "\t.global\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.global\t" << *CurrentFnSym << '\n';
break;
case Function::LinkerPrivateLinkage:
case Function::LinkOnceAnyLinkage:
@@ -169,19 +163,14 @@ void SparcAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
// Function is weak
- O << "\t.weak\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *CurrentFnSym << '\n';
break;
}
printVisibility(CurrentFnSym, F->getVisibility());
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ", #function\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << "\t.type\t" << *CurrentFnSym << ", #function\n";
+ O << *CurrentFnSym << ":\n";
}
@@ -205,10 +194,10 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
O << (int)MO.getImm();
break;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
break;
case MachineOperand::MO_ExternalSymbol:
O << MO.getSymbolName();
@@ -314,14 +303,10 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasLocalLinkage()) {
- O << "\t.local ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.local " << *GVarSym << '\n';
}
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (1 << Align);
@@ -337,18 +322,14 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak.
case GlobalValue::WeakODRLinkage: // FIXME: Verify correct for weak.
// Nonnull linkonce -> weak
- O << "\t.weak ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak " << *GVarSym << '\n';
break;
case GlobalValue::AppendingLinkage:
// FIXME: appending linkage variables should go into a section of
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << MAI->getGlobalDirective();
- GVarSym->print(O, MAI);
- O << '\n';
+ O << MAI->getGlobalDirective() << *GVarSym << '\n';
// FALL THROUGH
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
@@ -367,16 +348,11 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
EmitAlignment(Align, GVar);
if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.type ";
- GVarSym->print(O, MAI);
- O << ",#object\n";
- O << "\t.size ";
- GVarSym->print(O, MAI);
- O << ',' << Size << '\n';
+ O << "\t.type " << *GVarSym << ",#object\n";
+ O << "\t.size " << *GVarSym << ',' << Size << '\n';
}
- GVarSym->print(O, MAI);
- O << ":\n";
+ O << *GVarSym << ":\n";
EmitGlobalConstant(C);
}
diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
index b546358bb1..53d2955b62 100644
--- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
+++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
@@ -97,27 +97,20 @@ void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::LinkerPrivateLinkage:
break;
case Function::ExternalLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
break;
case Function::LinkOnceAnyLinkage:
case Function::LinkOnceODRLinkage:
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
- O << "\t.weak\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *CurrentFnSym << '\n';
break;
}
printVisibility(CurrentFnSym, F->getVisibility());
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ",@function\n";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ O << "\t.type\t" << *CurrentFnSym << ",@function\n";
+ O << *CurrentFnSym << ":\n";
}
bool SystemZAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
@@ -142,13 +135,8 @@ bool SystemZAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
printMachineInstruction(II);
}
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
// Print out jump tables referenced by the function.
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
@@ -179,11 +167,11 @@ void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){
O << MO.getImm();
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress: {
const GlobalValue *GV = MO.getGlobal();
- GetGlobalValueSymbol(GV)->print(O, MAI);
+ O << *GetGlobalValueSymbol(GV);
// Assemble calls via PLT for externally visible symbols if PIC.
if (TM.getRelocationModel() == Reloc::PIC_ &&
@@ -234,7 +222,7 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
O << MO.getImm();
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_JumpTableIndex:
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_'
@@ -248,10 +236,10 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
printOffset(MO.getOffset());
break;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
break;
case MachineOperand::MO_ExternalSymbol: {
- GetExternalSymbolSymbol(MO.getSymbolName())->print(O, MAI);
+ O << *GetExternalSymbolSymbol(MO.getSymbolName());
break;
}
default:
@@ -323,9 +311,7 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
printVisibility(GVarSym, GVar->getVisibility());
- O << "\t.type\t";
- GVarSym->print(O, MAI);
- O << ",@object\n";
+ O << "\t.type\t" << *GVarSym << ",@object\n";
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
TM));
@@ -336,15 +322,10 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
- if (GVar->hasLocalLinkage()) {
- O << "\t.local\t";
- GVarSym->print(O, MAI);
- O << '\n';
- }
+ if (GVar->hasLocalLinkage())
+ O << "\t.local\t" << *GVarSym << '\n';
- O << MAI->getCOMMDirective();
- GVarSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
@@ -362,9 +343,7 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
- O << "\t.weak\t";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *GVarSym << '\n';
break;
case GlobalValue::DLLExportLinkage:
case GlobalValue::AppendingLinkage:
@@ -372,9 +351,7 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.globl ";
- GVarSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVarSym << '\n';
// FALL THROUGH
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
@@ -386,18 +363,14 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// Use 16-bit alignment by default to simplify bunch of stuff
EmitAlignment(Align, GVar, 1);
- GVarSym->print(O, MAI);
- O << ":";
+ O << *GVarSym << ":";
if (VerboseAsm) {
O << "\t\t\t\t" << MAI->getCommentString() << ' ';
WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
}
O << '\n';
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- GVarSym->print(O, MAI);
- O << ", " << Size << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *GVarSym << ", " << Size << '\n';
EmitGlobalConstant(C);
}
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index dbb7279a55..977d321645 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -60,7 +60,7 @@ void X86AsmPrinter::printMCInst(const MCInst *MI) {
void X86AsmPrinter::PrintPICBaseSymbol() const {
// FIXME: Gross const cast hack.
X86AsmPrinter *AP = const_cast<X86AsmPrinter*>(this);
- X86MCInstLower(OutContext, 0, *AP).GetPICBaseSymbol()->print(O, MAI);
+ O << *X86MCInstLower(OutContext, 0, *AP).GetPICBaseSymbol();
}
void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
@@ -84,9 +84,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
break;
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
break;
case Function::LinkerPrivateLinkage:
case Function::LinkOnceAnyLinkage:
@@ -94,20 +92,13 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- O << MAI->getWeakDefDirective();
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl\t" << *CurrentFnSym << '\n';
+ O << MAI->getWeakDefDirective() << *CurrentFnSym << '\n';
} else if (Subtarget->isTargetCygMing()) {
- O << "\t.globl\t";
- CurrentFnSym->print(O, MAI);
+ O << "\t.globl\t" << *CurrentFnSym;
O << "\n\t.linkonce discard\n";
} else {
- O << "\t.weak\t";
- CurrentFnSym->print(O, MAI);
- O << '\n';
+ O << "\t.weak\t" << *CurrentFnSym << '\n';
}
break;
}
@@ -115,20 +106,16 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
printVisibility(CurrentFnSym, F->getVisibility());
if (Subtarget->isTargetELF()) {
- O << "\t.type\t";
- CurrentFnSym->print(O, MAI);
- O << ",@function\n";
+ O << "\t.type\t" << *CurrentFnSym << ",@function\n";
} else if (Subtarget->isTargetCygMing()) {
- O << "\t.def\t ";
- CurrentFnSym->print(O, MAI);
+ O << "\t.def\t " << *CurrentFnSym;
O << ";\t.scl\t" <<
(F->hasInternalLinkage() ? COFF::C_STAT : COFF::C_EXT)
<< ";\t.type\t" << (COFF::DT_FCN << COFF::N_BTSHFT)
<< ";\t.endef\n";
}
- CurrentFnSym->print(O, MAI);
- O << ':';
+ O << *CurrentFnSym << ':';
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
@@ -138,11 +125,8 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
// Add some workaround for linkonce linkage on Cygwin\MinGW
if (Subtarget->isTargetCygMing() &&
- (F->hasLinkOnceLinkage() || F->hasWeakLinkage())) {
- O << "Lllvm$workaround$fake$stub$";
- CurrentFnSym->print(O, MAI);
- O << ":\n";
- }
+ (F->hasLinkOnceLinkage() || F->hasWeakLinkage()))
+ O << "Lllvm$workaround$fake$stub$" << *CurrentFnSym << ":\n";
}
/// runOnMachineFunction - This uses the printMachineInstruction()
@@ -199,13 +183,8 @@ bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << "\tnop\n";
}
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- CurrentFnSym->print(O, MAI);
- O << ", .-";
- CurrentFnSym->print(O, MAI);
- O << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
// Emit post-function debug information.
if (MAI->doesSupportDebugInformation() || MAI->doesSupportExceptionHandling())
@@ -282,12 +261,9 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
// If the name begins with a dollar-sign, enclose it in parens. We do this
// to avoid having it look like an integer immediate to the assembler.
if (GVSym->getName()[0] != '$')
- GVSym->print(O, MAI);
- else {
- O << '(';
- GVSym->print(O, MAI);
- O << ')';
- }
+ O << *GVSym;
+ else
+ O << '(' << *GVSym << ')';
printOffset(MO.getOffset());
break;
}
@@ -313,12 +289,9 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
// If the name begins with a dollar-sign, enclose it in parens. We do this
// to avoid having it look like an integer immediate to the assembler.
if (SymToPrint->getName()[0] != '$')
- SymToPrint->print(O, MAI);
- else {
- O << '(';
- SymToPrint->print(O, MAI);
- O << '(';
- }
+ O << *SymToPrint;
+ else
+ O << '(' << *SymToPrint << '(';
break;
}
}
@@ -367,7 +340,7 @@ void X86AsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
O << MO.getImm();
return;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
return;
case MachineOperand::MO_GlobalAddress:
case MachineOperand::MO_ExternalSymbol:
@@ -492,7 +465,7 @@ void X86AsmPrinter::printPICJumpTableSetLabel(unsigned uid,
O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
<< getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ',';
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << GetMBBSymbol(MBB->getNumber());
if (Subtarget->isPICStyleRIPRel())
O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
@@ -523,11 +496,10 @@ void X86AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
if (Subtarget->isPICStyleRIPRel() || Subtarget->isPICStyleStubPIC()) {
O << MAI->getPrivateGlobalPrefix() << getFunctionNumber()
<< '_' << uid << "_set_" << MBB->getNumber();
- } else if (Subtarget->isPICStyleGOT()) {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
- O << "@GOTOFF";
- } else
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ } else if (Subtarget->isPICStyleGOT())
+ O << *GetMBBSymbol(MBB->getNumber()) << "@GOTOFF";
+ else
+ O << *GetMBBSymbol(MBB->getNumber());
}
bool X86AsmPrinter::printAsmMRegister(const MachineOperand &MO, char Mode) {
@@ -700,12 +672,8 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
printVisibility(GVSym, GVar->getVisibility());
- if (Subtarget->isTargetELF()) {
- O << "\t.type\t";
- GVSym->print(O, MAI);
- O << ",@object\n";
- }
-
+ if (Subtarget->isTargetELF())
+ O << "\t.type\t" << *GVSym << ",@object\n";
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GVar, TM);
const MCSection *TheSection =
@@ -718,11 +686,8 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
!TheSection->getKind().isMergeableCString()) {
if (GVar->hasExternalLinkage()) {
if (const char *Directive = MAI->getZeroFillDirective()) {
- O << "\t.globl ";
- GVSym->print(O, MAI);
- O << '\n';
- O << Directive << "__DATA, __common, ";
- GVSym->print(O, MAI);
+ O << "\t.globl " << *GVSym << '\n';
+ O << Directive << "__DATA, __common, " << *GVSym;
O << ", " << Size << ", " << Align << '\n';
return;
}
@@ -734,20 +699,14 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (MAI->getLCOMMDirective() != NULL) {
if (GVar->hasLocalLinkage()) {
- O << MAI->getLCOMMDirective();
- GVSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getLCOMMDirective() << *GVSym << ',' << Size;
if (Subtarget->isTargetDarwin())
O << ',' << Align;
} else if (Subtarget->isTargetDarwin() && !GVar->hasCommonLinkage()) {
- O << "\t.globl ";
- GVSym->print(O, MAI);
- O << '\n' << MAI->getWeakDefDirective();
- GVSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVSym << '\n';
+ O << MAI->getWeakDefDirective() << *GVSym << '\n';
EmitAlignment(Align, GVar);
- GVSym->print(O, MAI);
- O << ":";
+ O << *GVSym << ":";
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
@@ -757,23 +716,16 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
EmitGlobalConstant(C);
return;
} else {
- O << MAI->getCOMMDirective();
- GVSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
} else {
if (!Subtarget->isTargetCygMing()) {
- if (GVar->hasLocalLinkage()) {
- O << "\t.local\t";
- GVSym->print(O, MAI);
- O << '\n';
- }
+ if (GVar->hasLocalLinkage())
+ O << "\t.local\t" << *GVSym << '\n';
}
- O << MAI->getCOMMDirective();
- GVSym->print(O, MAI);
- O << ',' << Size;
+ O << MAI->getCOMMDirective() << *GVSym << ',' << Size;
if (MAI->getCOMMDirectiveTakesAlignment())
O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << Align) : Align);
}
@@ -795,20 +747,13 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkerPrivateLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl ";
- GVSym->print(O, MAI);
- O << '\n' << MAI->getWeakDefDirective();
- GVSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVSym << '\n';
+ O << MAI->getWeakDefDirective() << *GVSym << '\n';
} else if (Subtarget->isTargetCygMing()) {
- O << "\t.globl\t";
- GVSym->print(O, MAI);
+ O << "\t.globl\t" << *GVSym;
O << "\n\t.linkonce same_size\n";
- } else {
- O << "\t.weak\t";
- GVSym->print(O, MAI);
- O << '\n';
- }
+ } else
+ O << "\t.weak\t" << *GVSym << '\n';
break;
case GlobalValue::DLLExportLinkage:
case GlobalValue::AppendingLinkage:
@@ -816,9 +761,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
// their name or something. For now, just emit them as external.
case GlobalValue::ExternalLinkage:
// If external or appending, declare as a global symbol
- O << "\t.globl ";
- GVSym->print(O, MAI);
- O << '\n';
+ O << "\t.globl " << *GVSym << '\n';
// FALL THROUGH
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
@@ -828,8 +771,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
}
EmitAlignment(Align, GVar);
- GVSym->print(O, MAI);
- O << ":";
+ O << *GVSym << ":";
if (VerboseAsm){
O.PadToColumn(MAI->getCommentColumn());
O << MAI->getCommentString() << ' ';
@@ -839,11 +781,8 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
EmitGlobalConstant(C);
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.size\t";
- GVSym->print(O, MAI);
- O << ", " << Size << '\n';
- }
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.size\t" << *GVSym << ", " << Size << '\n';
}
void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
@@ -869,10 +808,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.SwitchSection(TheSection);
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- Stubs[i].first->print(O, MAI);
- O << ":\n" << "\t.indirect_symbol ";
+ O << *Stubs[i].first << ":\n";
// Get the MCSymbol without the $stub suffix.
- Stubs[i].second->print(O, MAI);
+ O << "\t.indirect_symbol " << *Stubs[i].second;
O << "\n\thlt ; hlt ; hlt ; hlt ; hlt\n";
}
O << '\n';
@@ -890,9 +828,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.SwitchSection(TheSection);
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- Stubs[i].first->print(O, MAI);
- O << ":\n\t.indirect_symbol ";
- Stubs[i].second->print(O, MAI);
+ O << *Stubs[i].first << ":\n\t.indirect_symbol " << *Stubs[i].second;
O << "\n\t.long\t0\n";
}
Stubs.clear();
@@ -904,10 +840,8 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
EmitAlignment(2);
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
- Stubs[i].first->print(O, MAI);
- O << ":\n" << MAI->getData32bitsDirective();
- Stubs[i].second->print(O, MAI);
- O << '\n';
+ O << *Stubs[i].first << ":\n" << MAI->getData32bitsDirective();
+ O << *Stubs[i].second << '\n';
}
Stubs.clear();
}
@@ -957,17 +891,11 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer.SwitchSection(TLOFCOFF.getCOFFSection(".section .drectve",
true,
SectionKind::getMetadata()));
- for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i) {
- O << "\t.ascii \" -export:";
- DLLExportedGlobals[i]->print(O, MAI);
- O << ",data\"\n";
- }
+ for (unsigned i = 0, e = DLLExportedGlobals.size(); i != e; ++i)
+ O << "\t.ascii \" -export:" << *DLLExportedGlobals[i] << ",data\"\n";
- for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i) {
- O << "\t.ascii \" -export:";
- DLLExportedFns[i]->print(O, MAI);
- O << "\"\n";
- }
+ for (unsigned i = 0, e = DLLExportedFns.size(); i != e; ++i)
+ O << "\t.ascii \" -export:" << *DLLExportedFns[i] << "\"\n";
}
}
}
diff --git a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
index 5ac025b179..8ac6fd5f67 100644
--- a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
+++ b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
@@ -94,9 +94,7 @@ namespace {
#include "XCoreGenAsmWriter.inc"
void XCoreAsmPrinter::emitGlobalDirective(const MCSymbol *Sym) {
- O << MAI->getGlobalDirective();
- Sym->print(O, MAI);
- O << "\n";
+ O << MAI->getGlobalDirective() << *Sym << "\n";
}
void XCoreAsmPrinter::emitArrayBound(const MCSymbol *Sym,
@@ -106,18 +104,13 @@ void XCoreAsmPrinter::emitArrayBound(const MCSymbol *Sym,
GV->hasLinkOnceLinkage()) && "Unexpected linkage");
if (const ArrayType *ATy = dyn_cast<ArrayType>(
cast<PointerType>(GV->getType())->getElementType())) {
- O << MAI->getGlobalDirective();
- Sym->print(O, MAI);
+ O << MAI->getGlobalDirective() << *Sym;
O << ".globound" << "\n";
- O << MAI->getSetDirective();
- Sym->print(O, MAI);
- O << ".globound" << ","
- << ATy->getNumElements() << "\n";
+ O << MAI->getSetDirective() << *Sym;
+ O << ".globound" << "," << ATy->getNumElements() << "\n";
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
// TODO Use COMDAT groups for LinkOnceLinkage
- O << MAI->getWeakDefDirective();
- Sym->print(O, MAI);
- O << ".globound" << "\n";
+ O << MAI->getWeakDefDirective() << *Sym << ".globound" << "\n";
}
}
}
@@ -137,11 +130,7 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
unsigned Align = (unsigned)TD->getPreferredTypeAlignmentShift(C->getType());
// Mark the start of the global
- O << "\t.cc_top ";
- GVSym->print(O, MAI);
- O << ".data,";
- GVSym->print(O, MAI);
- O << "\n";
+ O << "\t.cc_top " << *GVSym << ".data," << *GVSym << "\n";
switch (GV->getLinkage()) {
case GlobalValue::AppendingLinkage:
@@ -154,11 +143,8 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
emitArrayBound(GVSym, GV);
emitGlobalDirective(GVSym);
// TODO Use COMDAT groups for LinkOnceLinkage
- if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
- O << MAI->getWeakDefDirective();
- GVSym->print(O, MAI);
- O << "\n";
- }
+ if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())
+ O << MAI->getWeakDefDirective() << *GVSym << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
case GlobalValue::PrivateLinkage:
@@ -181,15 +167,10 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
Size *= MaxThreads;
}
if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.type ";
- GVSym->print(O, MAI);
- O << ",@object\n";
- O << "\t.size ";
- GVSym->print(O, MAI);
- O << "," << Size << "\n";
+ O << "\t.type " << *GVSym << ",@object\n";
+ O << "\t.size " << *GVSym << "," << Size << "\n";
}
- GVSym->print(O, MAI);
- O << ":\n";
+ O << *GVSym << ":\n";
EmitGlobalConstant(C);
if (GV->isThreadLocal()) {
@@ -204,9 +185,7 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
}
// Mark the end of the global
- O << "\t.cc_bottom ";
- GVSym->print(O, MAI);
- O << ".data\n";
+ O << "\t.cc_bottom " << *GVSym << ".data\n";
}
/// Emit the directives on the start of functions
@@ -217,11 +196,7 @@ void XCoreAsmPrinter::emitFunctionStart(MachineFunction &MF) {
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
// Mark the start of the function
- O << "\t.cc_top ";
- CurrentFnSym->print(O, MAI);
- O << ".function,";
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << "\t.cc_top " << *CurrentFnSym << ".function," << *CurrentFnSym << "\n";
switch (F->getLinkage()) {
default: llvm_unreachable("Unknown linkage type!");
@@ -237,31 +212,22 @@ void XCoreAsmPrinter::emitFunctionStart(MachineFunction &MF) {
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
// TODO Use COMDAT groups for LinkOnceLinkage
- O << MAI->getGlobalDirective();
- CurrentFnSym->print(O, MAI);
- O << "\n";
- O << MAI->getWeakDefDirective();
- CurrentFnSym->print(O, MAI);
- O << "\n";
+ O << MAI->getGlobalDirective() << *CurrentFnSym << "\n";
+ O << MAI->getWeakDefDirective() << *CurrentFnSym << "\n";
break;
}
// (1 << 1) byte aligned
EmitAlignment(MF.getAlignment(), F, 1);
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.type ";
- CurrentFnSym->print(O, MAI);
- O << ",@function\n";
- }
- CurrentFnSym->print(O, MAI);
- O << ":\n";
+ if (MAI->hasDotTypeDotSizeDirective())
+ O << "\t.type " << *CurrentFnSym << ",@function\n";
+
+ O << *CurrentFnSym << ":\n";
}
/// Emit the directives on the end of functions
void XCoreAsmPrinter::emitFunctionEnd(MachineFunction &MF) {
// Mark the end of the function
- O << "\t.cc_bottom ";
- CurrentFnSym->print(O, MAI);
- O << ".function\n";
+ O << "\t.cc_bottom " << *CurrentFnSym << ".function\n";
}
/// runOnMachineFunction - This uses the printMachineInstruction()
@@ -336,10 +302,10 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
O << MO.getImm();
break;
case MachineOperand::MO_MachineBasicBlock:
- GetMBBSymbol(MO.getMBB()->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MO.getMBB()->getNumber());
break;
case MachineOperand::MO_GlobalAddress:
- GetGlobalValueSymbol(MO.getGlobal())->print(O, MAI);
+ O << *GetGlobalValueSymbol(MO.getGlobal());
break;
case MachineOperand::MO_ExternalSymbol:
O << MO.getSymbolName();
@@ -352,7 +318,7 @@ void XCoreAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << MO.getIndex();
case MachineOperand::MO_BlockAddress:
- GetBlockAddressSymbol(MO.getBlockAddress())->print(O, MAI);
+ O << *GetBlockAddressSymbol(MO.getBlockAddress());
break;
default:
llvm_unreachable("not implemented");