llvm.org GIT mirror llvm / e0043a3
[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 Michael Zuckerman 4 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
21562156 InstInfo = &Info;
21572157 StringRef PatchedName = Name;
21582158
2159 if (Name == "jmp" && isParsingIntelSyntax() && isParsingInlineAsm()) {
2160 StringRef NextTok = Parser.getTok().getString();
2161 if (NextTok == "short") {
2162 SMLoc NameEndLoc =
2163 NameLoc.getFromPointer(NameLoc.getPointer() + Name.size());
2164 // Eat the short keyword
2165 Parser.Lex();
2166 // MS ignores the short keyword, it determines the jmp type based
2167 // on the distance of the label
2168 InstInfo->AsmRewrites->emplace_back(AOK_Skip, NameEndLoc,
2169 NextTok.size() + 1);
2170 }
2171 }
2172
21592173 // FIXME: Hack to recognize setneb as setne.
21602174 if (PatchedName.startswith("set") && PatchedName.endswith("b") &&
21612175 PatchedName != "setb" && PatchedName != "setnb")