@@ -1033,15 +1033,15 @@ class EmitterBase {
1033
1033
// to expand Tablegen classes like 'Vector' which mean something different in
1034
1034
// each member of a parametric family.
1035
1035
const Type *getType (const Record *R, const Type *Param);
1036
- const Type *getType (DagInit *D, const Type *Param);
1037
- const Type *getType (Init *I, const Type *Param);
1036
+ const Type *getType (const DagInit *D, const Type *Param);
1037
+ const Type *getType (const Init *I, const Type *Param);
1038
1038
1039
1039
// Functions that translate the Tablegen representation of an intrinsic's
1040
1040
// code generation into a collection of Value objects (which will then be
1041
1041
// reprocessed to read out the actual C++ code included by CGBuiltin.cpp).
1042
- Result::Ptr getCodeForDag (DagInit *D, const Result::Scope &Scope,
1042
+ Result::Ptr getCodeForDag (const DagInit *D, const Result::Scope &Scope,
1043
1043
const Type *Param);
1044
- Result::Ptr getCodeForDagArg (DagInit *D, unsigned ArgNum,
1044
+ Result::Ptr getCodeForDagArg (const DagInit *D, unsigned ArgNum,
1045
1045
const Result::Scope &Scope, const Type *Param);
1046
1046
Result::Ptr getCodeForArg (unsigned ArgNum, const Type *ArgType, bool Promote,
1047
1047
bool Immediate);
@@ -1060,10 +1060,10 @@ class EmitterBase {
1060
1060
void EmitBuiltinAliases (raw_ostream &OS);
1061
1061
};
1062
1062
1063
- const Type *EmitterBase::getType (Init *I, const Type *Param) {
1064
- if (auto Dag = dyn_cast<DagInit>(I))
1063
+ const Type *EmitterBase::getType (const Init *I, const Type *Param) {
1064
+ if (const auto * Dag = dyn_cast<DagInit>(I))
1065
1065
return getType (Dag, Param);
1066
- if (auto Def = dyn_cast<DefInit>(I))
1066
+ if (const auto * Def = dyn_cast<DefInit>(I))
1067
1067
return getType (Def->getDef (), Param);
1068
1068
1069
1069
PrintFatalError (" Could not convert this value into a type" );
@@ -1088,7 +1088,7 @@ const Type *EmitterBase::getType(const Record *R, const Type *Param) {
1088
1088
PrintFatalError (R->getLoc (), " Could not convert this record into a type" );
1089
1089
}
1090
1090
1091
- const Type *EmitterBase::getType (DagInit *D, const Type *Param) {
1091
+ const Type *EmitterBase::getType (const DagInit *D, const Type *Param) {
1092
1092
// The meat of the getType system: types in the Tablegen are represented by a
1093
1093
// dag whose operators select sub-cases of this function.
1094
1094
@@ -1156,7 +1156,8 @@ const Type *EmitterBase::getType(DagInit *D, const Type *Param) {
1156
1156
PrintFatalError (" Bad operator in type dag expression" );
1157
1157
}
1158
1158
1159
- Result::Ptr EmitterBase::getCodeForDag (DagInit *D, const Result::Scope &Scope,
1159
+ Result::Ptr EmitterBase::getCodeForDag (const DagInit *D,
1160
+ const Result::Scope &Scope,
1160
1161
const Type *Param) {
1161
1162
const Record *Op = cast<DefInit>(D->getOperator ())->getDef ();
1162
1163
@@ -1199,14 +1200,14 @@ Result::Ptr EmitterBase::getCodeForDag(DagInit *D, const Result::Scope &Scope,
1199
1200
Result::Ptr Arg = getCodeForDagArg (D, 0 , Scope, Param);
1200
1201
1201
1202
const Type *Ty = nullptr ;
1202
- if (auto *DI = dyn_cast<DagInit>(D->getArg (0 )))
1203
+ if (const auto *DI = dyn_cast<DagInit>(D->getArg (0 )))
1203
1204
if (auto *PTy = dyn_cast<PointerType>(getType (DI->getOperator (), Param)))
1204
1205
Ty = PTy->getPointeeType ();
1205
1206
if (!Ty)
1206
1207
PrintFatalError (" 'address' pointer argument should be a pointer" );
1207
1208
1208
1209
unsigned Alignment;
1209
- if (auto *II = dyn_cast<IntInit>(D->getArg (1 ))) {
1210
+ if (const auto *II = dyn_cast<IntInit>(D->getArg (1 ))) {
1210
1211
Alignment = II->getValue ();
1211
1212
} else {
1212
1213
PrintFatalError (" 'address' alignment argument should be an integer" );
@@ -1267,10 +1268,10 @@ Result::Ptr EmitterBase::getCodeForDag(DagInit *D, const Result::Scope &Scope,
1267
1268
}
1268
1269
}
1269
1270
1270
- Result::Ptr EmitterBase::getCodeForDagArg (DagInit *D, unsigned ArgNum,
1271
+ Result::Ptr EmitterBase::getCodeForDagArg (const DagInit *D, unsigned ArgNum,
1271
1272
const Result::Scope &Scope,
1272
1273
const Type *Param) {
1273
- Init *Arg = D->getArg (ArgNum);
1274
+ const Init *Arg = D->getArg (ArgNum);
1274
1275
StringRef Name = D->getArgNameStr (ArgNum);
1275
1276
1276
1277
if (!Name.empty ()) {
@@ -1286,18 +1287,18 @@ Result::Ptr EmitterBase::getCodeForDagArg(DagInit *D, unsigned ArgNum,
1286
1287
// Sometimes the Arg is a bit. Prior to multiclass template argument
1287
1288
// checking, integers would sneak through the bit declaration,
1288
1289
// but now they really are bits.
1289
- if (auto *BI = dyn_cast<BitInit>(Arg))
1290
+ if (const auto *BI = dyn_cast<BitInit>(Arg))
1290
1291
return std::make_shared<IntLiteralResult>(getScalarType (" u32" ),
1291
1292
BI->getValue ());
1292
1293
1293
- if (auto *II = dyn_cast<IntInit>(Arg))
1294
+ if (const auto *II = dyn_cast<IntInit>(Arg))
1294
1295
return std::make_shared<IntLiteralResult>(getScalarType (" u32" ),
1295
1296
II->getValue ());
1296
1297
1297
- if (auto *DI = dyn_cast<DagInit>(Arg))
1298
+ if (const auto *DI = dyn_cast<DagInit>(Arg))
1298
1299
return getCodeForDag (DI, Scope, Param);
1299
1300
1300
- if (auto *DI = dyn_cast<DefInit>(Arg)) {
1301
+ if (const auto *DI = dyn_cast<DefInit>(Arg)) {
1301
1302
const Record *Rec = DI->getDef ();
1302
1303
if (Rec->isSubClassOf (" Type" )) {
1303
1304
const Type *T = getType (Rec, Param);
@@ -1307,7 +1308,7 @@ Result::Ptr EmitterBase::getCodeForDagArg(DagInit *D, unsigned ArgNum,
1307
1308
1308
1309
PrintError (" bad DAG argument type for code generation" );
1309
1310
PrintNote (" DAG: " + D->getAsString ());
1310
- if (TypedInit *Typed = dyn_cast<TypedInit>(Arg))
1311
+ if (const auto *Typed = dyn_cast<TypedInit>(Arg))
1311
1312
PrintNote (" argument type: " + Typed->getType ()->getAsString ());
1312
1313
PrintFatalNote (" argument number " + Twine (ArgNum) + " : " + Arg->getAsString ());
1313
1314
}
@@ -1379,13 +1380,13 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
1379
1380
HeaderOnly = R->getValueAsBit (" headerOnly" );
1380
1381
1381
1382
// Process the intrinsic's argument list.
1382
- DagInit *ArgsDag = R->getValueAsDag (" args" );
1383
+ const DagInit *ArgsDag = R->getValueAsDag (" args" );
1383
1384
Result::Scope Scope;
1384
1385
for (unsigned i = 0 , e = ArgsDag->getNumArgs (); i < e; ++i) {
1385
- Init *TypeInit = ArgsDag->getArg (i);
1386
+ const Init *TypeInit = ArgsDag->getArg (i);
1386
1387
1387
1388
bool Promote = true ;
1388
- if (auto TypeDI = dyn_cast<DefInit>(TypeInit))
1389
+ if (const auto * TypeDI = dyn_cast<DefInit>(TypeInit))
1389
1390
if (TypeDI->getDef ()->isSubClassOf (" unpromoted" ))
1390
1391
Promote = false ;
1391
1392
@@ -1397,7 +1398,7 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
1397
1398
// If the argument is a subclass of Immediate, record the details about
1398
1399
// what values it can take, for Sema checking.
1399
1400
bool Immediate = false ;
1400
- if (auto TypeDI = dyn_cast<DefInit>(TypeInit)) {
1401
+ if (const auto * TypeDI = dyn_cast<DefInit>(TypeInit)) {
1401
1402
const Record *TypeRec = TypeDI->getDef ();
1402
1403
if (TypeRec->isSubClassOf (" Immediate" )) {
1403
1404
Immediate = true ;
@@ -1444,7 +1445,7 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
1444
1445
1445
1446
// Finally, go through the codegen dag and translate it into a Result object
1446
1447
// (with an arbitrary DAG of depended-on Results hanging off it).
1447
- DagInit *CodeDag = R->getValueAsDag (" codegen" );
1448
+ const DagInit *CodeDag = R->getValueAsDag (" codegen" );
1448
1449
const Record *MainOp = cast<DefInit>(CodeDag->getOperator ())->getDef ();
1449
1450
if (MainOp->isSubClassOf (" CustomCodegen" )) {
1450
1451
// Or, if it's the special case of CustomCodegen, just accumulate
@@ -1456,9 +1457,9 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
1456
1457
StringRef Name = CodeDag->getArgNameStr (i);
1457
1458
if (Name.empty ()) {
1458
1459
PrintFatalError (" Operands to CustomCodegen should have names" );
1459
- } else if (auto *II = dyn_cast<IntInit>(CodeDag->getArg (i))) {
1460
+ } else if (const auto *II = dyn_cast<IntInit>(CodeDag->getArg (i))) {
1460
1461
CustomCodeGenArgs[std::string (Name)] = itostr (II->getValue ());
1461
- } else if (auto *SI = dyn_cast<StringInit>(CodeDag->getArg (i))) {
1462
+ } else if (const auto *SI = dyn_cast<StringInit>(CodeDag->getArg (i))) {
1462
1463
CustomCodeGenArgs[std::string (Name)] = std::string (SI->getValue ());
1463
1464
} else {
1464
1465
PrintFatalError (" Operands to CustomCodegen should be integers" );
0 commit comments