X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FSetTheory.h;h=5baed79fb76a6981af44aed0b1cc3f3615f2eeb2;hb=d573aba8e13c2afc5ad7c3c3c442a3a84f8bd94d;hp=c648d46e60d95274aa98862582be41dafabb4c03;hpb=1de99829b6bebe3310682efac8be2a9a95323220;p=oota-llvm.git diff --git a/utils/TableGen/SetTheory.h b/utils/TableGen/SetTheory.h index c648d46e60d..5baed79fb76 100644 --- a/utils/TableGen/SetTheory.h +++ b/utils/TableGen/SetTheory.h @@ -47,15 +47,16 @@ #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 #include namespace llvm { class DagInit; -struct Init; +class Init; class Record; class RecordKeeper; @@ -65,16 +66,25 @@ public: typedef SmallSetVector 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 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; }; @@ -92,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*); @@ -112,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 Loc); /// evaluate - Evaluate a sequence of Inits and append to Elts. template - void evaluate(Iter begin, Iter end, RecSet &Elts) { + void evaluate(Iter begin, Iter end, RecSet &Elts, ArrayRef Loc) { while (begin != end) - evaluate(*begin++, Elts); + evaluate(*begin++, Elts, Loc); } /// expand - Expand a record into a set of elements if possible. Return a