Mercurial > hg > CbC > CbC_llvm
comparison lib/TableGen/SetTheory.cpp @ 121:803732b1fca8
LLVM 5.0
author | kono |
---|---|
date | Fri, 27 Oct 2017 17:07:41 +0900 |
parents | 7d135dc70f03 |
children | c2174574ed3a |
comparison
equal
deleted
inserted
replaced
120:1172e4bd9c6f | 121:803732b1fca8 |
---|---|
10 // This file implements the SetTheory class that computes ordered sets of | 10 // This file implements the SetTheory class that computes ordered sets of |
11 // Records from DAG expressions. | 11 // Records from DAG expressions. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #include "llvm/TableGen/SetTheory.h" | 15 #include "llvm/ADT/ArrayRef.h" |
16 #include "llvm/ADT/SmallVector.h" | |
17 #include "llvm/ADT/STLExtras.h" | |
18 #include "llvm/ADT/StringRef.h" | |
19 #include "llvm/Support/Casting.h" | |
16 #include "llvm/Support/Format.h" | 20 #include "llvm/Support/Format.h" |
21 #include "llvm/Support/SMLoc.h" | |
22 #include "llvm/Support/raw_ostream.h" | |
17 #include "llvm/TableGen/Error.h" | 23 #include "llvm/TableGen/Error.h" |
18 #include "llvm/TableGen/Record.h" | 24 #include "llvm/TableGen/Record.h" |
25 #include "llvm/TableGen/SetTheory.h" | |
26 #include <algorithm> | |
27 #include <cstdint> | |
28 #include <string> | |
29 #include <utility> | |
19 | 30 |
20 using namespace llvm; | 31 using namespace llvm; |
21 | 32 |
22 // Define the standard operators. | 33 // Define the standard operators. |
23 namespace { | 34 namespace { |
24 | 35 |
25 typedef SetTheory::RecSet RecSet; | 36 using RecSet = SetTheory::RecSet; |
26 typedef SetTheory::RecVec RecVec; | 37 using RecVec = SetTheory::RecVec; |
27 | 38 |
28 // (add a, b, ...) Evaluate and union all arguments. | 39 // (add a, b, ...) Evaluate and union all arguments. |
29 struct AddOp : public SetTheory::Operator { | 40 struct AddOp : public SetTheory::Operator { |
30 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, | 41 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, |
31 ArrayRef<SMLoc> Loc) override { | 42 ArrayRef<SMLoc> Loc) override { |
235 | 246 |
236 void expand(SetTheory &ST, Record *Def, RecSet &Elts) override { | 247 void expand(SetTheory &ST, Record *Def, RecSet &Elts) override { |
237 ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc()); | 248 ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc()); |
238 } | 249 } |
239 }; | 250 }; |
251 | |
240 } // end anonymous namespace | 252 } // end anonymous namespace |
241 | 253 |
242 // Pin the vtables to this file. | 254 // Pin the vtables to this file. |
243 void SetTheory::Operator::anchor() {} | 255 void SetTheory::Operator::anchor() {} |
244 void SetTheory::Expander::anchor() {} | 256 void SetTheory::Expander::anchor() {} |
245 | |
246 | 257 |
247 SetTheory::SetTheory() { | 258 SetTheory::SetTheory() { |
248 addOperator("add", llvm::make_unique<AddOp>()); | 259 addOperator("add", llvm::make_unique<AddOp>()); |
249 addOperator("sub", llvm::make_unique<SubOp>()); | 260 addOperator("sub", llvm::make_unique<SubOp>()); |
250 addOperator("and", llvm::make_unique<AndOp>()); | 261 addOperator("and", llvm::make_unique<AndOp>()); |
319 } | 330 } |
320 | 331 |
321 // Set is not expandable. | 332 // Set is not expandable. |
322 return nullptr; | 333 return nullptr; |
323 } | 334 } |
324 |