Use the AttributeSet instead of AttributeWithIndex.
[oota-llvm.git] / utils / TableGen / SetTheory.h
index 2202f22396ad0bffceabd2145cebbb5d7ce6296a..5baed79fb76a6981af44aed0b1cc3f3615f2eeb2 100644 (file)
 #ifndef SETTHEORY_H
 #define SETTHEORY_H
 
-#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/SourceMgr.h"
 #include <map>
 #include <vector>
 
 namespace llvm {
 
 class DagInit;
-struct Init;
+class Init;
 class Record;
 class RecordKeeper;
 
@@ -65,18 +66,23 @@ public:
   typedef SmallSetVector<Record*, 16> RecSet;
 
   /// Operator - A callback representing a DAG operator.
-  struct Operator {
+  class Operator {
+    virtual void anchor();
+  public:
     virtual ~Operator() {}
 
     /// apply - Apply this operator to Expr's arguments and insert the result
     /// in Elts.
-    virtual void apply(SetTheory&, DagInit *Expr, RecSet &Elts) =0;
+    virtual void apply(SetTheory&, DagInit *Expr, RecSet &Elts,
+                       ArrayRef<SMLoc> Loc) =0;
   };
 
   /// Expander - A callback function that can transform a Record representing a
   /// set into a fully expanded list of elements. Expanders provide a way for
   /// users to define named sets that can be used in DAG expressions.
-  struct Expander {
+  class Expander {
+    virtual void anchor();
+  public:
     virtual ~Expander() {}
 
     virtual void expand(SetTheory&, Record*, RecSet &Elts) =0;
@@ -96,8 +102,7 @@ private:
 
 public:
   /// Create a SetTheory instance with only the standard operators.
-  /// A 'sequence' operator will only be added if a RecordKeeper is given.
-  SetTheory(RecordKeeper *Records = 0);
+  SetTheory();
 
   /// addExpander - Add an expander for Records with the named super class.
   void addExpander(StringRef ClassName, Expander*);
@@ -116,13 +121,13 @@ public:
   void addOperator(StringRef Name, Operator*);
 
   /// evaluate - Evaluate Expr and append the resulting set to Elts.
-  void evaluate(Init *Expr, RecSet &Elts);
+  void evaluate(Init *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc);
 
   /// evaluate - Evaluate a sequence of Inits and append to Elts.
   template<typename Iter>
-  void evaluate(Iter begin, Iter end, RecSet &Elts) {
+  void evaluate(Iter begin, Iter end, RecSet &Elts, ArrayRef<SMLoc> Loc) {
     while (begin != end)
-      evaluate(*begin++, Elts);
+      evaluate(*begin++, Elts, Loc);
   }
 
   /// expand - Expand a record into a set of elements if possible.  Return a