aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/SetTheory.cpp
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2012-10-10 20:24:43 +0000
committerSean Silva <silvas@purdue.edu>2012-10-10 20:24:43 +0000
commit6cfc806a6b82b60a3e923b6b89f2b4da62cdb50b (patch)
tree792b0800194da285c83f814a8ac1d93c59d0bcab /utils/TableGen/SetTheory.cpp
parentb0c6fa3b4b74d9cd03beb5a4cb9702abc85ac169 (diff)
downloadexternal_llvm-6cfc806a6b82b60a3e923b6b89f2b4da62cdb50b.tar.gz
external_llvm-6cfc806a6b82b60a3e923b6b89f2b4da62cdb50b.tar.bz2
external_llvm-6cfc806a6b82b60a3e923b6b89f2b4da62cdb50b.zip
tblgen: Mechanically move dynamic_cast<> to dyn_cast<>.
Some of these dyn_cast<>'s would be better phrased as isa<> or cast<>. That will happen in a future patch. There are also two dyn_cast_or_null<>'s slipped in instead of dyn_cast<>'s, since they were causing crashes with just dyn_cast<>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/SetTheory.cpp')
-rw-r--r--utils/TableGen/SetTheory.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/utils/TableGen/SetTheory.cpp b/utils/TableGen/SetTheory.cpp
index bdca9a63bd..dcc887125e 100644
--- a/utils/TableGen/SetTheory.cpp
+++ b/utils/TableGen/SetTheory.cpp
@@ -72,7 +72,7 @@ struct SetIntBinOp : public SetTheory::Operator {
throw "Operator requires (Op Set, Int) arguments: " + Expr->getAsString();
RecSet Set;
ST.evaluate(Expr->arg_begin()[0], Set);
- IntInit *II = dynamic_cast<IntInit*>(Expr->arg_begin()[1]);
+ IntInit *II = dyn_cast<IntInit>(Expr->arg_begin()[1]);
if (!II)
throw "Second argument must be an integer: " + Expr->getAsString();
apply2(ST, Expr, Set, II->getValue(), Elts);
@@ -165,27 +165,27 @@ struct SequenceOp : public SetTheory::Operator {
throw "Bad args to (sequence \"Format\", From, To): " +
Expr->getAsString();
else if (Expr->arg_size() == 4) {
- if (IntInit *II = dynamic_cast<IntInit*>(Expr->arg_begin()[3])) {
+ if (IntInit *II = dyn_cast<IntInit>(Expr->arg_begin()[3])) {
Step = II->getValue();
} else
throw "Stride must be an integer: " + Expr->getAsString();
}
std::string Format;
- if (StringInit *SI = dynamic_cast<StringInit*>(Expr->arg_begin()[0]))
+ if (StringInit *SI = dyn_cast<StringInit>(Expr->arg_begin()[0]))
Format = SI->getValue();
else
throw "Format must be a string: " + Expr->getAsString();
int64_t From, To;
- if (IntInit *II = dynamic_cast<IntInit*>(Expr->arg_begin()[1]))
+ if (IntInit *II = dyn_cast<IntInit>(Expr->arg_begin()[1]))
From = II->getValue();
else
throw "From must be an integer: " + Expr->getAsString();
if (From < 0 || From >= (1 << 30))
throw "From out of range";
- if (IntInit *II = dynamic_cast<IntInit*>(Expr->arg_begin()[2]))
+ if (IntInit *II = dyn_cast<IntInit>(Expr->arg_begin()[2]))
To = II->getValue();
else
throw "From must be an integer: " + Expr->getAsString();
@@ -193,7 +193,7 @@ struct SequenceOp : public SetTheory::Operator {
throw "To out of range";
RecordKeeper &Records =
- dynamic_cast<DefInit&>(*Expr->getOperator()).getDef()->getRecords();
+ dyn_cast<DefInit>(Expr->getOperator())->getDef()->getRecords();
Step *= From <= To ? 1 : -1;
while (true) {
@@ -261,7 +261,7 @@ void SetTheory::addFieldExpander(StringRef ClassName, StringRef FieldName) {
void SetTheory::evaluate(Init *Expr, RecSet &Elts) {
// A def in a list can be a just an element, or it may expand.
- if (DefInit *Def = dynamic_cast<DefInit*>(Expr)) {
+ if (DefInit *Def = dyn_cast<DefInit>(Expr)) {
if (const RecVec *Result = expand(Def->getDef()))
return Elts.insert(Result->begin(), Result->end());
Elts.insert(Def->getDef());
@@ -269,14 +269,14 @@ void SetTheory::evaluate(Init *Expr, RecSet &Elts) {
}
// Lists simply expand.
- if (ListInit *LI = dynamic_cast<ListInit*>(Expr))
+ if (ListInit *LI = dyn_cast<ListInit>(Expr))
return evaluate(LI->begin(), LI->end(), Elts);
// Anything else must be a DAG.
- DagInit *DagExpr = dynamic_cast<DagInit*>(Expr);
+ DagInit *DagExpr = dyn_cast<DagInit>(Expr);
if (!DagExpr)
throw "Invalid set element: " + Expr->getAsString();
- DefInit *OpInit = dynamic_cast<DefInit*>(DagExpr->getOperator());
+ DefInit *OpInit = dyn_cast<DefInit>(DagExpr->getOperator());
if (!OpInit)
throw "Bad set expression: " + Expr->getAsString();
Operator *Op = Operators.lookup(OpInit->getDef()->getName());
@@ -296,7 +296,7 @@ const RecVec *SetTheory::expand(Record *Set) {
const std::vector<Record*> &SC = Set->getSuperClasses();
for (unsigned i = 0, e = SC.size(); i != e; ++i) {
// Skip unnamed superclasses.
- if (!dynamic_cast<const StringInit *>(SC[i]->getNameInit()))
+ if (!dyn_cast<StringInit>(SC[i]->getNameInit()))
continue;
if (Expander *Exp = Expanders.lookup(SC[i]->getName())) {
// This breaks recursive definitions.