mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-07 04:46:52 +00:00
[x86][ms-inline-asm] use of "jmp short" in asm is not supported
Committing in the name of Ziv Izhar: After check-all and LGTM . The following patch is for compatability with Microsoft. Microsoft ignores the keyword "short" when used after a jmp, for example: __asm { jmp short label label: } A test for that patch will be added in another patch, since it's located in clang's codegen tests. Link will be added shortly. link to test: https://reviews.llvm.org/D24958 Differential Revision: https://reviews.llvm.org/D24957 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284211 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cfa4f53d33
commit
e0043a340f
@ -2157,6 +2157,20 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
InstInfo = &Info;
|
||||
StringRef PatchedName = Name;
|
||||
|
||||
if (Name == "jmp" && isParsingIntelSyntax() && isParsingInlineAsm()) {
|
||||
StringRef NextTok = Parser.getTok().getString();
|
||||
if (NextTok == "short") {
|
||||
SMLoc NameEndLoc =
|
||||
NameLoc.getFromPointer(NameLoc.getPointer() + Name.size());
|
||||
// Eat the short keyword
|
||||
Parser.Lex();
|
||||
// MS ignores the short keyword, it determines the jmp type based
|
||||
// on the distance of the label
|
||||
InstInfo->AsmRewrites->emplace_back(AOK_Skip, NameEndLoc,
|
||||
NextTok.size() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Hack to recognize setneb as setne.
|
||||
if (PatchedName.startswith("set") && PatchedName.endswith("b") &&
|
||||
PatchedName != "setb" && PatchedName != "setnb")
|
||||
|
Loading…
x
Reference in New Issue
Block a user