This revision was automatically updated to reflect the committed changes. Closed by commit rG24c68ea1eb4f: Reland "[X86][MS-InlineAsm] Use exact conditions to recognize MS global… (authored by pengfei).
Changed prior to commit: https://reviews.llvm.org/D116090?vs=395962&id=396145#toc 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 isMem() && !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 }
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 isMem() && !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 }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits