@@ -552,7 +552,7 @@ void CodeGenSchedModels::addProcModel(const Record *ProcDef) {
552
552
553
553
std::string Name = std::string (ModelKey->getName ());
554
554
if (ModelKey->isSubClassOf (" SchedMachineModel" )) {
555
- Record *ItinsDef = ModelKey->getValueAsDef (" Itineraries" );
555
+ const Record *ItinsDef = ModelKey->getValueAsDef (" Itineraries" );
556
556
ProcModels.emplace_back (ProcModels.size (), Name, ModelKey, ItinsDef);
557
557
} else {
558
558
// An itinerary is defined without a machine model. Infer a new model.
@@ -674,9 +674,9 @@ void CodeGenSchedModels::collectSchedRW() {
674
674
}
675
675
// Initialize Aliases vectors.
676
676
for (const Record *ADef : AliasDefs) {
677
- Record *AliasDef = ADef->getValueAsDef (" AliasRW" );
677
+ const Record *AliasDef = ADef->getValueAsDef (" AliasRW" );
678
678
getSchedRW (AliasDef).IsAlias = true ;
679
- Record *MatchDef = ADef->getValueAsDef (" MatchRW" );
679
+ const Record *MatchDef = ADef->getValueAsDef (" MatchRW" );
680
680
CodeGenSchedRW &RW = getSchedRW (MatchDef);
681
681
if (RW.IsAlias )
682
682
PrintFatalError (ADef->getLoc (), " Cannot Alias an Alias" );
@@ -781,7 +781,7 @@ void CodeGenSchedModels::expandRWSeqForProc(
781
781
for (const Record *Rec : SchedWrite.Aliases ) {
782
782
const CodeGenSchedRW &AliasRW = getSchedRW (Rec->getValueAsDef (" AliasRW" ));
783
783
if (Rec->getValueInit (" SchedModel" )->isComplete ()) {
784
- Record *ModelDef = Rec->getValueAsDef (" SchedModel" );
784
+ const Record *ModelDef = Rec->getValueAsDef (" SchedModel" );
785
785
if (&getProcModel (ModelDef) != &ProcModel)
786
786
continue ;
787
787
}
@@ -854,7 +854,7 @@ void CodeGenSchedModels::collectSchedClasses() {
854
854
// Create a SchedClass for each unique combination of itinerary class and
855
855
// SchedRW list.
856
856
for (const CodeGenInstruction *Inst : Target.getInstructionsByEnumValue ()) {
857
- Record *ItinDef = Inst->TheDef ->getValueAsDef (" Itinerary" );
857
+ const Record *ItinDef = Inst->TheDef ->getValueAsDef (" Itinerary" );
858
858
IdxVec Writes, Reads;
859
859
if (!Inst->TheDef ->isValueUnset (" SchedRW" ))
860
860
findRWs (Inst->TheDef ->getValueAsListOfDefs (" SchedRW" ), Writes, Reads);
@@ -1050,7 +1050,7 @@ void CodeGenSchedModels::createInstRWClass(const Record *InstRWDef) {
1050
1050
if (OrigNumInstrs == InstDefs.size ()) {
1051
1051
assert (SchedClasses[OldSCIdx].ProcIndices [0 ] == 0 &&
1052
1052
" expected a generic SchedClass" );
1053
- Record *RWModelDef = InstRWDef->getValueAsDef (" SchedModel" );
1053
+ const Record *RWModelDef = InstRWDef->getValueAsDef (" SchedModel" );
1054
1054
// Make sure we didn't already have a InstRW containing this
1055
1055
// instruction on this model.
1056
1056
for (const Record *RWD : RWDefs) {
@@ -1279,7 +1279,7 @@ struct PredCheck {
1279
1279
unsigned RWIdx;
1280
1280
const Record *Predicate;
1281
1281
1282
- PredCheck (bool r, unsigned w, Record *p)
1282
+ PredCheck (bool r, unsigned w, const Record *p)
1283
1283
: IsRead(r), RWIdx(w), Predicate(p) {}
1284
1284
};
1285
1285
@@ -1318,7 +1318,7 @@ class PredTransitions {
1318
1318
#endif
1319
1319
1320
1320
private:
1321
- bool mutuallyExclusive (Record *PredDef, ArrayRef<Record *> Preds,
1321
+ bool mutuallyExclusive (const Record *PredDef, ArrayRef<const Record *> Preds,
1322
1322
ArrayRef<PredCheck> Term);
1323
1323
void getIntersectingVariants (const CodeGenSchedRW &SchedRW, unsigned TransIdx,
1324
1324
std::vector<TransVariant> &IntersectingVariants);
@@ -1336,8 +1336,8 @@ class PredTransitions {
1336
1336
// predicates are not exclusive because the predicates for a given SchedWrite
1337
1337
// are always checked in the order they are defined in the .td file. Later
1338
1338
// 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,
1341
1341
ArrayRef<PredCheck> Term) {
1342
1342
for (const PredCheck &PC : Term) {
1343
1343
if (PC.Predicate == PredDef)
@@ -1382,9 +1382,9 @@ bool PredTransitions::mutuallyExclusive(Record *PredDef,
1382
1382
return false ;
1383
1383
}
1384
1384
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;
1388
1388
for (auto &Variant : Variants) {
1389
1389
if (!Variant.VarOrSeqDef ->isSubClassOf (" SchedVar" ))
1390
1390
continue ;
@@ -1406,7 +1406,7 @@ void PredTransitions::getIntersectingVariants(
1406
1406
if (SchedRW.HasVariants ) {
1407
1407
unsigned VarProcIdx = 0 ;
1408
1408
if (SchedRW.TheDef ->getValueInit (" SchedModel" )->isComplete ()) {
1409
- Record *ModelDef = SchedRW.TheDef ->getValueAsDef (" SchedModel" );
1409
+ const Record *ModelDef = SchedRW.TheDef ->getValueAsDef (" SchedModel" );
1410
1410
VarProcIdx = SchedModels.getProcModel (ModelDef).Index ;
1411
1411
}
1412
1412
if (VarProcIdx == 0 || VarProcIdx == TransVec[TransIdx].ProcIndex ) {
@@ -1425,7 +1425,7 @@ void PredTransitions::getIntersectingVariants(
1425
1425
// that processor.
1426
1426
unsigned AliasProcIdx = 0 ;
1427
1427
if ((*AI)->getValueInit (" SchedModel" )->isComplete ()) {
1428
- Record *ModelDef = (*AI)->getValueAsDef (" SchedModel" );
1428
+ const Record *ModelDef = (*AI)->getValueAsDef (" SchedModel" );
1429
1429
AliasProcIdx = SchedModels.getProcModel (ModelDef).Index ;
1430
1430
}
1431
1431
if (AliasProcIdx && AliasProcIdx != TransVec[TransIdx].ProcIndex )
@@ -1451,13 +1451,13 @@ void PredTransitions::getIntersectingVariants(
1451
1451
if (AliasProcIdx == 0 )
1452
1452
GenericRW = true ;
1453
1453
}
1454
- std::vector<Record *> AllPreds =
1454
+ std::vector<const Record *> AllPreds =
1455
1455
getAllPredicates (Variants, TransVec[TransIdx].ProcIndex );
1456
1456
for (TransVariant &Variant : Variants) {
1457
1457
// Don't expand variants if the processor models don't intersect.
1458
1458
// A zero processor index means any processor.
1459
1459
if (Variant.VarOrSeqDef ->isSubClassOf (" SchedVar" )) {
1460
- Record *PredDef = Variant.VarOrSeqDef ->getValueAsDef (" Predicate" );
1460
+ const Record *PredDef = Variant.VarOrSeqDef ->getValueAsDef (" Predicate" );
1461
1461
if (mutuallyExclusive (PredDef, AllPreds, TransVec[TransIdx].PredTerm ))
1462
1462
continue ;
1463
1463
}
@@ -1489,7 +1489,7 @@ void PredTransitions::pushVariant(const TransVariant &VInfo, bool IsRead) {
1489
1489
// then the whole transition is specific to this processor.
1490
1490
IdxVec SelectedRWs;
1491
1491
if (VInfo.VarOrSeqDef ->isSubClassOf (" SchedVar" )) {
1492
- Record *PredDef = VInfo.VarOrSeqDef ->getValueAsDef (" Predicate" );
1492
+ const Record *PredDef = VInfo.VarOrSeqDef ->getValueAsDef (" Predicate" );
1493
1493
Trans.PredTerm .emplace_back (IsRead, VInfo.RWIdx , PredDef);
1494
1494
ConstRecVec SelectedDefs =
1495
1495
VInfo.VarOrSeqDef ->getValueAsListOfDefs (" Selected" );
@@ -1861,7 +1861,7 @@ void CodeGenSchedModels::collectProcResources() {
1861
1861
// This class may have a default ReadWrite list which can be overriden by
1862
1862
// InstRW definitions.
1863
1863
for (const Record *RW : SC.InstRWs ) {
1864
- Record *RWModelDef = RW->getValueAsDef (" SchedModel" );
1864
+ const Record *RWModelDef = RW->getValueAsDef (" SchedModel" );
1865
1865
unsigned PIdx = getProcModel (RWModelDef).Index ;
1866
1866
IdxVec Writes, Reads;
1867
1867
findRWs (RW->getValueAsListOfDefs (" OperandReadWrites" ), Writes, Reads);
0 commit comments