[llvm-commits] [llvm] r75500 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp test/MC/AsmParser/directive_subsections_via_symbols.s tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h
Kevin Enderby
enderby at apple.com
Mon Jul 13 14:03:15 PDT 2009
Author: enderby
Date: Mon Jul 13 16:03:15 2009
New Revision: 75500
URL: http://llvm.org/viewvc/llvm-project?rev=75500&view=rev
Log:
add llvm-mc support for parsing the .subsections_via_symbols directive.
Added:
llvm/trunk/test/MC/AsmParser/directive_subsections_via_symbols.s
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=75500&r1=75499&r2=75500&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Mon Jul 13 16:03:15 2009
@@ -89,6 +89,11 @@
// symbol section in the constructor and initialize it here?
virtual void EmitLabel(MCSymbol *Symbol) = 0;
+ /// SubsectionsViaSymbols - Note in the output that the conventions used in
+ /// in the assembly file allows the bytes of a section to be divided up at
+ /// the boundaries of the symbols by a link editor for processing as atoms.
+ virtual void SubsectionsViaSymbols(void) = 0;
+
/// EmitAssignment - Emit an assignment of @param Value to @param Symbol.
///
/// This corresponds to an assembler statement such as:
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=75500&r1=75499&r2=75500&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Mon Jul 13 16:03:15 2009
@@ -38,6 +38,8 @@
virtual void EmitLabel(MCSymbol *Symbol);
+ virtual void SubsectionsViaSymbols(void);
+
virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
bool MakeAbsolute = false);
@@ -117,6 +119,10 @@
Symbol->setExternal(false);
}
+void MCAsmStreamer::SubsectionsViaSymbols(void) {
+ OS << ".subsections_via_symbols\n";
+}
+
void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value,
bool MakeAbsolute) {
assert(!Symbol->getSection() && "Cannot assign to a label!");
Added: llvm/trunk/test/MC/AsmParser/directive_subsections_via_symbols.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_subsections_via_symbols.s?rev=75500&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_subsections_via_symbols.s (added)
+++ llvm/trunk/test/MC/AsmParser/directive_subsections_via_symbols.s Mon Jul 13 16:03:15 2009
@@ -0,0 +1,6 @@
+# RUN: llvm-mc %s | FileCheck %s
+
+# CHECK: TEST0:
+# CHECK: .subsections_via_symbols
+TEST0:
+ .subsections_via_symbols
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=75500&r1=75499&r2=75500&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jul 13 16:03:15 2009
@@ -527,6 +527,9 @@
if (!strcmp(IDVal, ".zerofill"))
return ParseDirectiveDarwinZerofill();
+ if (!strcmp(IDVal, ".subsections_via_symbols"))
+ return ParseDirectiveDarwinSubsectionsViaSymbols();
+
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
return false;
@@ -1052,3 +1055,16 @@
return false;
}
+
+/// ParseDirectiveDarwinSubsectionsViaSymbols
+/// ::= .subsections_via_symbols
+bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() {
+ if (Lexer.isNot(asmtok::EndOfStatement))
+ return TokError("unexpected token in '.subsections_via_symbols' directive");
+
+ Lexer.Lex();
+
+ Out.SubsectionsViaSymbols();
+
+ return false;
+}
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=75500&r1=75499&r2=75500&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Jul 13 16:03:15 2009
@@ -112,6 +112,9 @@
bool ParseDirectiveComm(bool IsLocal); // ".comm" and ".lcomm"
bool ParseDirectiveDarwinZerofill(); // Darwin specific ".zerofill"
+
+ // Darwin specific ".subsections_via_symbols"
+ bool ParseDirectiveDarwinSubsectionsViaSymbols();
};
} // end namespace llvm
More information about the llvm-commits
mailing list