From 685508cf494ee73690f77fc929382f53b157c1ca Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 23 Jan 2010 06:39:22 +0000 Subject: [PATCH] move the various directive enums out of the MCStreamer class into a new MCDirectives.h file. llvm-svn: 94294 --- llvm/include/llvm/MC/MCDirectives.h | 44 ++++++++++++++++ llvm/include/llvm/MC/MCParser/AsmParser.h | 2 +- llvm/include/llvm/MC/MCStreamer.h | 30 ++--------- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 28 +++++----- .../lib/CodeGen/AsmPrinter/DwarfException.cpp | 4 +- llvm/lib/MC/MCAsmStreamer.cpp | 38 +++++++------- llvm/lib/MC/MCMachOStreamer.cpp | 52 +++++++------------ llvm/lib/MC/MCNullStreamer.cpp | 4 +- llvm/lib/MC/MCParser/AsmParser.cpp | 28 +++++----- .../Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 2 +- .../PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 2 +- .../Target/X86/AsmPrinter/X86AsmPrinter.cpp | 8 +-- 12 files changed, 126 insertions(+), 116 deletions(-) create mode 100644 llvm/include/llvm/MC/MCDirectives.h diff --git a/llvm/include/llvm/MC/MCDirectives.h b/llvm/include/llvm/MC/MCDirectives.h new file mode 100644 index 000000000000..57ce75db4f06 --- /dev/null +++ b/llvm/include/llvm/MC/MCDirectives.h @@ -0,0 +1,44 @@ +//===- MCDirectives.h - Enums for directives on various targets -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines various enums that represent target-specific directives. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCDIRECTIVES_H +#define LLVM_MC_MCDIRECTIVES_H + +namespace llvm { + +enum MCSymbolAttr { + MCSA_Invalid = 0, /// Not a valid directive. + + // Various directives in alphabetical order. + MCSA_Global, /// .globl + MCSA_Hidden, /// .hidden (ELF) + MCSA_IndirectSymbol, /// .indirect_symbol (MachO) + MCSA_Internal, /// .internal (ELF) + MCSA_LazyReference, /// .lazy_reference (MachO) + MCSA_Local, /// .local (ELF) + MCSA_NoDeadStrip, /// .no_dead_strip (MachO) + MCSA_PrivateExtern, /// .private_extern (MachO) + MCSA_Protected, /// .protected (ELF) + MCSA_Reference, /// .reference (MachO) + MCSA_Weak, /// .weak + MCSA_WeakDefinition, /// .weak_definition (MachO) + MCSA_WeakReference /// .weak_reference (MachO) +}; + +enum MCAssemblerFlag { + MCAF_SubsectionsViaSymbols /// .subsections_via_symbols (MachO) +}; + +} // end namespace llvm + +#endif diff --git a/llvm/include/llvm/MC/MCParser/AsmParser.h b/llvm/include/llvm/MC/MCParser/AsmParser.h index 65cdc16155ed..f82584c8fc09 100644 --- a/llvm/include/llvm/MC/MCParser/AsmParser.h +++ b/llvm/include/llvm/MC/MCParser/AsmParser.h @@ -144,7 +144,7 @@ private: /// ParseDirectiveSymbolAttribute - Parse a directive like ".globl" which /// accepts a single symbol (which should be a label or an external). - bool ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr); + bool ParseDirectiveSymbolAttribute(MCSymbolAttr Attr); bool ParseDirectiveDarwinSymbolDesc(); // Darwin specific ".desc" bool ParseDirectiveDarwinLsym(); // Darwin specific ".lsym" diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index 3f567e998560..2e55f99df29d 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -15,6 +15,7 @@ #define LLVM_MC_MCSTREAMER_H #include "llvm/System/DataTypes.h" +#include "llvm/MC/MCDirectives.h" namespace llvm { class MCAsmInfo; @@ -40,31 +41,6 @@ namespace llvm { /// a .s file, and implementations that write out .o files of various formats. /// class MCStreamer { - public: - enum SymbolAttr { - Global, /// .globl - Hidden, /// .hidden (ELF) - IndirectSymbol, /// .indirect_symbol (Apple) - Internal, /// .internal (ELF) - LazyReference, /// .lazy_reference (Apple) - Local, /// .local (ELF) - NoDeadStrip, /// .no_dead_strip (Apple) - PrivateExtern, /// .private_extern (Apple) - Protected, /// .protected (ELF) - Reference, /// .reference (Apple) - Weak, /// .weak - WeakDefinition, /// .weak_definition (Apple) - WeakReference, /// .weak_reference (Apple) - - SymbolAttrFirst = Global, - SymbolAttrLast = WeakReference - }; - - enum AssemblerFlag { - SubsectionsViaSymbols /// .subsections_via_symbols (Apple) - }; - - private: MCContext &Context; MCStreamer(const MCStreamer&); // DO NOT IMPLEMENT @@ -128,7 +104,7 @@ namespace llvm { virtual void EmitLabel(MCSymbol *Symbol) = 0; /// EmitAssemblerFlag - Note in the output the specified @param Flag - virtual void EmitAssemblerFlag(AssemblerFlag Flag) = 0; + virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0; /// EmitAssignment - Emit an assignment of @param Value to @param Symbol. /// @@ -145,7 +121,7 @@ namespace llvm { /// EmitSymbolAttribute - Add the given @param Attribute to @param Symbol. virtual void EmitSymbolAttribute(MCSymbol *Symbol, - SymbolAttr Attribute) = 0; + MCSymbolAttr Attribute) = 0; /// EmitSymbolDesc - Set the @param DescValue for the @param Symbol. /// diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 6cdeb3bc0ebb..d27051390fcf 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -203,7 +203,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { } // .local _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Local); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Local); // .comm _foo, 42, 4 OutStreamer.EmitCommonSymbol(GVSym, Size, 1 << AlignLog); return; @@ -216,7 +216,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { // emission. if (GVKind.isBSSExtern() && MAI->hasMachoZeroFillDirective()) { // .globl _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); // .zerofill __DATA, __common, _foo, 400, 5 OutStreamer.EmitZerofill(TheSection, GVSym, Size, 1 << AlignLog); return; @@ -235,17 +235,17 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { case GlobalValue::LinkerPrivateLinkage: if (MAI->getWeakDefDirective() != 0) { // .globl _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); // .weak_definition _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::WeakDefinition); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_WeakDefinition); } else if (const char *LinkOnce = MAI->getLinkOnceDirective()) { // .globl _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); // .linkonce same_size O << LinkOnce; } else { // .weak _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Weak); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Weak); } break; case GlobalValue::DLLExportLinkage: @@ -255,7 +255,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) { case GlobalValue::ExternalLinkage: // If external or appending, declare as a global symbol. // .globl _foo - OutStreamer.EmitSymbolAttribute(GVSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global); break; case GlobalValue::PrivateLinkage: case GlobalValue::InternalLinkage: @@ -303,13 +303,13 @@ bool AsmPrinter::doFinalization(Module &M) { I != E; ++I) { if (!I->hasExternalWeakLinkage()) continue; OutStreamer.EmitSymbolAttribute(GetGlobalValueSymbol(I), - MCStreamer::WeakReference); + MCSA_WeakReference); } for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) { if (!I->hasExternalWeakLinkage()) continue; OutStreamer.EmitSymbolAttribute(GetGlobalValueSymbol(I), - MCStreamer::WeakReference); + MCSA_WeakReference); } } @@ -323,9 +323,9 @@ bool AsmPrinter::doFinalization(Module &M) { MCSymbol *Target = GetGlobalValueSymbol(GV); if (I->hasExternalLinkage() || !MAI->getWeakRefDirective()) - OutStreamer.EmitSymbolAttribute(Name, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(Name, MCSA_Global); else if (I->hasWeakLinkage()) - OutStreamer.EmitSymbolAttribute(Name, MCStreamer::WeakReference); + OutStreamer.EmitSymbolAttribute(Name, MCSA_WeakReference); else assert(I->hasLocalLinkage() && "Invalid alias linkage"); @@ -601,7 +601,7 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) { MAI->hasStaticCtorDtorReferenceInStaticMode()) { StringRef Sym(".constructors_used"); OutStreamer.EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym), - MCStreamer::Reference); + MCSA_Reference); } return true; } @@ -615,7 +615,7 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) { MAI->hasStaticCtorDtorReferenceInStaticMode()) { StringRef Sym(".destructors_used"); OutStreamer.EmitSymbolAttribute(OutContext.GetOrCreateSymbol(Sym), - MCStreamer::Reference); + MCSA_Reference); } return true; } @@ -636,7 +636,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) { dyn_cast(InitList->getOperand(i)->stripPointerCasts()); if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, Mang)) OutStreamer.EmitSymbolAttribute(GetGlobalValueSymbol(GV), - MCStreamer::NoDeadStrip); + MCSA_NoDeadStrip); } } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp index 1b72f73fb1d7..fd3dbf5cf18f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -247,7 +247,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { // dead-stripping unconditionally. if (MAI->hasNoDeadStrip()) Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym, - MCStreamer::NoDeadStrip); + MCSA_NoDeadStrip); } else { O << *EHFrameInfo.FunctionEHSym << ":\n"; @@ -316,7 +316,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { if (MMI->isUsedFunction(EHFrameInfo.function)) if (MAI->hasNoDeadStrip()) Asm->OutStreamer.EmitSymbolAttribute(EHFrameInfo.FunctionEHSym, - MCStreamer::NoDeadStrip); + MCSA_NoDeadStrip); } Asm->O << '\n'; } diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index b0e9705f0a7c..ded2b42bd8c1 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -85,11 +85,11 @@ public: virtual void EmitLabel(MCSymbol *Symbol); - virtual void EmitAssemblerFlag(AssemblerFlag Flag); + virtual void EmitAssemblerFlag(MCAssemblerFlag Flag); virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); - virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); + virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute); virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue); @@ -195,10 +195,10 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) { Symbol->setSection(*CurSection); } -void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) { +void MCAsmStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { switch (Flag) { default: assert(0 && "Invalid flag!"); - case SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break; + case MCAF_SubsectionsViaSymbols: OS << ".subsections_via_symbols"; break; } EmitEOL(); } @@ -217,21 +217,23 @@ void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { } void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, - SymbolAttr Attribute) { + MCSymbolAttr Attribute) { switch (Attribute) { - case Global: OS << MAI.getGlobalDirective(); break; // .globl - case Hidden: OS << ".hidden "; break; - case IndirectSymbol: OS << ".indirect_symbol "; break; - case Internal: OS << ".internal "; break; - case LazyReference: OS << ".lazy_reference "; break; - case Local: OS << ".local "; break; - case NoDeadStrip: OS << ".no_dead_strip "; break; - case PrivateExtern: OS << ".private_extern "; break; - case Protected: OS << ".protected "; break; - case Reference: OS << ".reference "; break; - case Weak: OS << ".weak "; break; - case WeakDefinition: OS << ".weak_definition "; break; - case WeakReference: OS << MAI.getWeakRefDirective(); break;// .weak_reference + case MCSA_Invalid: assert(0 && "Invalid symbol attribute"); + case MCSA_Global: OS << MAI.getGlobalDirective(); break; // .globl + case MCSA_Hidden: OS << ".hidden "; break; + case MCSA_IndirectSymbol: OS << ".indirect_symbol "; break; + case MCSA_Internal: OS << ".internal "; break; + case MCSA_LazyReference: OS << ".lazy_reference "; break; + case MCSA_Local: OS << ".local "; break; + case MCSA_NoDeadStrip: OS << ".no_dead_strip "; break; + case MCSA_PrivateExtern: OS << ".private_extern "; break; + case MCSA_Protected: OS << ".protected "; break; + case MCSA_Reference: OS << ".reference "; break; + case MCSA_Weak: OS << ".weak "; break; + case MCSA_WeakDefinition: OS << ".weak_definition "; break; + // .weak_reference + case MCSA_WeakReference: OS << MAI.getWeakRefDirective(); break; } OS << *Symbol; diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index 4ed8ec3521cc..14301824ba8b 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -117,36 +117,23 @@ public: /// @{ virtual void SwitchSection(const MCSection *Section); - virtual void EmitLabel(MCSymbol *Symbol); - - virtual void EmitAssemblerFlag(AssemblerFlag Flag); - + virtual void EmitAssemblerFlag(MCAssemblerFlag Flag); virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); - - virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); - + virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute); virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue); - virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, unsigned ByteAlignment); - virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned ByteAlignment = 0); - virtual void EmitBytes(StringRef Data, unsigned AddrSpace); - virtual void EmitValue(const MCExpr *Value, unsigned Size,unsigned AddrSpace); - virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0); - virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); - virtual void EmitInstruction(const MCInst &Inst); - virtual void Finish(); /// @} @@ -183,9 +170,9 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) { Symbol->setSection(*CurSection); } -void MCMachOStreamer::EmitAssemblerFlag(AssemblerFlag Flag) { +void MCMachOStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { switch (Flag) { - case SubsectionsViaSymbols: + case MCAF_SubsectionsViaSymbols: Assembler.setSubsectionsViaSymbols(true); return; } @@ -204,10 +191,10 @@ void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { } void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, - SymbolAttr Attribute) { + MCSymbolAttr Attribute) { // Indirect symbols are handled differently, to match how 'as' handles // them. This makes writing matching .o files easier. - if (Attribute == MCStreamer::IndirectSymbol) { + if (Attribute == MCSA_IndirectSymbol) { // Note that we intentionally cannot use the symbol data here; this is // important for matching the string table that 'as' generates. IndirectSymbolData ISD; @@ -229,20 +216,21 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, // In the future it might be worth trying to make these operations more well // defined. switch (Attribute) { - case MCStreamer::IndirectSymbol: - case MCStreamer::Hidden: - case MCStreamer::Internal: - case MCStreamer::Protected: - case MCStreamer::Weak: - case MCStreamer::Local: + case MCSA_Invalid: + case MCSA_IndirectSymbol: + case MCSA_Hidden: + case MCSA_Internal: + case MCSA_Protected: + case MCSA_Weak: + case MCSA_Local: assert(0 && "Invalid symbol attribute for Mach-O!"); break; - case MCStreamer::Global: + case MCSA_Global: SD.setExternal(true); break; - case MCStreamer::LazyReference: + case MCSA_LazyReference: // FIXME: This requires -dynamic. SD.setFlags(SD.getFlags() | SF_NoDeadStrip); if (Symbol->isUndefined()) @@ -251,23 +239,23 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, // Since .reference sets the no dead strip bit, it is equivalent to // .no_dead_strip in practice. - case MCStreamer::Reference: - case MCStreamer::NoDeadStrip: + case MCSA_Reference: + case MCSA_NoDeadStrip: SD.setFlags(SD.getFlags() | SF_NoDeadStrip); break; - case MCStreamer::PrivateExtern: + case MCSA_PrivateExtern: SD.setExternal(true); SD.setPrivateExtern(true); break; - case MCStreamer::WeakReference: + case MCSA_WeakReference: // FIXME: This requires -dynamic. if (Symbol->isUndefined()) SD.setFlags(SD.getFlags() | SF_WeakReference); break; - case MCStreamer::WeakDefinition: + case MCSA_WeakDefinition: // FIXME: 'as' enforces that this is defined and global. The manual claims // it has to be in a coalesced section, but this isn't enforced. SD.setFlags(SD.getFlags() | SF_WeakDefinition); diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp index b1357926f1fd..46da4c4f9ced 100644 --- a/llvm/lib/MC/MCNullStreamer.cpp +++ b/llvm/lib/MC/MCNullStreamer.cpp @@ -31,11 +31,11 @@ namespace { virtual void EmitLabel(MCSymbol *Symbol) {} - virtual void EmitAssemblerFlag(AssemblerFlag Flag) {} + virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) {} virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {} - virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) {} + virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){} virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {} diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index e311400d7862..dd438b76124f 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -702,29 +702,29 @@ bool AsmParser::ParseStatement() { // Symbol attribute directives if (IDVal == ".globl" || IDVal == ".global") - return ParseDirectiveSymbolAttribute(MCStreamer::Global); + return ParseDirectiveSymbolAttribute(MCSA_Global); if (IDVal == ".hidden") - return ParseDirectiveSymbolAttribute(MCStreamer::Hidden); + return ParseDirectiveSymbolAttribute(MCSA_Hidden); if (IDVal == ".indirect_symbol") - return ParseDirectiveSymbolAttribute(MCStreamer::IndirectSymbol); + return ParseDirectiveSymbolAttribute(MCSA_IndirectSymbol); if (IDVal == ".internal") - return ParseDirectiveSymbolAttribute(MCStreamer::Internal); + return ParseDirectiveSymbolAttribute(MCSA_Internal); if (IDVal == ".lazy_reference") - return ParseDirectiveSymbolAttribute(MCStreamer::LazyReference); + return ParseDirectiveSymbolAttribute(MCSA_LazyReference); if (IDVal == ".no_dead_strip") - return ParseDirectiveSymbolAttribute(MCStreamer::NoDeadStrip); + return ParseDirectiveSymbolAttribute(MCSA_NoDeadStrip); if (IDVal == ".private_extern") - return ParseDirectiveSymbolAttribute(MCStreamer::PrivateExtern); + return ParseDirectiveSymbolAttribute(MCSA_PrivateExtern); if (IDVal == ".protected") - return ParseDirectiveSymbolAttribute(MCStreamer::Protected); + return ParseDirectiveSymbolAttribute(MCSA_Protected); if (IDVal == ".reference") - return ParseDirectiveSymbolAttribute(MCStreamer::Reference); + return ParseDirectiveSymbolAttribute(MCSA_Reference); if (IDVal == ".weak") - return ParseDirectiveSymbolAttribute(MCStreamer::Weak); + return ParseDirectiveSymbolAttribute(MCSA_Weak); if (IDVal == ".weak_definition") - return ParseDirectiveSymbolAttribute(MCStreamer::WeakDefinition); + return ParseDirectiveSymbolAttribute(MCSA_WeakDefinition); if (IDVal == ".weak_reference") - return ParseDirectiveSymbolAttribute(MCStreamer::WeakReference); + return ParseDirectiveSymbolAttribute(MCSA_WeakReference); if (IDVal == ".comm") return ParseDirectiveComm(/*IsLocal=*/false); @@ -1238,7 +1238,7 @@ bool AsmParser::ParseDirectiveAlign(bool IsPow2, unsigned ValueSize) { /// ParseDirectiveSymbolAttribute /// ::= { ".globl", ".weak", ... } [ identifier ( , identifier )* ] -bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) { +bool AsmParser::ParseDirectiveSymbolAttribute(MCSymbolAttr Attr) { if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { StringRef Name; @@ -1463,7 +1463,7 @@ bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() { Lex(); - Out.EmitAssemblerFlag(MCStreamer::SubsectionsViaSymbols); + Out.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); return false; } diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 855b5c530aac..5aa7d98da27f 100644 --- a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -1205,7 +1205,7 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) { // implementation of multiple entry points). If this doesn't occur, the // linker can safely perform dead code stripping. Since LLVM never // generates code that does this, it is always safe to set. - OutStreamer.EmitAssemblerFlag(MCStreamer::SubsectionsViaSymbols); + OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); } } diff --git a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 67ec2edb3237..b89c2b48721d 100644 --- a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -968,7 +968,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) { // implementation of multiple entry points). If this doesn't occur, the // linker can safely perform dead code stripping. Since LLVM never generates // code that does this, it is always safe to set. - OutStreamer.EmitAssemblerFlag(MCStreamer::SubsectionsViaSymbols); + OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); return AsmPrinter::doFinalization(M); } diff --git a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp index 74cce8a1ff87..2ffa18ff5ac9 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp @@ -84,7 +84,7 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { break; case Function::DLLExportLinkage: case Function::ExternalLinkage: - OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global); break; case Function::LinkerPrivateLinkage: case Function::LinkOnceAnyLinkage: @@ -92,10 +92,10 @@ void X86AsmPrinter::emitFunctionHeader(const MachineFunction &MF) { case Function::WeakAnyLinkage: case Function::WeakODRLinkage: if (Subtarget->isTargetDarwin()) { - OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global); O << MAI->getWeakDefDirective() << *CurrentFnSym << '\n'; } else if (Subtarget->isTargetCygMing()) { - OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCStreamer::Global); + OutStreamer.EmitSymbolAttribute(CurrentFnSym, MCSA_Global); O << "\t.linkonce discard\n"; } else { O << "\t.weak\t" << *CurrentFnSym << '\n'; @@ -709,7 +709,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) { // implementation of multiple entry points). If this doesn't occur, the // linker can safely perform dead code stripping. Since LLVM never // generates code that does this, it is always safe to set. - OutStreamer.EmitAssemblerFlag(MCStreamer::SubsectionsViaSymbols); + OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); } if (Subtarget->isTargetCOFF()) {