diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2008-01-31 07:27:46 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2008-01-31 07:27:46 +0000 |
commit | 8535624739e55ab7424eadf792e1a3b4123421c7 (patch) | |
tree | 805dabe014aa0a4759c10d0dfca36de28e5bf673 /lib | |
parent | 175e81598ad3fc02f9f5a2ac3ef578a9fed31b6e (diff) |
Allow ComplexExpressions in InstrInfo.td files to be slightly more... complex! ComplexExpressions can now have attributes which affect how TableGen interprets
the pattern when generating matchin code.
The first (and currently, only) attribute causes the immediate parent node of the ComplexPattern operand to be passed into the matching code rather than the node at the root of the entire DAG containing the pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46606 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/TargetSelectionDAG.td | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/TargetSelectionDAG.td b/lib/Target/TargetSelectionDAG.td index a31ef2d368..cdc50fa4b2 100644 --- a/lib/Target/TargetSelectionDAG.td +++ b/lib/Target/TargetSelectionDAG.td @@ -767,6 +767,12 @@ class Pat<dag pattern, dag result> : Pattern<pattern, [result]>; //===----------------------------------------------------------------------===// // Complex pattern definitions. // + +class CPAttribute; +// Pass the parent Operand as root to CP function rather +// than the root of the sub-DAG +def CPAttrParentAsRoot : CPAttribute; + // Complex patterns, e.g. X86 addressing mode, requires pattern matching code // in C++. NumOperands is the number of operands returned by the select function; // SelectFunc is the name of the function used to pattern match the max. pattern; @@ -774,12 +780,14 @@ class Pat<dag pattern, dag result> : Pattern<pattern, [result]>; // e.g. X86 addressing mode - def addr : ComplexPattern<4, "SelectAddr", [add]>; // class ComplexPattern<ValueType ty, int numops, string fn, - list<SDNode> roots = [], list<SDNodeProperty> props = []> { + list<SDNode> roots = [], list<SDNodeProperty> props = [], + list<CPAttribute> attrs = []> { ValueType Ty = ty; int NumOperands = numops; string SelectFunc = fn; list<SDNode> RootNodes = roots; list<SDNodeProperty> Properties = props; + list<CPAttribute> Attributes = attrs; } //===----------------------------------------------------------------------===// |