[llvm-commits] [llvm] r132636 - in /llvm/trunk/utils/TableGen: SetTheory.cpp SetTheory.h TableGen.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Sat Jun 4 00:49:55 PDT 2011


Author: stoklund
Date: Sat Jun  4 02:49:55 2011
New Revision: 132636

URL: http://llvm.org/viewvc/llvm-project?rev=132636&view=rev
Log:
Drop a RecordKeeper reference that wasn't necessary.

Modified:
    llvm/trunk/utils/TableGen/SetTheory.cpp
    llvm/trunk/utils/TableGen/SetTheory.h
    llvm/trunk/utils/TableGen/TableGen.cpp

Modified: llvm/trunk/utils/TableGen/SetTheory.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SetTheory.cpp?rev=132636&r1=132635&r2=132636&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SetTheory.cpp (original)
+++ llvm/trunk/utils/TableGen/SetTheory.cpp Sat Jun  4 02:49:55 2011
@@ -140,10 +140,6 @@
 
 // (sequence "Format", From, To) Generate a sequence of records by name.
 struct SequenceOp : public SetTheory::Operator {
-  RecordKeeper &Records;
-
-  SequenceOp(RecordKeeper&R) : Records(R) {}
-
   void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts) {
     if (Expr->arg_size() != 3)
       throw "Bad args to (sequence \"Format\", From, To): " +
@@ -164,6 +160,9 @@
     else
       throw "From must be an integer: " + Expr->getAsString();
 
+    RecordKeeper &Records =
+      dynamic_cast<DefInit&>(*Expr->getOperator()).getDef()->getRecords();
+
     int Step = From <= To ? 1 : -1;
     for (To += Step; From != To; From += Step) {
       std::string Name;
@@ -193,7 +192,7 @@
 };
 } // end anonymous namespace
 
-SetTheory::SetTheory(RecordKeeper *Records) {
+SetTheory::SetTheory() {
   addOperator("add", new AddOp);
   addOperator("sub", new SubOp);
   addOperator("and", new AndOp);
@@ -202,8 +201,7 @@
   addOperator("rotl", new RotOp(false));
   addOperator("rotr", new RotOp(true));
   addOperator("decimate", new DecimateOp);
-  if (Records)
-    addOperator("sequence", new SequenceOp(*Records));
+  addOperator("sequence", new SequenceOp);
 }
 
 void SetTheory::addOperator(StringRef Name, Operator *Op) {

Modified: llvm/trunk/utils/TableGen/SetTheory.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SetTheory.h?rev=132636&r1=132635&r2=132636&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SetTheory.h (original)
+++ llvm/trunk/utils/TableGen/SetTheory.h Sat Jun  4 02:49:55 2011
@@ -96,8 +96,7 @@
 
 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*);

Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=132636&r1=132635&r2=132636&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Sat Jun  4 02:49:55 2011
@@ -380,7 +380,7 @@
     }
     case PrintSets:
     {
-      SetTheory Sets(&Records);
+      SetTheory Sets;
       Sets.addFieldExpander("Set", "Elements");
       std::vector<Record*> Recs = Records.getAllDerivedDefinitions("Set");
       for (unsigned i = 0, e = Recs.size(); i != e; ++i) {





More information about the llvm-commits mailing list