[PATCH] D113096: [X86][MS-InlineAsm] Add constraint *m for memory access w/ global var
Xiang Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 3 18:37:38 PDT 2021
xiangzhangllvm added inline comments.
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:1759
// It is widely common for MS InlineAsm to use a global variable and one/two
// registers in a mmory expression, and though unaccessible via rip/eip.
if (IsGlobalLV && (BaseReg || IndexReg)) {
----------------
Let me generally tell out my understand here, (If wrong PLS correct me)
Here from the comments we can see, the old code want to keep the origin symbol of global variable to let linker (relocation) handle it. Here you describe it with a pointer (with decl), it change to form of $ID <--> (decl), So which need constrain it with "*m". But if the pointer can not be access from BaseReg(Rip) + Index(Ip) how do you descript the pointer you generate out ?
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:2554-2555
unsigned IndexReg = SM.getIndexReg();
+ if (IndexReg && BaseReg == X86::RIP)
+ BaseReg = 0;
unsigned Scale = SM.getScale();
----------------
The change here looks too arbitrary. For global address it is ok to drop the base, it mainly fetch from offset. but if here not global variable?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113096/new/
https://reviews.llvm.org/D113096
More information about the cfe-commits
mailing list