[PATCH] D84900: [X86] Parse and ignore .arch directives
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 08:38:47 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd2c22487225b: [X86] Parse and ignore .arch directives (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84900/new/
https://reviews.llvm.org/D84900
Files:
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/test/MC/X86/directive-arch.s
Index: llvm/test/MC/X86/directive-arch.s
===================================================================
--- /dev/null
+++ llvm/test/MC/X86/directive-arch.s
@@ -0,0 +1,10 @@
+## We currently parse but ignore .arch directives.
+# RUN: llvm-mc -triple=x86_64 %s | FileCheck /dev/null --implicit-check-not=.arch
+
+.arch i286
+.arch generic32
+
+.arch .avx512vl
+.arch .noavx512bw
+.arch .nop
+.arch .sse4.2
Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -937,6 +937,7 @@
SMLoc End, unsigned Size, StringRef Identifier,
const InlineAsmIdentifierInfo &Info);
+ bool parseDirectiveArch();
bool parseDirectiveEven(SMLoc L);
bool ParseDirectiveCode(StringRef IDVal, SMLoc L);
@@ -3993,6 +3994,8 @@
bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
MCAsmParser &Parser = getParser();
StringRef IDVal = DirectiveID.getIdentifier();
+ if (IDVal.startswith(".arch"))
+ return parseDirectiveArch();
if (IDVal.startswith(".code"))
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
else if (IDVal.startswith(".att_syntax")) {
@@ -4047,6 +4050,12 @@
return true;
}
+bool X86AsmParser::parseDirectiveArch() {
+ // Ignore .arch for now.
+ getParser().parseStringToEndOfStatement();
+ return false;
+}
+
/// parseDirectiveEven
/// ::= .even
bool X86AsmParser::parseDirectiveEven(SMLoc L) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84900.281944.patch
Type: text/x-patch
Size: 1570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200730/3923a60c/attachment.bin>
More information about the llvm-commits
mailing list