]> granicus.if.org Git - llvm/commit
[tablegen] Handle common load/store predicates inside tablegen. NFC.
authorDaniel Sanders <daniel_l_sanders@apple.com>
Sun, 15 Oct 2017 02:06:44 +0000 (02:06 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Sun, 15 Oct 2017 02:06:44 +0000 (02:06 +0000)
commit910074674e1aeb47211dfb4d69306ec27a143f77
treeb37fad1ee5c27a05f8abcae132ec31589e13e4c0
parent2109dca8558f99f2e2dc1b88d35157c72c58d4bc
[tablegen] Handle common load/store predicates inside tablegen. NFC.

Summary:
GlobalISel and SelectionDAG require different code for the common
load/store predicates due to differences in the representation.
For example:
   SelectionDAG: (load<signext,i8>:i32 GPR32:$addr) // The <> denote properties of the SDNode that are not printed in the DAG
   GlobalISel: (G_SEXT:s32 (G_LOAD:s8 GPR32:$addr))
Even without that, differences in the IR (SDNode vs MachineInstr) require
differences in the C++ predicate.

This patch moves the implementation of the common load/store predicates
into tablegen so that it can handle these differences.

It's NFC for SelectionDAG since it emits equivalent code and it's NFC for
GlobalISel since the rules involving the relevant predicates are still
rejected by the importer.

Depends on D36618

Reviewers: ab, qcolombet, t.p.northover, rovka, aditya_nandakumar

Subscribers: llvm-commits, igorb

Differential Revision: https://reviews.llvm.org/D37443

Includes a partial revert of r315826 since this patch makes it necessary for
getPredCode() to return a std::string and getImmCode() should have the same
interface as getPredCode().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315841 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetSelectionDAG.td
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenDAGPatterns.h
utils/TableGen/GlobalISelEmitter.cpp