aboutsummaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
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