[PATCH] D116090: [X86][MS-InlineAsm] Use exact conditions to recognize MS global variables
Phoebe Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 22 19:46:29 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG682d01a1c1c5: [X86][MS-InlineAsm] Use exact conditions to recognize MS global variables (authored by pengfei).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116090/new/
https://reviews.llvm.org/D116090
Files:
clang/test/CodeGen/ms-inline-asm-functions.c
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/AsmParser/X86Operand.h
Index: llvm/lib/Target/X86/AsmParser/X86Operand.h
===================================================================
--- llvm/lib/Target/X86/AsmParser/X86Operand.h
+++ llvm/lib/Target/X86/AsmParser/X86Operand.h
@@ -286,10 +286,9 @@
bool isOffsetOfLocal() const override { return isImm() && Imm.LocalRef; }
bool isMemPlaceholder(const MCInstrDesc &Desc) const override {
- // Add more restrictions to avoid the use of global symbols. This helps
- // with reducing the code size.
- return !Desc.isRematerializable() && !Desc.isCall() && isMem() &&
- !Mem.BaseReg && !Mem.IndexReg;
+ // Only MS InlineAsm uses global variables with registers rather than
+ // rip/eip.
+ return !Mem.DefaultBaseReg && Mem.FrontendSize;
}
bool needAddressOf() const override { return AddressOf; }
Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1759,7 +1759,8 @@
// registers in a mmory expression, and though unaccessible via rip/eip.
if (IsGlobalLV && (BaseReg || IndexReg)) {
Operands.push_back(X86Operand::CreateMem(getPointerWidth(), Disp, Start,
- End, Size, Identifier, Decl));
+ End, Size, Identifier, Decl,
+ FrontendSize));
return false;
}
// Otherwise, we set the base register to a non-zero value
Index: clang/test/CodeGen/ms-inline-asm-functions.c
===================================================================
--- clang/test/CodeGen/ms-inline-asm-functions.c
+++ clang/test/CodeGen/ms-inline-asm-functions.c
@@ -39,7 +39,7 @@
int baz() {
// CHECK-LABEL: _baz:
__asm mov eax, k;
- // CHECK: movl k, %eax
+ // CHECK: movl _k, %eax
__asm mov eax, kptr;
// CHECK: movl _kptr, %eax
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116090.395962.patch
Type: text/x-patch
Size: 1980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211223/81b8fb65/attachment.bin>
More information about the cfe-commits
mailing list