aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-18 00:59:24 +0000
committerChris Lattner <sabre@nondot.org>2010-01-18 00:59:24 +0000
commit5957c84e09b177aecf8b430c33fd75a36575fb57 (patch)
treef5f82dd21aba22d23e308c86e61f9f1524e1a75d /lib
parent8cb9a3b13f3226b7e741768b69d26ecd6b5231f1 (diff)
downloadexternal_llvm-5957c84e09b177aecf8b430c33fd75a36575fb57.zip
external_llvm-5957c84e09b177aecf8b430c33fd75a36575fb57.tar.gz
external_llvm-5957c84e09b177aecf8b430c33fd75a36575fb57.tar.bz2
Change CurrentFnSym to be a non-const pointer since asmprinter mutates it
as it emits code. Switch .globl directives to use OutStreamer instead of doing it textually (in x86) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp28
-rw-r--r--lib/Target/X86/X86COFFMachineModuleInfo.cpp2
-rw-r--r--lib/Target/X86/X86COFFMachineModuleInfo.h2
3 files changed, 16 insertions, 16 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index 9409c0d..10d2e30 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -84,7 +84,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
break;
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
- O << "\t.globl\t" << *CurrentFnSym << '\n';
+ OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global);
break;
case Function::LinkerPrivateLinkage:
case Function::LinkOnceAnyLinkage:
@@ -92,11 +92,11 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
case Function::WeakAnyLinkage:
case Function::WeakODRLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl\t" << *CurrentFnSym << '\n';
+ OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global);
O << MAI->getWeakDefDirective() << *CurrentFnSym << '\n';
} else if (Subtarget->isTargetCygMing()) {
- O << "\t.globl\t" << *CurrentFnSym;
- O << "\n\t.linkonce discard\n";
+ OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global);
+ O << "\t.linkonce discard\n";
} else {
O << "\t.weak\t" << *CurrentFnSym << '\n';
}
@@ -215,7 +215,7 @@ void X86AsmPrinter::printSymbolOperand(const MachineOperand &MO) {
case MachineOperand::MO_GlobalAddress: {
const GlobalValue *GV = MO.getGlobal();
- const MCSymbol *GVSym;
+ MCSymbol *GVSym;
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB)
GVSym = GetSymbolWithGlobalValueBase(GV, "$stub");
else if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
@@ -351,7 +351,7 @@ void X86AsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
void X86AsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
- const char *Modifier) {
+ const char *Modifier) {
const MachineOperand &MO = MI->getOperand(OpNo);
switch (MO.getType()) {
default: llvm_unreachable("unknown operand type!");
@@ -686,7 +686,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
!TheSection->getKind().isMergeableCString()) {
if (GVar->hasExternalLinkage()) {
if (const char *Directive = MAI->getZeroFillDirective()) {
- O << "\t.globl " << *GVSym << '\n';
+ OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
O << Directive << "__DATA, __common, " << *GVSym;
O << ", " << Size << ", " << Align << '\n';
return;
@@ -703,7 +703,7 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
if (Subtarget->isTargetDarwin())
O << ',' << Align;
} else if (Subtarget->isTargetDarwin() && !GVar->hasCommonLinkage()) {
- O << "\t.globl " << *GVSym << '\n';
+ OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
O << MAI->getWeakDefDirective() << *GVSym << '\n';
EmitAlignment(Align, GVar);
O << *GVSym << ":";
@@ -747,11 +747,11 @@ void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkerPrivateLinkage:
if (Subtarget->isTargetDarwin()) {
- O << "\t.globl " << *GVSym << '\n';
+ OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
O << MAI->getWeakDefDirective() << *GVSym << '\n';
} else if (Subtarget->isTargetCygMing()) {
- O << "\t.globl\t" << *GVSym;
- O << "\n\t.linkonce same_size\n";
+ OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
+ O << "\t.linkonce same_size\n";
} else
O << "\t.weak\t" << *GVSym << '\n';
break;
@@ -761,8 +761,8 @@ 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 << '\n';
- // FALL THROUGH
+ OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global);
+ break;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
break;
@@ -876,7 +876,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I)
if (I->hasDLLExportLinkage()) {
- const MCSymbol *Sym = GetGlobalValueSymbol(I);
+ MCSymbol *Sym = GetGlobalValueSymbol(I);
COFFMMI.DecorateCygMingName(Sym, OutContext, I, *TM.getTargetData());
DLLExportedFns.push_back(Sym);
}
diff --git a/lib/Target/X86/X86COFFMachineModuleInfo.cpp b/lib/Target/X86/X86COFFMachineModuleInfo.cpp
index 07a1b38..ea52795 100644
--- a/lib/Target/X86/X86COFFMachineModuleInfo.cpp
+++ b/lib/Target/X86/X86COFFMachineModuleInfo.cpp
@@ -115,7 +115,7 @@ void X86COFFMachineModuleInfo::DecorateCygMingName(SmallVectorImpl<char> &Name,
/// DecorateCygMingName - Query FunctionInfoMap and use this information for
/// various name decorations for Cygwin and MingW.
-void X86COFFMachineModuleInfo::DecorateCygMingName(const MCSymbol *&Name,
+void X86COFFMachineModuleInfo::DecorateCygMingName(MCSymbol *&Name,
MCContext &Ctx,
const GlobalValue *GV,
const TargetData &TD) {
diff --git a/lib/Target/X86/X86COFFMachineModuleInfo.h b/lib/Target/X86/X86COFFMachineModuleInfo.h
index 2a9e61c..0e2009e 100644
--- a/lib/Target/X86/X86COFFMachineModuleInfo.h
+++ b/lib/Target/X86/X86COFFMachineModuleInfo.h
@@ -46,7 +46,7 @@ public:
~X86COFFMachineModuleInfo();
- void DecorateCygMingName(const MCSymbol* &Name, MCContext &Ctx,
+ void DecorateCygMingName(MCSymbol* &Name, MCContext &Ctx,
const GlobalValue *GV, const TargetData &TD);
void DecorateCygMingName(SmallVectorImpl<char> &Name, const GlobalValue *GV,
const TargetData &TD);