[PATCH] D38894: [RFC][Tablegen] Add CCIfSplitFrom and CCPassIndirectBySamePointer Calling Convention Interfaces

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 09:44:06 PDT 2017


shiva0217 created this revision.

Hi,

For the target ABI have following calling convention

"Pass by indirect pointer if the primary type is f128"

If the target didn't support  f128 register class, legalizer will split the arguments.
So it's hard to identify the argument is split from f128 by *CallingConv.td, 
and we have to obtain custom calling convention handler to deal with.

To pass the split parts by the same indirect pointer would also need extra handler function.
One of the case is "CC_SystemZ_I128Indirect" in SystemZCallingConv.h.

To simplify the porting effort, I'd like to add the interfaces as follow.

CCIfSplitFrom - If the current argument is split from one of the specified types, apply action A.

CCPassIndirectBySamePointer - Just like CCPassIndirect except pass by the same pointer.

With the new calling convention interfaces, we could describe

"Pass by indirect pointer if primary type is f128" as

CCIfType<[i32], CCIfSplitFrom<[f128], CCPassIndirectBySamePointer<i32>>>

without writing custom handling function by CCCustom.

The Tablegen result will be

    if (LocVT == MVT::i32) {
          if (ArgFlags.getOrigVt() == MVT::f128) {
  	      LocVT = MVT::i32;
  	      LocInfo = CCValAssign::Indirect;
  	      if (!ArgFlags.isSplit()) {
  	             State.addLoc(State.lastLoc());
  	             return false;
  	      }

}

  }

Any suggestions?

Thanks,
Shiva


Repository:
  rL LLVM

https://reviews.llvm.org/D38894

Files:
  include/llvm/CodeGen/CallingConvLower.h
  include/llvm/Target/TargetCallingConv.h
  include/llvm/Target/TargetCallingConv.td
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  utils/TableGen/CallingConvEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38894.118925.patch
Type: text/x-patch
Size: 5145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171013/0c086201/attachment.bin>


More information about the llvm-commits mailing list