diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-07-17 00:47:06 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-07-17 00:47:06 +0000 |
commit | ac915b48d8ba73a5d734be5c4a0e1d25cea93252 (patch) | |
tree | 063d21fed58fe8b3515fc4f0b5bebcbc65f4d005 /include/llvm/Target | |
parent | 1bda7863e37180d5c371bab58ceaab0bd8c290d1 (diff) | |
download | external_llvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.zip external_llvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.tar.gz external_llvm-ac915b48d8ba73a5d734be5c4a0e1d25cea93252.tar.bz2 |
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')
-rw-r--r-- | include/llvm/Target/TargetSelectionDAG.td | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetSelectionDAG.td b/include/llvm/Target/TargetSelectionDAG.td index 5f06980..ff006b6 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; |