[llvm] r215031 - MC X86: Accept ".att_syntax prefix" and diagnose noprefix
Reid Kleckner
reid at kleckner.net
Wed Aug 6 16:21:13 PDT 2014
Author: rnk
Date: Wed Aug 6 18:21:13 2014
New Revision: 215031
URL: http://llvm.org/viewvc/llvm-project?rev=215031&view=rev
Log:
MC X86: Accept ".att_syntax prefix" and diagnose noprefix
Fixes PR18916. I don't think we need to implement support for either
hybrid syntax. Nobody should write Intel assembly with '%' prefixes on
their registers or AT&T assembly without them.
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/intel-syntax-2.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=215031&r1=215030&r2=215031&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Wed Aug 6 18:21:13 2014
@@ -2528,14 +2528,25 @@ bool X86AsmParser::ParseDirective(AsmTok
else if (IDVal.startswith(".code"))
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
else if (IDVal.startswith(".att_syntax")) {
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ if (Parser.getTok().getString() == "prefix")
+ Parser.Lex();
+ else if (Parser.getTok().getString() == "noprefix")
+ return Error(DirectiveID.getLoc(), "'.att_syntax noprefix' is not "
+ "supported: registers must have a "
+ "'%' prefix in .att_syntax");
+ }
getParser().setAssemblerDialect(0);
return false;
} else if (IDVal.startswith(".intel_syntax")) {
getParser().setAssemblerDialect(1);
if (getLexer().isNot(AsmToken::EndOfStatement)) {
- // FIXME: Handle noprefix
if (Parser.getTok().getString() == "noprefix")
Parser.Lex();
+ else if (Parser.getTok().getString() == "prefix")
+ return Error(DirectiveID.getLoc(), "'.intel_syntax prefix' is not "
+ "supported: registers must not have "
+ "a '%' prefix in .intel_syntax");
}
return false;
}
Modified: llvm/trunk/test/MC/X86/intel-syntax-2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/intel-syntax-2.s?rev=215031&r1=215030&r2=215031&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/intel-syntax-2.s (original)
+++ llvm/trunk/test/MC/X86/intel-syntax-2.s Wed Aug 6 18:21:13 2014
@@ -7,3 +7,11 @@ _test:
.att_syntax
// CHECK: movl $257, -4(%rsp)
movl $257, -4(%rsp)
+
+_test2:
+.intel_syntax noprefix
+ mov DWORD PTR [RSP - 4], 255
+// CHECK: movl $255, -4(%rsp)
+.att_syntax prefix
+ movl $255, -4(%rsp)
+// CHECK: movl $255, -4(%rsp)
More information about the llvm-commits
mailing list