[PATCH] ms-inline-asm: Add facilities for rewriting labels in X86AsmParser
Reid Kleckner
rnk at google.com
Fri Jul 18 12:39:50 PDT 2014
================
Comment at: include/llvm/MC/MCParser/MCAsmParser.h:57
@@ -54,2 +56,3 @@
bool IsUnevaluatedContext) = 0;
+ virtual void LookupInlineAsmLabel(StringRef &Identifier, SourceMgr &SM, SMLoc Location) = 0;
----------------
It's generally nicer to avoid having API breakage between LLVM in clang if it can be avoided. In this case, I'd give this a no-op implementation that clang overrides instead of a pure virtual method which will break the clang build for a few revisions when this lands.
================
Comment at: lib/MC/MCParser/AsmParser.cpp:4620
@@ +4619,3 @@
+ case AOK_Identifier:
+ OS << AR.Identifier;
+ break;
----------------
This should really be making an local label that doesn't make it into the object file. MC should know what the local label prefix is. It's usually 'L', I think.
If you add the prefix here, then maybe this should be AOK_Label or something.
================
Comment at: lib/Target/X86/AsmParser/X86AsmParser.cpp:1305
@@ +1304,3 @@
+
+ // If the identifier lookup was unsuccessful, assume that we are dealing with
+ // a label.
----------------
What does MSVC do in this case? I assume it uses the opposite logic for this code:
void foo();
void __declspec(naked) bar() {
__asm {
foo:
jmp foo ; probably infinite loops instead of tail calling bar.
}
}
I guess this is the hard case:
void foo();
void __declspec(naked) bar() {
__asm {
test ecx, ecx
xor eax, eax
jz foo
mov eax 1
foo:
ret
}
http://reviews.llvm.org/D4587
More information about the llvm-commits
mailing list