@@ -1033,15 +1033,15 @@ class EmitterBase {
10331033 // to expand Tablegen classes like 'Vector' which mean something different in
10341034 // each member of a parametric family.
10351035 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);
10381038
10391039 // Functions that translate the Tablegen representation of an intrinsic's
10401040 // code generation into a collection of Value objects (which will then be
10411041 // 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,
10431043 const Type *Param);
1044- Result::Ptr getCodeForDagArg (DagInit *D, unsigned ArgNum,
1044+ Result::Ptr getCodeForDagArg (const DagInit *D, unsigned ArgNum,
10451045 const Result::Scope &Scope, const Type *Param);
10461046 Result::Ptr getCodeForArg (unsigned ArgNum, const Type *ArgType, bool Promote,
10471047 bool Immediate);
@@ -1060,10 +1060,10 @@ class EmitterBase {
10601060 void EmitBuiltinAliases (raw_ostream &OS);
10611061};
10621062
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))
10651065 return getType (Dag, Param);
1066- if (auto Def = dyn_cast<DefInit>(I))
1066+ if (const auto * Def = dyn_cast<DefInit>(I))
10671067 return getType (Def->getDef (), Param);
10681068
10691069 PrintFatalError (" Could not convert this value into a type" );
@@ -1088,7 +1088,7 @@ const Type *EmitterBase::getType(const Record *R, const Type *Param) {
10881088 PrintFatalError (R->getLoc (), " Could not convert this record into a type" );
10891089}
10901090
1091- const Type *EmitterBase::getType (DagInit *D, const Type *Param) {
1091+ const Type *EmitterBase::getType (const DagInit *D, const Type *Param) {
10921092 // The meat of the getType system: types in the Tablegen are represented by a
10931093 // dag whose operators select sub-cases of this function.
10941094
@@ -1156,7 +1156,8 @@ const Type *EmitterBase::getType(DagInit *D, const Type *Param) {
11561156 PrintFatalError (" Bad operator in type dag expression" );
11571157}
11581158
1159- Result::Ptr EmitterBase::getCodeForDag (DagInit *D, const Result::Scope &Scope,
1159+ Result::Ptr EmitterBase::getCodeForDag (const DagInit *D,
1160+ const Result::Scope &Scope,
11601161 const Type *Param) {
11611162 const Record *Op = cast<DefInit>(D->getOperator ())->getDef ();
11621163
@@ -1199,14 +1200,14 @@ Result::Ptr EmitterBase::getCodeForDag(DagInit *D, const Result::Scope &Scope,
11991200 Result::Ptr Arg = getCodeForDagArg (D, 0 , Scope, Param);
12001201
12011202 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 )))
12031204 if (auto *PTy = dyn_cast<PointerType>(getType (DI->getOperator (), Param)))
12041205 Ty = PTy->getPointeeType ();
12051206 if (!Ty)
12061207 PrintFatalError (" 'address' pointer argument should be a pointer" );
12071208
12081209 unsigned Alignment;
1209- if (auto *II = dyn_cast<IntInit>(D->getArg (1 ))) {
1210+ if (const auto *II = dyn_cast<IntInit>(D->getArg (1 ))) {
12101211 Alignment = II->getValue ();
12111212 } else {
12121213 PrintFatalError (" 'address' alignment argument should be an integer" );
@@ -1267,10 +1268,10 @@ Result::Ptr EmitterBase::getCodeForDag(DagInit *D, const Result::Scope &Scope,
12671268 }
12681269}
12691270
1270- Result::Ptr EmitterBase::getCodeForDagArg (DagInit *D, unsigned ArgNum,
1271+ Result::Ptr EmitterBase::getCodeForDagArg (const DagInit *D, unsigned ArgNum,
12711272 const Result::Scope &Scope,
12721273 const Type *Param) {
1273- Init *Arg = D->getArg (ArgNum);
1274+ const Init *Arg = D->getArg (ArgNum);
12741275 StringRef Name = D->getArgNameStr (ArgNum);
12751276
12761277 if (!Name.empty ()) {
@@ -1286,18 +1287,18 @@ Result::Ptr EmitterBase::getCodeForDagArg(DagInit *D, unsigned ArgNum,
12861287 // Sometimes the Arg is a bit. Prior to multiclass template argument
12871288 // checking, integers would sneak through the bit declaration,
12881289 // but now they really are bits.
1289- if (auto *BI = dyn_cast<BitInit>(Arg))
1290+ if (const auto *BI = dyn_cast<BitInit>(Arg))
12901291 return std::make_shared<IntLiteralResult>(getScalarType (" u32" ),
12911292 BI->getValue ());
12921293
1293- if (auto *II = dyn_cast<IntInit>(Arg))
1294+ if (const auto *II = dyn_cast<IntInit>(Arg))
12941295 return std::make_shared<IntLiteralResult>(getScalarType (" u32" ),
12951296 II->getValue ());
12961297
1297- if (auto *DI = dyn_cast<DagInit>(Arg))
1298+ if (const auto *DI = dyn_cast<DagInit>(Arg))
12981299 return getCodeForDag (DI, Scope, Param);
12991300
1300- if (auto *DI = dyn_cast<DefInit>(Arg)) {
1301+ if (const auto *DI = dyn_cast<DefInit>(Arg)) {
13011302 const Record *Rec = DI->getDef ();
13021303 if (Rec->isSubClassOf (" Type" )) {
13031304 const Type *T = getType (Rec, Param);
@@ -1307,7 +1308,7 @@ Result::Ptr EmitterBase::getCodeForDagArg(DagInit *D, unsigned ArgNum,
13071308
13081309 PrintError (" bad DAG argument type for code generation" );
13091310 PrintNote (" DAG: " + D->getAsString ());
1310- if (TypedInit *Typed = dyn_cast<TypedInit>(Arg))
1311+ if (const auto *Typed = dyn_cast<TypedInit>(Arg))
13111312 PrintNote (" argument type: " + Typed->getType ()->getAsString ());
13121313 PrintFatalNote (" argument number " + Twine (ArgNum) + " : " + Arg->getAsString ());
13131314}
@@ -1379,13 +1380,13 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
13791380 HeaderOnly = R->getValueAsBit (" headerOnly" );
13801381
13811382 // Process the intrinsic's argument list.
1382- DagInit *ArgsDag = R->getValueAsDag (" args" );
1383+ const DagInit *ArgsDag = R->getValueAsDag (" args" );
13831384 Result::Scope Scope;
13841385 for (unsigned i = 0 , e = ArgsDag->getNumArgs (); i < e; ++i) {
1385- Init *TypeInit = ArgsDag->getArg (i);
1386+ const Init *TypeInit = ArgsDag->getArg (i);
13861387
13871388 bool Promote = true ;
1388- if (auto TypeDI = dyn_cast<DefInit>(TypeInit))
1389+ if (const auto * TypeDI = dyn_cast<DefInit>(TypeInit))
13891390 if (TypeDI->getDef ()->isSubClassOf (" unpromoted" ))
13901391 Promote = false ;
13911392
@@ -1397,7 +1398,7 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
13971398 // If the argument is a subclass of Immediate, record the details about
13981399 // what values it can take, for Sema checking.
13991400 bool Immediate = false ;
1400- if (auto TypeDI = dyn_cast<DefInit>(TypeInit)) {
1401+ if (const auto * TypeDI = dyn_cast<DefInit>(TypeInit)) {
14011402 const Record *TypeRec = TypeDI->getDef ();
14021403 if (TypeRec->isSubClassOf (" Immediate" )) {
14031404 Immediate = true ;
@@ -1444,7 +1445,7 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
14441445
14451446 // Finally, go through the codegen dag and translate it into a Result object
14461447 // (with an arbitrary DAG of depended-on Results hanging off it).
1447- DagInit *CodeDag = R->getValueAsDag (" codegen" );
1448+ const DagInit *CodeDag = R->getValueAsDag (" codegen" );
14481449 const Record *MainOp = cast<DefInit>(CodeDag->getOperator ())->getDef ();
14491450 if (MainOp->isSubClassOf (" CustomCodegen" )) {
14501451 // Or, if it's the special case of CustomCodegen, just accumulate
@@ -1456,9 +1457,9 @@ ACLEIntrinsic::ACLEIntrinsic(EmitterBase &ME, const Record *R,
14561457 StringRef Name = CodeDag->getArgNameStr (i);
14571458 if (Name.empty ()) {
14581459 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))) {
14601461 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))) {
14621463 CustomCodeGenArgs[std::string (Name)] = std::string (SI->getValue ());
14631464 } else {
14641465 PrintFatalError (" Operands to CustomCodegen should be integers" );
0 commit comments