[PATCH] D122220: [InlineAsm] Add support for address operands ("p").

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 03:39:14 PDT 2022


jonpa added a comment.

> In IR level the constrain "p" is equal with "m" (TargetLowering::C_Memory + !isIndirect)

I am not sure there is such a thing as "m" without the indirect flag ('*')... "m" and "p" are however different as "*m" is used to access memory and "p" typically to load the address into a register (at least that's my understanding so far).



================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:4838
     // If this asm operand is our Value*, and if it isn't an indirect memory
-    // operand, we can't fold it!
+    // operand, we can't fold it!  TODO: Also handle C_Address?
     if (OpInfo.CallOperandVal == OpVal &&
----------------
xiangzhangllvm wrote:
> I think C_Address the should return false. It is direct mem (!OpInfo.isIndirect). So no need change here.
I think actually this should be treated the same as an indirect memory operand since the address can be sunk into user just the same way. So for a C_Address, false should *not* be returned, I think.




================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5621
 
+    // TODO: Also handle C_Address?
     if (OpInfo.ConstraintType == TargetLowering::C_Memory &&
----------------
xiangzhangllvm wrote:
> I think we can handle the C_Address.
> As the comment ahead optimizeMemoryInst, this is used to
> "Sink addressing mode computation immediate before MemoryInst if doing so
>  can be done without increasing register pressure."
> Anyway that is not a big problem.
Yes, they should be treated the same, I agre...




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

https://reviews.llvm.org/D122220



More information about the llvm-commits mailing list