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

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 17 18:05:11 PDT 2022


xiangzhangllvm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetSubtargetInfo.h:315
+  virtual unsigned char
+  classifyGlobalFunctionReference(const GlobalValue *GV) const {
+    return 0;
----------------
LuoYuanke wrote:
> RKSimon wrote:
> > Add a description comment
> It seems each target has it's own defintion for the return value. Is it interpreted by target when it is used?
Yes, Each target has it's own definition of this function to handle call instruction. This is a virtual function on the base class TargetSubtargetInfo. The target will call their self's classifyGlobalFunctionReference for handle function.


================
Comment at: llvm/include/llvm/CodeGen/TargetSubtargetInfo.h:315
+  virtual unsigned char
+  classifyGlobalFunctionReference(const GlobalValue *GV) const {
+    return 0;
----------------
xiangzhangllvm wrote:
> LuoYuanke wrote:
> > RKSimon wrote:
> > > Add a description comment
> > It seems each target has it's own defintion for the return value. Is it interpreted by target when it is used?
> Yes, Each target has it's own definition of this function to handle call instruction. This is a virtual function on the base class TargetSubtargetInfo. The target will call their self's classifyGlobalFunctionReference for handle function.
Sure


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8814
+      if (TM.getCodeModel() != CodeModel::Large)
+        OpInfo.ConstraintType = TargetLowering::C_Address;
+    }
----------------
LuoYuanke wrote:
> What's the difference between C_Address and C_Memory?
This is added by jonpa, It mean address (mem without load),  I think the implement of it is still need to refine, pls refer our discussion on test llvm/test/CodeGen/X86/inline-asm-p-constraint.ll.


================
Comment at: llvm/test/CodeGen/X86/inline-asm-function-call-pic.ll:71
+
+attributes #0 = { nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
----------------
LuoYuanke wrote:
> Do we need these attribute for the test case?
Let me update it.


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

https://reviews.llvm.org/D133914



More information about the llvm-commits mailing list