[PATCH] D34739: [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides
coby via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 00:05:35 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308866: [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when theā¦ (authored by coby).
Changed prior to commit:
https://reviews.llvm.org/D34739?vs=104350&id=107850#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34739
Files:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
Index: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -944,7 +944,8 @@
EndLoc = Tok.getEndLoc();
if (Tok.isNot(AsmToken::Identifier)) {
- if (isParsingIntelSyntax()) return true;
+ if (isParsingIntelSyntax())
+ return true;
return Error(StartLoc, "invalid register name",
SMRange(StartLoc, EndLoc));
}
@@ -955,6 +956,16 @@
if (RegNo == 0)
RegNo = MatchRegisterName(Tok.getString().lower());
+ // In MS inline-asm we allow variables to be named as registers, and
+ // give them precedence over actual registers
+ // However - we require the match to be case sensitive
+ if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo) {
+ StringRef LineBuf(Tok.getIdentifier().data());
+ InlineAsmIdentifierInfo Info;
+ if (SemaCallback->LookupInlineAsmIdentifier(LineBuf, Info, false))
+ return true;
+ }
+
// The "flags" register cannot be referenced directly.
// Treat it as an identifier instead.
if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo == X86::EFLAGS)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34739.107850.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170724/6eeb6dee/attachment.bin>
More information about the llvm-commits
mailing list