[PATCH] D100788: [SystemZ] Support i128 inline asm operands

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 02:05:29 PDT 2021


uweigand added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8568
+          const TargetRegisterClass *RC = nullptr;
+          if (RegVT == MVT::Untyped) {
+            const MachineFunction &MF = DAG.getMachineFunction();
----------------
jonpa wrote:
> uweigand wrote:
> > jonpa wrote:
> > > uweigand wrote:
> > > > Instead of recomputing the RC here, can't we get it from the flag word of the matching operand, e.g. using `hasRegClassConstraint(OpFlag, RCID)`?  This would match the way we get the number of registers from the flag word instead of recomputing it as well.
> > > No - the matching operand may be a specific physreg in which case there is no register class specified (e.g. SystemZ/asm-17.ll).
> > > 
> > Hmm, maybe I'm confused but I thought in those cases, we'd still get the RC for that physreg installed into the flags.  Isnt't that exactly what the code in AddInlineAsmOperands does:
> > 
> > ```
> >     const TargetRegisterClass *RC = MRI.getRegClass(Regs.front());
> >     Flag = InlineAsm::getFlagWordForRegClass(Flag, RC->getID());
> > 
> > ```
> > (Regs.front() should have been set up to the physreg if there's one.)
> > 
> That is guarded with a check to only do that for virtual registers...
Doh, of course, sorry for missing that.

Still, I think calling getRegForInlineAsmConstraint again here is redundant.  The routine was already called in GetRegistersForValue, resulting in //either// a virtual register, in which case the RC is stored in the Flags, //or else// a physical register **which is guaranteed to be a member of RC** otherwise GetRegistersForValue will fail an assertion.

So we should check the register that was created for the matching index (which is in 
`AsmNodeOperands[CurOp+1]` at this point); if it is a virtual register, get the RC from the flags, and if it is a physical register, use the RC this physreg is a member of.  Does that make sense?


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

https://reviews.llvm.org/D100788



More information about the llvm-commits mailing list