[PATCH] D120887: The [2/2] Fix mangle problem when variable used in inline asm (non-rip for ARR[BaseReg+IndexReg+..])

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 01:41:05 PDT 2022


skan added inline comments.


================
Comment at: llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h:66
+  /// isMemUseUpRegs - Is memory operand use up regs, for example, intel MS
+  /// inlineasm may use ARR[baseReg + IndexReg + ...] which may use up regs
+  /// in [...] expr, so ARR can not use extra reg.
----------------
inline asm


================
Comment at: llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h:67
+  /// inlineasm may use ARR[baseReg + IndexReg + ...] which may use up regs
+  /// in [...] expr, so ARR can not use extra reg.
+  virtual bool isMemUseUpRegs() const { return false; }
----------------
ARR can be represented a displacement in non-pic mode. The comments need to be more specified.


================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:5947-5950
+static bool getAffected(MCParsedAsmOperand &Operand) {
+  return Operand.isMemUseUpRegs();
+}
+
----------------
This function is unused?


================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:6170-6172
+      if (AR.IntelExpRestricted)
+        OS << "${" << OutputIdx++ << ":P}";
+      else
----------------
This looks much better than the previous patch.


================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:439
     bool setSymRef(const MCExpr *Val, StringRef ID, StringRef &ErrMsg) {
-      if (Sym) {
+      if (Sym/* && !isLabel(Val)*/) {
         ErrMsg = "cannot use more than one symbol in memory operand";
----------------
accident change?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120887/new/

https://reviews.llvm.org/D120887



More information about the llvm-commits mailing list