mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-11 21:45:16 +00:00
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. llvm-svn: 215031
This commit is contained in:
parent
a8c5d79f89
commit
f0567dde14
@ -2528,14 +2528,25 @@ bool X86AsmParser::ParseDirective(AsmToken DirectiveID) {
|
|||||||
else if (IDVal.startswith(".code"))
|
else if (IDVal.startswith(".code"))
|
||||||
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
|
return ParseDirectiveCode(IDVal, DirectiveID.getLoc());
|
||||||
else if (IDVal.startswith(".att_syntax")) {
|
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);
|
getParser().setAssemblerDialect(0);
|
||||||
return false;
|
return false;
|
||||||
} else if (IDVal.startswith(".intel_syntax")) {
|
} else if (IDVal.startswith(".intel_syntax")) {
|
||||||
getParser().setAssemblerDialect(1);
|
getParser().setAssemblerDialect(1);
|
||||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||||
// FIXME: Handle noprefix
|
|
||||||
if (Parser.getTok().getString() == "noprefix")
|
if (Parser.getTok().getString() == "noprefix")
|
||||||
Parser.Lex();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7,3 +7,11 @@ _test:
|
|||||||
.att_syntax
|
.att_syntax
|
||||||
// CHECK: movl $257, -4(%rsp)
|
// CHECK: movl $257, -4(%rsp)
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user