@@ -552,7 +552,7 @@ void CodeGenSchedModels::addProcModel(const Record *ProcDef) {
552552
553553 std::string Name = std::string (ModelKey->getName ());
554554 if (ModelKey->isSubClassOf (" SchedMachineModel" )) {
555- Record *ItinsDef = ModelKey->getValueAsDef (" Itineraries" );
555+ const Record *ItinsDef = ModelKey->getValueAsDef (" Itineraries" );
556556 ProcModels.emplace_back (ProcModels.size (), Name, ModelKey, ItinsDef);
557557 } else {
558558 // An itinerary is defined without a machine model. Infer a new model.
@@ -674,9 +674,9 @@ void CodeGenSchedModels::collectSchedRW() {
674674 }
675675 // Initialize Aliases vectors.
676676 for (const Record *ADef : AliasDefs) {
677- Record *AliasDef = ADef->getValueAsDef (" AliasRW" );
677+ const Record *AliasDef = ADef->getValueAsDef (" AliasRW" );
678678 getSchedRW (AliasDef).IsAlias = true ;
679- Record *MatchDef = ADef->getValueAsDef (" MatchRW" );
679+ const Record *MatchDef = ADef->getValueAsDef (" MatchRW" );
680680 CodeGenSchedRW &RW = getSchedRW (MatchDef);
681681 if (RW.IsAlias )
682682 PrintFatalError (ADef->getLoc (), " Cannot Alias an Alias" );
@@ -781,7 +781,7 @@ void CodeGenSchedModels::expandRWSeqForProc(
781781 for (const Record *Rec : SchedWrite.Aliases ) {
782782 const CodeGenSchedRW &AliasRW = getSchedRW (Rec->getValueAsDef (" AliasRW" ));
783783 if (Rec->getValueInit (" SchedModel" )->isComplete ()) {
784- Record *ModelDef = Rec->getValueAsDef (" SchedModel" );
784+ const Record *ModelDef = Rec->getValueAsDef (" SchedModel" );
785785 if (&getProcModel (ModelDef) != &ProcModel)
786786 continue ;
787787 }
@@ -854,7 +854,7 @@ void CodeGenSchedModels::collectSchedClasses() {
854854 // Create a SchedClass for each unique combination of itinerary class and
855855 // SchedRW list.
856856 for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue ()) {
857- Record *ItinDef = Inst->TheDef ->getValueAsDef (" Itinerary" );
857+ const Record *ItinDef = Inst->TheDef ->getValueAsDef (" Itinerary" );
858858 IdxVec Writes, Reads;
859859 if (!Inst->TheDef ->isValueUnset (" SchedRW" ))
860860 findRWs (Inst->TheDef ->getValueAsListOfDefs (" SchedRW" ), Writes, Reads);
@@ -1050,7 +1050,7 @@ void CodeGenSchedModels::createInstRWClass(const Record *InstRWDef) {
10501050 if (OrigNumInstrs == InstDefs.size ()) {
10511051 assert (SchedClasses[OldSCIdx].ProcIndices [0 ] == 0 &&
10521052 " expected a generic SchedClass" );
1053- Record *RWModelDef = InstRWDef->getValueAsDef (" SchedModel" );
1053+ const Record *RWModelDef = InstRWDef->getValueAsDef (" SchedModel" );
10541054 // Make sure we didn't already have a InstRW containing this
10551055 // instruction on this model.
10561056 for (const Record *RWD : RWDefs) {
@@ -1279,7 +1279,7 @@ struct PredCheck {
12791279 unsigned RWIdx;
12801280 const Record *Predicate;
12811281
1282- PredCheck (bool r, unsigned w, Record *p)
1282+ PredCheck (bool r, unsigned w, const Record *p)
12831283 : IsRead(r), RWIdx(w), Predicate(p) {}
12841284};
12851285
@@ -1318,7 +1318,7 @@ class PredTransitions {
13181318#endif
13191319
13201320private:
1321- bool mutuallyExclusive (Record *PredDef, ArrayRef<Record *> Preds,
1321+ bool mutuallyExclusive (const Record *PredDef, ArrayRef<const Record *> Preds,
13221322 ArrayRef<PredCheck> Term);
13231323 void getIntersectingVariants (const CodeGenSchedRW &SchedRW, unsigned TransIdx,
13241324 std::vector<TransVariant> &IntersectingVariants);
@@ -1336,8 +1336,8 @@ class PredTransitions {
13361336// predicates are not exclusive because the predicates for a given SchedWrite
13371337// are always checked in the order they are defined in the .td file. Later
13381338// conditions implicitly negate any prior condition.
1339- bool PredTransitions::mutuallyExclusive (Record *PredDef,
1340- ArrayRef<Record *> Preds,
1339+ bool PredTransitions::mutuallyExclusive (const Record *PredDef,
1340+ ArrayRef<const Record *> Preds,
13411341 ArrayRef<PredCheck> Term) {
13421342 for (const PredCheck &PC : Term) {
13431343 if (PC.Predicate == PredDef)
@@ -1382,9 +1382,9 @@ bool PredTransitions::mutuallyExclusive(Record *PredDef,
13821382 return false ;
13831383}
13841384
1385- static std::vector<Record *> getAllPredicates (ArrayRef<TransVariant> Variants,
1386- unsigned ProcId) {
1387- std::vector<Record *> Preds;
1385+ static std::vector<const Record *>
1386+ getAllPredicates (ArrayRef<TransVariant> Variants, unsigned ProcId) {
1387+ std::vector<const Record *> Preds;
13881388 for (auto &Variant : Variants) {
13891389 if (!Variant.VarOrSeqDef ->isSubClassOf (" SchedVar" ))
13901390 continue ;
@@ -1406,7 +1406,7 @@ void PredTransitions::getIntersectingVariants(
14061406 if (SchedRW.HasVariants ) {
14071407 unsigned VarProcIdx = 0 ;
14081408 if (SchedRW.TheDef ->getValueInit (" SchedModel" )->isComplete ()) {
1409- Record *ModelDef = SchedRW.TheDef ->getValueAsDef (" SchedModel" );
1409+ const Record *ModelDef = SchedRW.TheDef ->getValueAsDef (" SchedModel" );
14101410 VarProcIdx = SchedModels.getProcModel (ModelDef).Index ;
14111411 }
14121412 if (VarProcIdx == 0 || VarProcIdx == TransVec[TransIdx].ProcIndex ) {
@@ -1425,7 +1425,7 @@ void PredTransitions::getIntersectingVariants(
14251425 // that processor.
14261426 unsigned AliasProcIdx = 0 ;
14271427 if ((*AI)->getValueInit (" SchedModel" )->isComplete ()) {
1428- Record *ModelDef = (*AI)->getValueAsDef (" SchedModel" );
1428+ const Record *ModelDef = (*AI)->getValueAsDef (" SchedModel" );
14291429 AliasProcIdx = SchedModels.getProcModel (ModelDef).Index ;
14301430 }
14311431 if (AliasProcIdx && AliasProcIdx != TransVec[TransIdx].ProcIndex )
@@ -1451,13 +1451,13 @@ void PredTransitions::getIntersectingVariants(
14511451 if (AliasProcIdx == 0 )
14521452 GenericRW = true ;
14531453 }
1454- std::vector<Record *> AllPreds =
1454+ std::vector<const Record *> AllPreds =
14551455 getAllPredicates (Variants, TransVec[TransIdx].ProcIndex );
14561456 for (TransVariant &Variant : Variants) {
14571457 // Don't expand variants if the processor models don't intersect.
14581458 // A zero processor index means any processor.
14591459 if (Variant.VarOrSeqDef ->isSubClassOf (" SchedVar" )) {
1460- Record *PredDef = Variant.VarOrSeqDef ->getValueAsDef (" Predicate" );
1460+ const Record *PredDef = Variant.VarOrSeqDef ->getValueAsDef (" Predicate" );
14611461 if (mutuallyExclusive (PredDef, AllPreds, TransVec[TransIdx].PredTerm ))
14621462 continue ;
14631463 }
@@ -1489,7 +1489,7 @@ void PredTransitions::pushVariant(const TransVariant &VInfo, bool IsRead) {
14891489 // then the whole transition is specific to this processor.
14901490 IdxVec SelectedRWs;
14911491 if (VInfo.VarOrSeqDef ->isSubClassOf (" SchedVar" )) {
1492- Record *PredDef = VInfo.VarOrSeqDef ->getValueAsDef (" Predicate" );
1492+ const Record *PredDef = VInfo.VarOrSeqDef ->getValueAsDef (" Predicate" );
14931493 Trans.PredTerm .emplace_back (IsRead, VInfo.RWIdx , PredDef);
14941494 ConstRecVec SelectedDefs =
14951495 VInfo.VarOrSeqDef ->getValueAsListOfDefs (" Selected" );
@@ -1861,7 +1861,7 @@ void CodeGenSchedModels::collectProcResources() {
18611861 // This class may have a default ReadWrite list which can be overriden by
18621862 // InstRW definitions.
18631863 for (const Record *RW : SC.InstRWs ) {
1864- Record *RWModelDef = RW->getValueAsDef (" SchedModel" );
1864+ const Record *RWModelDef = RW->getValueAsDef (" SchedModel" );
18651865 unsigned PIdx = getProcModel (RWModelDef).Index ;
18661866 IdxVec Writes, Reads;
18671867 findRWs (RW->getValueAsListOfDefs (" OperandReadWrites" ), Writes, Reads);
0 commit comments