aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp')
-rw-r--r--lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp125
1 files changed, 0 insertions, 125 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index a095411..4a7e0fd 100644
--- a/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -646,131 +646,6 @@ void X86AsmPrinter::printMachineInstruction(const MachineInstr *MI) {
processDebugLoc(MI, false);
}
-void X86AsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
- MCSymbol *GVarSym = GetGlobalValueSymbol(GVar);
- printVisibility(GVarSym, GVar->getVisibility());
-
- if (MAI->hasDotTypeDotSizeDirective()) {
- O << "\t.type\t" << *GVarSym;
- if (MAI->getCommentString()[0] != '@')
- O << ",@object\n";
- else
- O << ",%object\n";
- }
-
- SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GVar, TM);
-
- const TargetData *TD = TM.getTargetData();
- unsigned Size = TD->getTypeAllocSize(GVar->getType()->getElementType());
- unsigned AlignLog = TD->getPreferredAlignmentLog(GVar);
-
- // Handle normal common symbols.
- if (GVKind.isCommon()) {
- if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
-
- O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
- if (MAI->getCOMMDirectiveTakesAlignment())
- O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << AlignLog) : AlignLog);
-
- if (VerboseAsm) {
- O << "\t\t" << MAI->getCommentString() << " '";
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- O << '\'';
- }
- O << '\n';
- return;
- }
-
- if (GVKind.isBSSLocal()) {
- if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
-
- if (const char *LComm = MAI->getLCOMMDirective()) {
- if (GVar->hasLocalLinkage()) {
- O << LComm << *GVarSym << ',' << Size;
- if (MAI->getLCOMMDirectiveTakesAlignment())
- O << ',' << AlignLog;
- }
- } else {
- O << "\t.local\t" << *GVarSym << '\n';
- O << MAI->getCOMMDirective() << *GVarSym << ',' << Size;
- if (MAI->getCOMMDirectiveTakesAlignment())
- O << ',' << (MAI->getAlignmentIsInBytes() ? (1 << AlignLog) : AlignLog);
- }
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << ' ';
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- }
- O << '\n';
- return;
- }
-
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM);
-
- // Handle the zerofill directive on darwin, which is a special form of BSS
- // emission.
- if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) {
- // .globl _foo
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- // .zerofill __DATA, __common, _foo, 400, 5
- OutStreamer.EmitZerofill(TheSection, GVarSym, Size, 1 << AlignLog);
- return;
- }
-
- OutStreamer.SwitchSection(TheSection);
-
- switch (GVar->getLinkage()) {
- case GlobalValue::CommonLinkage:
- case GlobalValue::LinkOnceAnyLinkage:
- case GlobalValue::LinkOnceODRLinkage:
- case GlobalValue::WeakAnyLinkage:
- case GlobalValue::WeakODRLinkage:
- case GlobalValue::LinkerPrivateLinkage:
- if (const char *WeakDef = MAI->getWeakDefDirective()) {
- // .globl _foo
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- // .weak_definition _foo
- O << WeakDef << *GVarSym << '\n';
- } else if (const char *LinkOnce = MAI->getLinkOnceDirective()) {
- // .globl _foo
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- // .linkonce same_size
- O << LinkOnce;
- } else
- O << "\t.weak\t" << *GVarSym << '\n';
- break;
- case GlobalValue::DLLExportLinkage:
- 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.
- // .globl _foo
- OutStreamer.EmitSymbolAttribute(GVarSym, MCStreamer::Global);
- break;
- case GlobalValue::PrivateLinkage:
- case GlobalValue::InternalLinkage:
- break;
- default:
- llvm_unreachable("Unknown linkage type!");
- }
-
- EmitAlignment(AlignLog, GVar);
- O << *GVarSym << ":";
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << ' ';
- WriteAsOperand(O, GVar, /*PrintType=*/false, GVar->getParent());
- }
- O << '\n';
-
- EmitGlobalConstant(GVar->getInitializer());
-
- if (MAI->hasDotTypeDotSizeDirective())
- O << "\t.size\t" << *GVarSym << ", " << Size << '\n';
-}
-
void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
if (Subtarget->isTargetDarwin()) {
// All darwin targets use mach-o.