aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2009-09-10 20:51:44 +0000
committerKevin Enderby <enderby@apple.com>2009-09-10 20:51:44 +0000
commit9c656450d65034c4cd3597fff61ef17376cff090 (patch)
tree020f8daa6c6b45a3d7339e93c495c69a18aecf80 /tools/llvm-mc
parent399e45b459c2904b9bd1927306670585ecec3378 (diff)
downloadexternal_llvm-9c656450d65034c4cd3597fff61ef17376cff090.zip
external_llvm-9c656450d65034c4cd3597fff61ef17376cff090.tar.gz
external_llvm-9c656450d65034c4cd3597fff61ef17376cff090.tar.bz2
Added the ParseInstruction() hook for target specific assembler directives so
that things like .word can be parsed as target specific. Moved parsing .word out of AsmParser.cpp into X86AsmParser.cpp as it is 2 bytes on X86 and 4 bytes for other targets that support the .word directive. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/AsmParser.cpp7
-rw-r--r--tools/llvm-mc/llvm-mc.cpp1
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index f51f43a..b1e8e9a 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -591,10 +591,9 @@ bool AsmParser::ParseStatement() {
if (IDVal == ".asciz")
return ParseDirectiveAscii(true);
- // FIXME: Target hooks for size? Also for "word", "hword".
if (IDVal == ".byte")
return ParseDirectiveValue(1);
- if (IDVal == ".short" || IDVal == ".word")
+ if (IDVal == ".short")
return ParseDirectiveValue(2);
if (IDVal == ".long")
return ParseDirectiveValue(4);
@@ -685,6 +684,10 @@ bool AsmParser::ParseStatement() {
if (IDVal == ".loc")
return ParseDirectiveLoc(IDLoc);
+ // Target hook for parsing target specific directives.
+ if (!getTargetParser().ParseDirective(ID))
+ return false;
+
Warning(IDLoc, "ignoring directive for now");
EatToEndOfStatement();
return false;
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index bf3c017..e5d99be 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -16,6 +16,7 @@
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
+#include "llvm/MC/MCAsmLexer.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Support/CommandLine.h"