[PATCH] D133914: [InlineAsm][bugfix] Correct function addressing in inline asm

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 23:07:15 PDT 2022


xiangzhangllvm marked 11 inline comments as done.
xiangzhangllvm added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1321-1322
+          SDValue Op = Node->getOperand(i);
+          AddOperand(MIB, Op, 0, nullptr, VRBaseMap,
+                     /*IsDebug=*/false, IsClone, IsCloned);
+
----------------
pengfei wrote:
> xiangzhangllvm wrote:
> > pengfei wrote:
> > > This seems need re-format?
> > Clang format ?
> Yes.
Do clang format.  No change.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:32301-32306
+  StringRef InstrStr = getInstrStrFromOpNo(AsmStrs, OpNo);
+
+  // Do not use "startswith" here, because label may stay ahead.
+  // For example: ".L__MSASMLABEL_.${:uid}__l:call dword ptr ${0:P}"
+  if (InstrStr.contains("call"))
+    return true;
----------------
xiangzhangllvm wrote:
> pengfei wrote:
> > The code seems fragile. How about using regex:
> > ```
> > std::string Call = formatv("call.*\\${?{0}", OpNo);
> > for (auto &AsmStr : AsmStrs)
> >   if (Regex(Call).match(AsmStr))
> >     return true;
> > return false;
> > ```
> good idea! Let me have a try, thanks a lot!
Enhance in getInstrStrFromOpNo.


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

https://reviews.llvm.org/D133914



More information about the llvm-commits mailing list