[llvm-dev] Porting use of target-specific node types in SelectionISel to GlobalISel?

Gabriel Hjort Åkerlund via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 27 08:15:19 PDT 2020


I am in the process of porting our target to GlobalISel and have encountered
the following problem. In our target, the predicate for conditional
branching is placed on the branch instruction instead of the compare
instruction. To make this work in our SelectionISel-based implementation, we
declare our own nodes, e.g.:

 

def XYZ_COMPARE_SIGNED : SDNode<"XYZISD::COMPARE_SIGNED", SDT_PHXiCmp,
[SDNPHasChain, SDNPOutGlue]>;

 

During legalization, we lower BR_CC nodes into:

 

XYZISD::COMPARE_SIGNED <lhs> <rhs>

XYZISD::CONDBRANCH <label> <condition code> <condition reg>

 

These are then used for pattern matching, e.g.:

def : Pat<(XYZ_COMPARE_SIGNED i16:$src1, (i16 Imm_m32768_32767_i16:$SImm)),
(cmp_nimm16_a16 $src1, imm:$SImm)>;

 

Now to my question: What is the best way to achieve the same thing in
GlobalISel? Is it possible to introduce new node types in GlobalISel? If so,
how? If not, what’s a suitable work-around that allows me to reuse the
tablegen-declared patterns?

 

Cheers,

Gabriel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200727/72a0dfb4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200727/72a0dfb4/attachment.bin>


More information about the llvm-dev mailing list