summaryrefslogtreecommitdiff
path: root/lib/MC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-23 06:39:22 +0000
committerChris Lattner <sabre@nondot.org>2010-01-23 06:39:22 +0000
commita5ad93a10a5435f21090b09edb6b3a7e44967648 (patch)
treeef70d3d7e9c5622f26c42d8cda83e5abfe0af76c /lib/MC
parent52492ac0d03aa86b07ad889b69b0ba38ffec8011 (diff)
downloadllvm-a5ad93a10a5435f21090b09edb6b3a7e44967648.tar.gz
llvm-a5ad93a10a5435f21090b09edb6b3a7e44967648.tar.bz2
llvm-a5ad93a10a5435f21090b09edb6b3a7e44967648.tar.xz
move the various directive enums out of the MCStreamer class
into a new MCDirectives.h file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r--lib/MC/MCAsmStreamer.cpp38
-rw-r--r--lib/MC/MCMachOStreamer.cpp52
-rw-r--r--lib/MC/MCNullStreamer.cpp4
-rw-r--r--lib/MC/MCParser/AsmParser.cpp28
4 files changed, 56 insertions, 66 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index b0e9705f0a..ded2b42bd8 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/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/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index 4ed8ec3521..14301824ba 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/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/lib/MC/MCNullStreamer.cpp b/lib/MC/MCNullStreamer.cpp
index b1357926f1..46da4c4f9c 100644
--- a/lib/MC/MCNullStreamer.cpp
+++ b/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/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index e311400d78..dd438b7612 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/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;
}