mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-29 06:30:30 +00:00
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
This commit is contained in:
parent
89adeb225d
commit
736ceace11
@ -1085,9 +1085,9 @@ class VarBitInit : public Init {
|
||||
|
||||
VarBitInit(TypedInit *T, unsigned B) : TI(T), Bit(B) {
|
||||
assert(T->getType() &&
|
||||
(dynamic_cast<IntRecTy*>(T->getType()) ||
|
||||
(dynamic_cast<BitsRecTy*>(T->getType()) &&
|
||||
dynamic_cast<BitsRecTy*>(T->getType())->getNumBits() > B)) &&
|
||||
(dyn_cast<IntRecTy>(T->getType()) ||
|
||||
(dyn_cast<BitsRecTy>(T->getType()) &&
|
||||
dyn_cast<BitsRecTy>(T->getType())->getNumBits() > B)) &&
|
||||
"Illegal VarBitInit expression!");
|
||||
}
|
||||
|
||||
@ -1120,9 +1120,9 @@ class VarListElementInit : public TypedInit {
|
||||
unsigned Element;
|
||||
|
||||
VarListElementInit(TypedInit *T, unsigned E)
|
||||
: TypedInit(dynamic_cast<ListRecTy*>(T->getType())->getElementType()),
|
||||
: TypedInit(dyn_cast<ListRecTy>(T->getType())->getElementType()),
|
||||
TI(T), Element(E) {
|
||||
assert(T->getType() && dynamic_cast<ListRecTy*>(T->getType()) &&
|
||||
assert(T->getType() && dyn_cast<ListRecTy>(T->getType()) &&
|
||||
"Illegal VarBitInit expression!");
|
||||
}
|
||||
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -1758,7 +1758,7 @@ static bool populateInstruction(const CodeGenInstruction &CGI, unsigned Opc,
|
||||
// FIXME: This need to be extended to handle instructions with custom
|
||||
// decoder methods, and operands with (simple) MIOperandInfo's.
|
||||
TypedInit *TI = dynamic_cast<TypedInit*>(NI->first);
|
||||
RecordRecTy *Type = dynamic_cast<RecordRecTy*>(TI->getType());
|
||||
RecordRecTy *Type = dyn_cast<RecordRecTy>(TI->getType());
|
||||
Record *TypeRecord = Type->getRecord();
|
||||
bool isReg = false;
|
||||
if (TypeRecord->isSubClassOf("RegisterOperand"))
|
||||
|
Loading…
Reference in New Issue
Block a user