aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);