summaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetSelectionDAG.td
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-07-17 00:47:06 +0000
committerJim Grosbach <grosbach@apple.com>2012-07-17 00:47:06 +0000
commitac915b48d8ba73a5d734be5c4a0e1d25cea93252 (patch)
tree063d21fed58fe8b3515fc4f0b5bebcbc65f4d005 /include/llvm/Target/TargetSelectionDAG.td
parent1bda7863e37180d5c371bab58ceaab0bd8c290d1 (diff)
downloadllvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.tar.gz
llvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.tar.bz2
llvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.tar.xz
TableGen: Allow conditional instruction pattern in multiclass.
Define a 'null_frag' SDPatternOperator node, which if referenced in an instruction Pattern, results in the pattern being collapsed to be as-if '[]' had been specified instead. This allows supporting a multiclass definition where some instaniations have ISel patterns associated and others do not. For example, multiclass myMulti<RegisterClass rc, SDPatternOperator OpNode = null_frag> { def _x : myI<(outs rc:), (ins rc:), []>; def _r : myI<(outs rc:), (ins rc:), [(set rc:, (OpNode rc:))]>; } defm foo : myMulti<GRa, not>; defm bar : myMulti<GRb>; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetSelectionDAG.td')
-rw-r--r--include/llvm/Target/TargetSelectionDAG.td7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetSelectionDAG.td b/include/llvm/Target/TargetSelectionDAG.td
index 5f069801a6..ff006b609d 100644
--- a/include/llvm/Target/TargetSelectionDAG.td
+++ b/include/llvm/Target/TargetSelectionDAG.td
@@ -595,6 +595,13 @@ def not : PatFrag<(ops node:$in), (xor node:$in, -1)>;
def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>;
def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>;
+// null_frag - The null pattern operator is used in multiclass instantiations
+// which accept an SDPatternOperator for use in matching patterns for internal
+// definitions. When expanding a pattern, if the null fragment is referenced
+// in the expansion, the pattern is discarded and it is as-if '[]' had been
+// specified. This allows multiclasses to have the isel patterns be optional.
+def null_frag : SDPatternOperator;
+
// load fragments.
def unindexedload : PatFrag<(ops node:$ptr), (ld node:$ptr), [{
return cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;