Rewrite tblgen handling of subtarget features so
[oota-llvm.git] / utils / TableGen / CodeGenDAGPatterns.h
index 08b40d190d51eebf972cd850b94b2a892f3c5651..44c154a353792e0a8a2966a962b81ac93cfa5398 100644 (file)
@@ -1,4 +1,4 @@
-//===- CodegenDAGPatterns.h - Read DAG patterns from .td file ---*- C++ -*-===//
+//===- CodeGenDAGPatterns.h - Read DAG patterns from .td file ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file declares the CodegenDAGPatterns class, which is used to read and
+// This file declares the CodeGenDAGPatterns class, which is used to read and
 // represent the patterns present in a .td file for instructions.
 //
 //===----------------------------------------------------------------------===//
@@ -27,7 +27,7 @@ namespace llvm {
   class SDNodeInfo;
   class TreePattern;
   class TreePatternNode;
-  class CodegenDAGPatterns;
+  class CodeGenDAGPatterns;
   class ComplexPattern;
 
 /// MVT::DAGISelGenValueType - These are some extended forms of MVT::ValueType
@@ -56,7 +56,8 @@ struct SDTypeConstraint {
   unsigned OperandNo;   // The operand # this constraint applies to.
   enum { 
     SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisSameAs, 
-    SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisIntVectorOfSameSize
+    SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisIntVectorOfSameSize,
+    SDTCisEltOfVec
   } ConstraintType;
   
   union {   // The discriminated union.
@@ -75,6 +76,9 @@ struct SDTypeConstraint {
     struct {
       unsigned OtherOperandNum;
     } SDTCisIntVectorOfSameSize_Info;
+    struct {
+      unsigned OtherOperandNum;
+    } SDTCisEltOfVec_Info;
   } x;
 
   /// ApplyTypeConstraint - Given a node in a pattern, apply this type
@@ -203,14 +207,17 @@ public:
   void setChild(unsigned i, TreePatternNode *N) {
     Children[i] = N;
   }
-  
-  
+
   const std::string &getPredicateFn() const { return PredicateFn; }
   void setPredicateFn(const std::string &Fn) { PredicateFn = Fn; }
 
   Record *getTransformFn() const { return TransformFn; }
   void setTransformFn(Record *Fn) { TransformFn = Fn; }
   
+  /// getIntrinsicInfo - If this node corresponds to an intrinsic, return the
+  /// CodeGenIntrinsic information for it, otherwise return a null pointer.
+  const CodeGenIntrinsic *getIntrinsicInfo(const CodeGenDAGPatterns &CDP) const;
+  
   void print(std::ostream &OS) const;
   void dump() const;
   
@@ -264,7 +271,7 @@ public:   // Higher level manipulation routines.
   
   /// canPatternMatch - If it is impossible for this pattern to match on this
   /// target, fill in Reason and return false.  Otherwise, return true.
-  bool canPatternMatch(std::string &Reason, CodegenDAGPatterns &CDP);
+  bool canPatternMatch(std::string &Reason, CodeGenDAGPatterns &CDP);
 };
 
 
@@ -287,7 +294,7 @@ class TreePattern {
   
   /// CDP - the top-level object coordinating this madness.
   ///
-  CodegenDAGPatterns &CDP;
+  CodeGenDAGPatterns &CDP;
 
   /// isInputPattern - True if this is an input pattern, something to match.
   /// False if this is an output pattern, something to emit.
@@ -297,11 +304,11 @@ public:
   /// TreePattern constructor - Parse the specified DagInits into the
   /// current record.
   TreePattern(Record *TheRec, ListInit *RawPat, bool isInput,
-              CodegenDAGPatterns &ise);
+              CodeGenDAGPatterns &ise);
   TreePattern(Record *TheRec, DagInit *Pat, bool isInput,
-              CodegenDAGPatterns &ise);
+              CodeGenDAGPatterns &ise);
   TreePattern(Record *TheRec, TreePatternNode *Pat, bool isInput,
-              CodegenDAGPatterns &ise);
+              CodeGenDAGPatterns &ise);
       
   /// getTrees - Return the tree patterns which corresponds to this pattern.
   ///
@@ -325,7 +332,7 @@ public:
   }
   std::vector<std::string> &getArgList() { return Args; }
   
-  CodegenDAGPatterns &getDAGPatterns() const { return CDP; }
+  CodeGenDAGPatterns &getDAGPatterns() const { return CDP; }
 
   /// InlinePatternFragments - If this pattern refers to any pattern
   /// fragments, inline them into place, giving us a pattern without any
@@ -374,7 +381,7 @@ public:
       ImpResults(impresults), ImpOperands(impoperands),
       ResultPattern(0) {}
 
-  TreePattern *getPattern() const { return Pattern; }
+  const TreePattern *getPattern() const { return Pattern; }
   unsigned getNumResults() const { return Results.size(); }
   unsigned getNumOperands() const { return Operands.size(); }
   unsigned getNumImpResults() const { return ImpResults.size(); }
@@ -406,7 +413,7 @@ public:
   TreePatternNode *getResultPattern() const { return ResultPattern; }
 };
   
-/// PatternToMatch - Used by CodegenDAGPatterns to keep tab of patterns
+/// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns
 /// processed to produce isel.
 struct PatternToMatch {
   PatternToMatch(ListInit *preds,
@@ -430,7 +437,7 @@ struct PatternToMatch {
 };
 
   
-class CodegenDAGPatterns {
+class CodeGenDAGPatterns {
   RecordKeeper &Records;
   CodeGenTarget Target;
   std::vector<CodeGenIntrinsic> Intrinsics;
@@ -451,8 +458,8 @@ class CodegenDAGPatterns {
   /// emit.
   std::vector<PatternToMatch> PatternsToMatch;
 public:
-  CodegenDAGPatterns(RecordKeeper &R); 
-  ~CodegenDAGPatterns();
+  CodeGenDAGPatterns(RecordKeeper &R); 
+  ~CodeGenDAGPatterns();
   
   const CodeGenTarget &getTargetInfo() const { return Target; }