summaryrefslogtreecommitdiff
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
parent6edec7b34a7f16e0af7fa5947b69805238d6fe6c (diff)
downloadllvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.tar.gz
llvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.tar.bz2
llvm-10b318bcb39218d2ed525e4862c854bc8d1baf63.tar.xz
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
-rw-r--r--include/llvm/MC/MCSymbol.h7
-rw-r--r--include/llvm/MC/MCValue.h1
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp78
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfException.cpp40
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfPrinter.cpp2
-rw-r--r--lib/MC/MCAsmStreamer.cpp22
-rw-r--r--lib/MC/MCExpr.cpp11
-rw-r--r--lib/MC/MCSymbol.cpp5
-rw-r--r--lib/MC/MCValue.cpp8
-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
21 files changed, 377 insertions, 867 deletions
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index c84babac4a..e77060415f 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -19,7 +19,6 @@
#include "llvm/System/DataTypes.h"
namespace llvm {
- class MCAsmInfo;
class MCExpr;
class MCSection;
class MCContext;
@@ -133,12 +132,16 @@ namespace llvm {
/// @}
/// print - Print the value to the stream \arg OS.
- void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
+ void print(raw_ostream &OS) const;
/// dump - Print the value to stderr.
void dump() const;
};
+ inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
+ Sym.print(OS);
+ return OS;
+ }
} // end namespace llvm
#endif
diff --git a/include/llvm/MC/MCValue.h b/include/llvm/MC/MCValue.h
index 4f5ab314aa..8aa73f350f 100644
--- a/include/llvm/MC/MCValue.h
+++ b/include/llvm/MC/MCValue.h
@@ -20,6 +20,7 @@
namespace llvm {
class MCSymbol;
+class MCAsmInfo;
class raw_ostream;
/// MCValue - This represents an "assembler immediate". In its most general
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index bb1f1d31d1..3beb4d66ac 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -156,16 +156,12 @@ bool AsmPrinter::doFinalization(Module &M) {
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
if (!I->hasExternalWeakLinkage()) continue;
- O << MAI->getWeakRefDirective();
- GetGlobalValueSymbol(I)->print(O, MAI);
- O << '\n';
+ O << MAI->getWeakRefDirective() << *GetGlobalValueSymbol(I) << '\n';
}
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) {
if (!I->hasExternalWeakLinkage()) continue;
- O << MAI->getWeakRefDirective();
- GetGlobalValueSymbol(I)->print(O, MAI);
- O << '\n';
+ O << MAI->getWeakRefDirective() << *GetGlobalValueSymbol(I) << '\n';
}
}
@@ -178,25 +174,16 @@ bool AsmPrinter::doFinalization(Module &M) {
const GlobalValue *GV = cast<GlobalValue>(I->getAliasedGlobal());
MCSymbol *Target = GetGlobalValueSymbol(GV);
- if (I->hasExternalLinkage() || !MAI->getWeakRefDirective()) {
- O << "\t.globl\t";
- Name->print(O, MAI);
- O << '\n';
- } else if (I->hasWeakLinkage()) {
- O << MAI->getWeakRefDirective();
- Name->print(O, MAI);
- O << '\n';
- } else {
+ if (I->hasExternalLinkage() || !MAI->getWeakRefDirective())
+ O << "\t.globl\t" << *Name << '\n';
+ else if (I->hasWeakLinkage())
+ O << MAI->getWeakRefDirective() << *Name << '\n';
+ else
assert(I->hasLocalLinkage() && "Invalid alias linkage");
- }
printVisibility(Name, I->getVisibility());
- O << MAI->getSetDirective() << ' ';
- Name->print(O, MAI);
- O << ", ";
- Target->print(O, MAI);
- O << '\n';
+ O << MAI->getSetDirective() << ' ' << *Name << ", " << *Target << '\n';
}
}
@@ -422,12 +409,12 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
// If we're emitting non-PIC code, then emit the entries as direct
// references to the target basic blocks.
if (!isPIC) {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MBB->getNumber());
} else if (MAI->getSetDirective()) {
O << MAI->getPrivateGlobalPrefix() << getFunctionNumber()
<< '_' << uid << "_set_" << MBB->getNumber();
} else {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
+ O << *GetMBBSymbol(MBB->getNumber());
// If the arch uses custom Jump Table directives, don't calc relative to
// JT
if (!HadJTEntryDirective)
@@ -812,12 +799,12 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
// This is a constant address for a global variable or function. Use the
// name of the variable or function as the address value.
- GetGlobalValueSymbol(GV)->print(O, MAI);
+ O << *GetGlobalValueSymbol(GV);
return;
}
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV)) {
- GetBlockAddressSymbol(BA)->print(O, MAI);
+ O << *GetBlockAddressSymbol(BA);
return;
}
@@ -1580,9 +1567,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
unsigned OpFlags = MI->getOperand(OpNo).getImm();
++OpNo; // Skip over the ID number.
- if (Modifier[0]=='l') // labels are target independent
- GetMBBSymbol(MI->getOperand(OpNo).getMBB()
- ->getNumber())->print(O, MAI);
+ if (Modifier[0] == 'l') // labels are target independent
+ O << *GetMBBSymbol(MI->getOperand(OpNo).getMBB()->getNumber());
else {
AsmPrinter *AP = const_cast<AsmPrinter*>(this);
if ((OpFlags & 7) == 4) {
@@ -1597,8 +1583,7 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
if (Error) {
std::string msg;
raw_string_ostream Msg(msg);
- Msg << "Invalid operand found in inline asm: '"
- << AsmStr << "'\n";
+ Msg << "Invalid operand found in inline asm: '" << AsmStr << "'\n";
MI->print(Msg);
llvm_report_error(Msg.str());
}
@@ -1734,8 +1719,8 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
// forward references to labels without knowing what their numbers
// will be.
if (MBB->hasAddressTaken()) {
- GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
- MBB->getBasicBlock())->print(O, MAI);
+ O << *GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
+ MBB->getBasicBlock());
O << ':';
if (VerboseAsm) {
O.PadToColumn(MAI->getCommentColumn());
@@ -1749,8 +1734,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
if (VerboseAsm)
O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
} else {
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
- O << ':';
+ O << *GetMBBSymbol(MBB->getNumber()) << ':';
if (!VerboseAsm)
O << '\n';
}
@@ -1777,9 +1761,9 @@ void AsmPrinter::printPICJumpTableSetLabel(unsigned uid,
return;
O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
- << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ',';
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
- O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
+ << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber() << ','
+ << *GetMBBSymbol(MBB->getNumber())
+ << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << uid << '\n';
}
@@ -1790,9 +1774,9 @@ void AsmPrinter::printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
<< getFunctionNumber() << '_' << uid << '_' << uid2
- << "_set_" << MBB->getNumber() << ',';
- GetMBBSymbol(MBB->getNumber())->print(O, MAI);
- O << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
+ << "_set_" << MBB->getNumber() << ','
+ << *GetMBBSymbol(MBB->getNumber())
+ << '-' << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << uid << '_' << uid2 << '\n';
}
@@ -1842,17 +1826,11 @@ void AsmPrinter::printDataDirective(const Type *type, unsigned AddrSpace) {
void AsmPrinter::printVisibility(const MCSymbol *Sym,
unsigned Visibility) const {
if (Visibility == GlobalValue::HiddenVisibility) {
- if (const char *Directive = MAI->getHiddenDirective()) {
- O << Directive;
- Sym->print(O, MAI);
- O << '\n';
- }
+ if (const char *Directive = MAI->getHiddenDirective())
+ O << Directive << *Sym << '\n';
} else if (Visibility == GlobalValue::ProtectedVisibility) {
- if (const char *Directive = MAI->getProtectedDirective()) {
- O << Directive;
- Sym->print(O, MAI);
- O << '\n';
- }
+ if (const char *Directive = MAI->getProtectedDirective())
+ O << Directive << *Sym << '\n';
}
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index a51ea2d7b2..ad6df15c44 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -231,26 +231,17 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
// Externally visible entry into the functions eh frame info. If the
// corresponding function is static, this should not be externally visible.
if (!TheFunc->hasLocalLinkage())
- if (const char *GlobalEHDirective = MAI->getGlobalEHDirective()) {
- O << GlobalEHDirective;
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << '\n';
- }
+ if (const char *GlobalEHDirective = MAI->getGlobalEHDirective())
+ O << GlobalEHDirective << *EHFrameInfo.FunctionEHSym << '\n';
// If corresponding function is weak definition, this should be too.
- if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective()) {
- O << MAI->getWeakDefDirective();
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << '\n';
- }
+ if (TheFunc->isWeakForLinker() && MAI->getWeakDefDirective())
+ O << MAI->getWeakDefDirective() << *EHFrameInfo.FunctionEHSym << '\n';
// If corresponding function is hidden, this should be too.
if (TheFunc->hasHiddenVisibility())
- if (const char *HiddenDirective = MAI->getHiddenDirective()) {
- O << HiddenDirective;
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << '\n';
- }
+ if (const char *HiddenDirective = MAI->getHiddenDirective())
+ O << HiddenDirective << *EHFrameInfo.FunctionEHSym << '\n';
// If there are no calls then you can't unwind. This may mean we can omit the
// EH Frame, but some environments do not handle weak absolute symbols. If
@@ -260,19 +251,14 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
(!TheFunc->isWeakForLinker() ||
!MAI->getWeakDefDirective() ||
MAI->getSupportsWeakOmittedEHFrame())) {
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << " = 0\n";
+ O << *EHFrameInfo.FunctionEHSym << " = 0\n";
// This name has no connection to the function, so it might get
// dead-stripped when the function is not, erroneously. Prohibit
// dead-stripping unconditionally.
- if (const char *UsedDirective = MAI->getUsedDirective()) {
- O << UsedDirective;
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << "\n\n";
- }
+ if (const char *UsedDirective = MAI->getUsedDirective())
+ O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
} else {
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << ":\n";
+ O << *EHFrameInfo.FunctionEHSym << ":\n";
// EH frame header.
EmitDifference("eh_frame_end", EHFrameInfo.Number,
@@ -344,9 +330,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
// link correctly. Yes, there really is.
if (MMI->isUsedFunction(EHFrameInfo.function))
if (const char *UsedDirective = MAI->getUsedDirective()) {
- O << UsedDirective;
- EHFrameInfo.FunctionEHSym->print(O, MAI);
- O << "\n\n";
+ O << UsedDirective << *EHFrameInfo.FunctionEHSym << "\n\n";
}
}
@@ -946,7 +930,7 @@ void DwarfException::EmitExceptionTable() {
PrintRelDirective();
if (GV) {
- Asm->GetGlobalValueSymbol(GV)->print(O, MAI);
+ O << *Asm->GetGlobalValueSymbol(GV);
} else {
O << "0x0";
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 7aca41ed1e..093b1960a6 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -79,7 +79,7 @@ void Dwarf::EmitReference(const std::string &Name, bool IsPCRelative,
void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
bool Force32Bit) const {
PrintRelDirective(Force32Bit);
- Sym->print(O, MAI);
+ O << *Sym;
if (IsPCRelative) O << "-" << MAI->getPCSymbol();
}
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index b6ebb1abbf..9e8c7ce59e 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -101,8 +101,7 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
assert(CurSection && "Cannot emit before setting section!");
- Symbol->print(OS, &MAI);
- OS << ":\n";
+ OS << *Symbol << ":\n";
Symbol->setSection(*CurSection);
}
@@ -119,8 +118,7 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
assert((Symbol->isUndefined() || Symbol->isAbsolute()) &&
"Cannot define a symbol twice!");
- Symbol->print(OS, &MAI);
- OS << " = ";
+ OS << *Symbol << " = ";
Value->print(OS, &MAI);
OS << '\n';
@@ -146,22 +144,16 @@ void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
case WeakReference: OS << ".weak_reference"; break;
}
- OS << ' ';
- Symbol->print(OS, &MAI);
- OS << '\n';
+ OS << ' ' << *Symbol << '\n';
}
void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
- OS << ".desc" << ' ';
- Symbol->print(OS, &MAI);
- OS << ',' << DescValue << '\n';
+ OS << ".desc" << ' ' << *Symbol << ',' << DescValue << '\n';
}
void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size,
unsigned ByteAlignment) {
- OS << ".comm ";
- Symbol->print(OS, &MAI);
- OS << ',' << Size;
+ OS << ".comm " << *Symbol << ',' << Size;
if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment);
OS << '\n';
@@ -177,9 +169,7 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
OS << MOSection->getSegmentName() << "," << MOSection->getSectionName();
if (Symbol != NULL) {
- OS << ',';
- Symbol->print(OS, &MAI);
- OS << ',' << Size;
+ OS << ',' << *Symbol << ',' << Size;
if (ByteAlignment != 0)
OS << ',' << Log2_32(ByteAlignment);
}
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp
index a19ec19bca..57d02c95f1 100644
--- a/lib/MC/MCExpr.cpp
+++ b/lib/MC/MCExpr.cpp
@@ -26,13 +26,10 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
// Parenthesize names that start with $ so that they don't look like
// absolute names.
- if (Sym.getName()[0] == '$') {
- OS << '(';
- Sym.print(OS, MAI);
- OS << ')';
- } else {
- Sym.print(OS, MAI);
- }
+ if (Sym.getName()[0] == '$')
+ OS << '(' << Sym << ')';
+ else
+ OS << Sym;
return;
}
diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp
index c20f4d0dbf..3fb12336c4 100644
--- a/lib/MC/MCSymbol.cpp
+++ b/lib/MC/MCSymbol.cpp
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCSymbol.h"
-#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -39,7 +38,7 @@ static bool NameNeedsQuoting(StringRef Str) {
return false;
}
-void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
+void MCSymbol::print(raw_ostream &OS) const {
// The name for this MCSymbol is required to be a valid target name. However,
// some targets support quoting names with funny characters. If the name
// contains a funny character, then print it quoted.
@@ -52,5 +51,5 @@ void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
}
void MCSymbol::dump() const {
- print(dbgs(), 0);
+ print(dbgs());
}
diff --git a/lib/MC/MCValue.cpp b/lib/MC/MCValue.cpp
index c1222ec887..043a49d80c 100644
--- a/lib/MC/MCValue.cpp
+++ b/lib/MC/MCValue.cpp
@@ -19,12 +19,10 @@ void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
return;
}
- getSymA()->print(OS, MAI);
+ OS << *getSymA();
- if (getSymB()) {
- OS << " - ";
- getSymB()->print(OS, MAI);
- }
+ if (getSymB())
+ OS << " - " << *getSymB();
if (getConstant())
OS << " + " << getConstant();
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");