[PATCH] D125582: [llvm-ml] Add support for extern proc
Alan Zhao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 14:07:31 PDT 2022
ayzhao updated this revision to Diff 429350.
ayzhao added a comment.
move label outside ifdef
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125582/new/
https://reviews.llvm.org/D125582
Files:
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/tools/llvm-ml/extern.asm
llvm/test/tools/llvm-ml/indirect_branch.asm
Index: llvm/test/tools/llvm-ml/indirect_branch.asm
===================================================================
--- llvm/test/tools/llvm-ml/indirect_branch.asm
+++ llvm/test/tools/llvm-ml/indirect_branch.asm
@@ -6,6 +6,8 @@
else
extern fn_ref_extern : dword
endif
+
+extern fn_proc_extern : proc
extern fn_ref_extern_word : word
.data
@@ -248,3 +250,31 @@
; CHECK-32: call word ptr [fn_ref_extern_word]
; CHECK-32-NEXT: jmp word ptr [fn_ref_extern_word]
endif
+
+t23:
+call fn_proc_extern
+jmp fn_proc_extern
+; CHECK-LABEL: t23:
+; CHECK: call fn_proc_extern
+
+t24:
+call [fn_proc_extern]
+jmp [fn_proc_extern]
+; CHECK-LABEL: t24:
+; CHECK: call fn_proc_extern
+
+t25:
+; CHECK-LABEL: t25:
+ifdef rax
+ call qword ptr [fn_ref_extern]
+ jmp qword ptr [fn_ref_extern]
+ ; CHECK-64: call qword ptr [rip + fn_ref_extern]
+ ; CHECK-64: jmp qword ptr [rip + fn_ref_extern]
+else
+ call dword ptr [fn_ref_extern]
+ jmp dword ptr [fn_ref_extern]
+ ; CHECK-32: call dword ptr [fn_ref_extern]
+ ; CHECK-32: jmp dword ptr [fn_ref_extern]
+endif
+
+end
Index: llvm/test/tools/llvm-ml/extern.asm
===================================================================
--- llvm/test/tools/llvm-ml/extern.asm
+++ llvm/test/tools/llvm-ml/extern.asm
@@ -1,9 +1,10 @@
; RUN: llvm-ml -m32 -filetype=s %s /Fo - | FileCheck %s --check-prefixes=CHECK,CHECK-32
; RUN: llvm-ml -m64 -filetype=s %s /Fo - | FileCheck %s --check-prefixes=CHECK,CHECK-64
-extern foo : dword, bar : word
+extern foo : dword, bar : word, baz : proc
; CHECK: .extern foo
; CHECK: .extern bar
+; CHECK: .extern baz
.code
mov ebx, foo
Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -6034,10 +6034,12 @@
SMLoc TypeLoc = getTok().getLoc();
if (parseIdentifier(TypeName))
return Error(TypeLoc, "expected type");
- AsmTypeInfo Type;
- if (lookUpType(TypeName, Type))
- return Error(TypeLoc, "unrecognized type");
- KnownType[Name.lower()] = Type;
+ if (!TypeName.equals_insensitive("proc")) {
+ AsmTypeInfo Type;
+ if (lookUpType(TypeName, Type))
+ return Error(TypeLoc, "unrecognized type");
+ KnownType[Name.lower()] = Type;
+ }
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
Sym->setExternal(true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125582.429350.patch
Type: text/x-patch
Size: 2413 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220513/0d56a299/attachment.bin>
More information about the llvm-commits
mailing list