summaryrefslogtreecommitdiff
path: root/lib/TableGen
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2012-10-05 03:31:58 +0000
committerSean Silva <silvas@purdue.edu>2012-10-05 03:31:58 +0000
commit736ceace11249da645ec4ed91b8714832193ead4 (patch)
treeab9c91b06c5f1cb4669f52de8616c2ba73428ebc /lib/TableGen
parent89adeb225db4cd4d5c671d2ac5e2e6a6e755b5bc (diff)
downloadllvm-736ceace11249da645ec4ed91b8714832193ead4.tar.gz
llvm-736ceace11249da645ec4ed91b8714832193ead4.tar.bz2
llvm-736ceace11249da645ec4ed91b8714832193ead4.tar.xz
tblgen: Replace uses of dynamic_cast<XXXRecTy> with dyn_cast<>.
This is a mechanical change of dynamic_cast<> to dyn_cast<>. A number of these uses are actually more like isa<> or cast<>, and will be changed to the semanticaly appropriate one in a future patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen')
-rw-r--r--lib/TableGen/Record.cpp40
-rw-r--r--lib/TableGen/TGParser.cpp10
2 files changed, 25 insertions, 25 deletions
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp
index 9955617aa8..e51ae44627 100644
--- a/lib/TableGen/Record.cpp
+++ b/lib/TableGen/Record.cpp
@@ -113,9 +113,9 @@ Init *BitRecTy::convertValue(IntInit *II) {
Init *BitRecTy::convertValue(TypedInit *VI) {
RecTy *Ty = VI->getType();
- if (dynamic_cast<BitRecTy*>(Ty) ||
- dynamic_cast<BitsRecTy*>(Ty) ||
- dynamic_cast<IntRecTy*>(Ty))
+ if (dyn_cast<BitRecTy>(Ty) ||
+ dyn_cast<BitsRecTy>(Ty) ||
+ dyn_cast<IntRecTy>(Ty))
return VI; // Accept variable if it is already of bit type!
return 0;
}
@@ -181,7 +181,7 @@ Init *BitsRecTy::convertValue(BitsInit *BI) {
}
Init *BitsRecTy::convertValue(TypedInit *VI) {
- if (Size == 1 && dynamic_cast<BitRecTy*>(VI->getType()))
+ if (Size == 1 && dyn_cast<BitRecTy>(VI->getType()))
return BitsInit::get(VI);
if (VI->getType()->typeIsConvertibleTo(this)) {
@@ -243,7 +243,7 @@ Init *StringRecTy::convertValue(BinOpInit *BO) {
Init *StringRecTy::convertValue(TypedInit *TI) {
- if (dynamic_cast<StringRecTy*>(TI->getType()))
+ if (dyn_cast<StringRecTy>(TI->getType()))
return TI; // Accept variable if already of the right type!
return 0;
}
@@ -263,7 +263,7 @@ Init *ListRecTy::convertValue(ListInit *LI) {
else
return 0;
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LI->getType());
+ ListRecTy *LType = dyn_cast<ListRecTy>(LI->getType());
if (LType == 0) {
return 0;
}
@@ -273,7 +273,7 @@ Init *ListRecTy::convertValue(ListInit *LI) {
Init *ListRecTy::convertValue(TypedInit *TI) {
// Ensure that TI is compatible with our class.
- if (ListRecTy *LRT = dynamic_cast<ListRecTy*>(TI->getType()))
+ if (ListRecTy *LRT = dyn_cast<ListRecTy>(TI->getType()))
if (LRT->getElementType()->typeIsConvertibleTo(getElementType()))
return TI;
return 0;
@@ -309,7 +309,7 @@ Init *DagRecTy::convertValue(BinOpInit *BO) {
}
RecordRecTy *RecordRecTy::get(Record *R) {
- return &dynamic_cast<RecordRecTy&>(*R->getDefInit()->getType());
+ return dyn_cast<RecordRecTy>(R->getDefInit()->getType());
}
std::string RecordRecTy::getAsString() const {
@@ -325,7 +325,7 @@ Init *RecordRecTy::convertValue(DefInit *DI) {
Init *RecordRecTy::convertValue(TypedInit *TI) {
// Ensure that TI is compatible with Rec.
- if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(TI->getType()))
+ if (RecordRecTy *RRT = dyn_cast<RecordRecTy>(TI->getType()))
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
RRT->getRecord() == getRecord())
return TI;
@@ -354,7 +354,7 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) {
return T1;
// If one is a Record type, check superclasses
- if (RecordRecTy *RecTy1 = dynamic_cast<RecordRecTy*>(T1)) {
+ if (RecordRecTy *RecTy1 = dyn_cast<RecordRecTy>(T1)) {
// See if T2 inherits from a type T1 also inherits from
const std::vector<Record *> &T1SuperClasses =
RecTy1->getRecord()->getSuperClasses();
@@ -372,7 +372,7 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) {
}
}
}
- if (RecordRecTy *RecTy2 = dynamic_cast<RecordRecTy*>(T2)) {
+ if (RecordRecTy *RecTy2 = dyn_cast<RecordRecTy>(T2)) {
// See if T1 inherits from a type T2 also inherits from
const std::vector<Record *> &T2SuperClasses =
RecTy2->getRecord()->getSuperClasses();
@@ -599,7 +599,7 @@ ListInit *ListInit::get(ArrayRef<Init *> Range, RecTy *EltTy) {
}
void ListInit::Profile(FoldingSetNodeID &ID) const {
- ListRecTy *ListType = dynamic_cast<ListRecTy *>(getType());
+ ListRecTy *ListType = dyn_cast<ListRecTy>(getType());
assert(ListType && "Bad type for ListInit!");
RecTy *EltTy = ListType->getElementType();
@@ -1039,8 +1039,8 @@ static Init *ForeachHelper(Init *LHS, Init *MHS, Init *RHS, RecTy *Type,
DagInit *MHSd = dynamic_cast<DagInit*>(MHS);
ListInit *MHSl = dynamic_cast<ListInit*>(MHS);
- DagRecTy *DagType = dynamic_cast<DagRecTy*>(Type);
- ListRecTy *ListType = dynamic_cast<ListRecTy*>(Type);
+ DagRecTy *DagType = dyn_cast<DagRecTy>(Type);
+ ListRecTy *ListType = dyn_cast<ListRecTy>(Type);
OpInit *RHSo = dynamic_cast<OpInit*>(RHS);
@@ -1235,7 +1235,7 @@ std::string TernOpInit::getAsString() const {
}
RecTy *TypedInit::getFieldType(const std::string &FieldName) const {
- RecordRecTy *RecordType = dynamic_cast<RecordRecTy *>(getType());
+ RecordRecTy *RecordType = dyn_cast<RecordRecTy>(getType());
if (RecordType) {
RecordVal *Field = RecordType->getRecord()->getValue(FieldName);
if (Field) {
@@ -1247,7 +1247,7 @@ RecTy *TypedInit::getFieldType(const std::string &FieldName) const {
Init *
TypedInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) const {
- BitsRecTy *T = dynamic_cast<BitsRecTy*>(getType());
+ BitsRecTy *T = dyn_cast<BitsRecTy>(getType());
if (T == 0) return 0; // Cannot subscript a non-bits variable.
unsigned NumBits = T->getNumBits();
@@ -1263,7 +1263,7 @@ TypedInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) const {
Init *
TypedInit::convertInitListSlice(const std::vector<unsigned> &Elements) const {
- ListRecTy *T = dynamic_cast<ListRecTy*>(getType());
+ ListRecTy *T = dyn_cast<ListRecTy>(getType());
if (T == 0) return 0; // Cannot subscript a non-list variable.
if (Elements.size() == 1)
@@ -1336,7 +1336,7 @@ Init *VarInit::resolveListElementReference(Record &R,
RecTy *VarInit::getFieldType(const std::string &FieldName) const {
- if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(getType()))
+ if (RecordRecTy *RTy = dyn_cast<RecordRecTy>(getType()))
if (const RecordVal *RV = RTy->getRecord()->getValue(FieldName))
return RV->getType();
return 0;
@@ -1344,7 +1344,7 @@ RecTy *VarInit::getFieldType(const std::string &FieldName) const {
Init *VarInit::getFieldInit(Record &R, const RecordVal *RV,
const std::string &FieldName) const {
- if (dynamic_cast<RecordRecTy*>(getType()))
+ if (dyn_cast<RecordRecTy>(getType()))
if (const RecordVal *Val = R.getValue(VarName)) {
if (RV != Val && (RV || dynamic_cast<UnsetInit*>(Val->getValue())))
return 0;
@@ -1655,7 +1655,7 @@ void Record::checkName() {
const TypedInit *TypedName = dynamic_cast<const TypedInit *>(Name);
assert(TypedName && "Record name is not typed!");
RecTy *Type = TypedName->getType();
- if (dynamic_cast<StringRecTy *>(Type) == 0) {
+ if (dyn_cast<StringRecTy>(Type) == 0) {
throw TGError(getLoc(), "Record name is not a string!");
}
}
diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp
index aee93e7696..82d1957214 100644
--- a/lib/TableGen/TGParser.cpp
+++ b/lib/TableGen/TGParser.cpp
@@ -864,8 +864,8 @@ Init *TGParser::ParseOperation(Record *CurRec) {
return 0;
}
if (LHSt) {
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LHSt->getType());
- StringRecTy *SType = dynamic_cast<StringRecTy*>(LHSt->getType());
+ ListRecTy *LType = dyn_cast<ListRecTy>(LHSt->getType());
+ StringRecTy *SType = dyn_cast<StringRecTy>(LHSt->getType());
if (LType == 0 && SType == 0) {
TokError("expected list or string type argumnet in unary operator");
return 0;
@@ -897,7 +897,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
}
} else {
assert(LHSt && "expected list type argument in unary operator");
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LHSt->getType());
+ ListRecTy *LType = dyn_cast<ListRecTy>(LHSt->getType());
if (LType == 0) {
TokError("expected list type argumnet in unary operator");
return 0;
@@ -1271,7 +1271,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType,
ListRecTy *GivenListTy = 0;
if (ItemType != 0) {
- ListRecTy *ListType = dynamic_cast<ListRecTy*>(ItemType);
+ ListRecTy *ListType = dyn_cast<ListRecTy>(ItemType);
if (ListType == 0) {
std::stringstream s;
s << "Type mismatch for list, expected list type, got "
@@ -1723,7 +1723,7 @@ VarInit *TGParser::ParseForeachDeclaration(ListInit *&ForeachListValue) {
return 0;
}
RecTy *ValueType = ForeachListValue->getType();
- ListRecTy *ListType = dynamic_cast<ListRecTy *>(ValueType);
+ ListRecTy *ListType = dyn_cast<ListRecTy>(ValueType);
if (ListType == 0) {
TokError("Value list is not of list type");
return 0;