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
diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h
index 922c2b4..a14f630 100644
--- a/utils/TableGen/CodeGenTarget.h
+++ b/utils/TableGen/CodeGenTarget.h
@@ -42,6 +42,9 @@
   SDNPSideEffect
 };
 
+// ComplexPattern attributes.
+enum CPAttr { CPAttrParentAsRoot };
+
 /// getValueType - Return the MVT::ValueType that the specified TableGen record
 /// corresponds to.
 MVT::ValueType getValueType(Record *Rec);
@@ -172,7 +175,8 @@
   unsigned NumOperands;
   std::string SelectFunc;
   std::vector<Record*> RootNodes;
-  unsigned Properties;
+  unsigned Properties; // Node properties
+  unsigned Attributes; // Pattern attributes
 public:
   ComplexPattern() : NumOperands(0) {};
   ComplexPattern(Record *R);
@@ -184,7 +188,7 @@
     return RootNodes;
   }
   bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); }
-
+  bool hasAttribute(enum CPAttr Attr) const { return Attributes & (1 << Attr); }
 };
 
 } // End llvm namespace