From c017bc1c1e2fa0995e957f6c2ada1339832bb221 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sat, 4 Jun 2011 07:49:55 +0000 Subject: Drop a RecordKeeper reference that wasn't necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132636 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/SetTheory.cpp | 12 +++++------- utils/TableGen/SetTheory.h | 3 +-- utils/TableGen/TableGen.cpp | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'utils/TableGen') diff --git a/utils/TableGen/SetTheory.cpp b/utils/TableGen/SetTheory.cpp index e168b549bc..ade1825576 100644 --- a/utils/TableGen/SetTheory.cpp +++ b/utils/TableGen/SetTheory.cpp @@ -140,10 +140,6 @@ struct DecimateOp : public SetIntBinOp { // (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 @@ struct SequenceOp : public SetTheory::Operator { else throw "From must be an integer: " + Expr->getAsString(); + RecordKeeper &Records = + dynamic_cast(*Expr->getOperator()).getDef()->getRecords(); + int Step = From <= To ? 1 : -1; for (To += Step; From != To; From += Step) { std::string Name; @@ -193,7 +192,7 @@ struct FieldExpander : public SetTheory::Expander { }; } // 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 @@ SetTheory::SetTheory(RecordKeeper *Records) { 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) { diff --git a/utils/TableGen/SetTheory.h b/utils/TableGen/SetTheory.h index 2202f22396..e37a76ee68 100644 --- a/utils/TableGen/SetTheory.h +++ b/utils/TableGen/SetTheory.h @@ -96,8 +96,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*); diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 925b134ca4..4e4da366ae 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -380,7 +380,7 @@ int main(int argc, char **argv) { } case PrintSets: { - SetTheory Sets(&Records); + SetTheory Sets; Sets.addFieldExpander("Set", "Elements"); std::vector Recs = Records.getAllDerivedDefinitions("Set"); for (unsigned i = 0, e = Recs.size(); i != e; ++i) { -- cgit v1.2.3