[PATCH] D120887: The [2/3] Fix mangle problem when variable used in inline asm (non-rip for ARR[BaseReg+IndexReg+..])
Xiang Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 15 18:12:14 PDT 2022
xiangzhangllvm added a comment.
I'll update this patch and commit the [3/3] patch soon. Thanks!
================
Comment at: clang/test/CodeGen/ms-inline-asm-variables.c:6-12
// CHECK: add eax, dword ptr ${{[0-9]}}[eax]
__asm add eax, dword ptr gVar[eax]
// CHECK: add dword ptr ${{[0-9]}}[eax], eax
__asm add dword ptr [eax+gVar], eax
// CHECK: add ebx, dword ptr ${{[0-9]}}[ebx + $$270]
__asm add ebx, dword ptr gVar[271 - 82 + 81 + ebx]
// CHECK: add dword ptr ${{[0-9]}}[ebx + $$828], ebx
----------------
pengfei wrote:
> Should these change to `${{{[0-9]}}:P}` too?
Currently Modifier ":P" is only need for function call or GV with both baseReg and IndexReg.
For one reg case, for example
```
"__asm {mov DWORD PTR GArr[rax*2+2], 4};"
```
current llvm has ability to handle it by split into 2 steps:
```
mov ecx, dword ptr [eax + GArr at GOT]
mov dword ptr [ecx + 2*eax + GArr+22], 4
```
================
Comment at: clang/test/CodeGen/ms-inline-asm-variables.c:24-33
// CHECK: mov eax, dword ptr ${{[0-9]}}[eax]
__asm mov eax, dword ptr lVar[eax]
// CHECK: mov dword ptr ${{[0-9]}}[eax], eax
__asm mov dword ptr [eax+lVar], eax
// CHECK: mov ebx, dword ptr ${{[0-9]}}[ebx + $$270]
__asm mov ebx, dword ptr lVar[271 - 82 + 81 + ebx]
// CHECK: mov dword ptr ${{[0-9]}}[ebx + $$828], ebx
----------------
pengfei wrote:
> How about local variables?
Local variables is not allow use 2 regs in offset "[]", since it always fetch form stack or load. That must introduce extra regs.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120887/new/
https://reviews.llvm.org/D120887
More information about the llvm-commits
mailing list