@@ -140,7 +140,7 @@ class AsmMatcherInfo;
140140// RegisterSets can be seen in the outputted AsmMatcher tables occasionally, and
141141// can even affect compiler output (at least seen in diagnostics produced when
142142// all matches fail). So we use a type that sorts them consistently.
143- typedef std::set<Record *, LessRecordByID> RegisterSet;
143+ typedef std::set<const Record *, LessRecordByID> RegisterSet;
144144
145145class AsmMatcherEmitter {
146146 RecordKeeper &Records;
@@ -242,7 +242,7 @@ struct ClassInfo {
242242 if (!isRegisterClass () || !RHS.isRegisterClass ())
243243 return false ;
244244
245- std::vector<Record *> Tmp;
245+ std::vector<const Record *> Tmp;
246246 std::set_intersection (Registers.begin (), Registers.end (),
247247 RHS.Registers .begin (), RHS.Registers .end (),
248248 std::back_inserter (Tmp), LessRecordByID ());
@@ -403,7 +403,7 @@ struct MatchableInfo {
403403 bool IsIsolatedToken;
404404
405405 // / Register record if this token is singleton register.
406- Record *SingletonReg;
406+ const Record *SingletonReg;
407407
408408 explicit AsmOperand (bool IsIsolatedToken, StringRef T)
409409 : Token(T), Class(nullptr ), SubOpIdx(-1 ),
@@ -582,7 +582,7 @@ struct MatchableInfo {
582582 void formTwoOperandAlias (StringRef Constraint);
583583
584584 void initialize (const AsmMatcherInfo &Info,
585- SmallPtrSetImpl<Record *> &SingletonRegisters,
585+ SmallPtrSetImpl<const Record *> &SingletonRegisters,
586586 AsmVariantInfo const &Variant, bool HasMnemonicFirst);
587587
588588 // / validate - Return true if this matchable is a valid thing to match against
@@ -757,7 +757,8 @@ class AsmMatcherInfo {
757757 std::vector<OperandMatchEntry> OperandMatchInfo;
758758
759759 // / Map of Register records to their class information.
760- typedef std::map<Record *, ClassInfo *, LessRecordByID> RegisterClassesTy;
760+ typedef std::map<const Record *, ClassInfo *, LessRecordByID>
761+ RegisterClassesTy;
761762 RegisterClassesTy RegisterClasses;
762763
763764 // / Map of Predicate records to their subtarget information.
@@ -784,7 +785,8 @@ class AsmMatcherInfo {
784785
785786 // / buildRegisterClasses - Build the ClassInfo* instances for register
786787 // / classes.
787- void buildRegisterClasses (SmallPtrSetImpl<Record *> &SingletonRegisters);
788+ void
789+ buildRegisterClasses (SmallPtrSetImpl<const Record *> &SingletonRegisters);
788790
789791 // / buildOperandClasses - Build the ClassInfo* instances for user defined
790792 // / operand classes.
@@ -935,10 +937,10 @@ static void extractSingletonRegisterForAsmOperand(MatchableInfo::AsmOperand &Op,
935937 // be some random non-register token, just ignore it.
936938}
937939
938- void MatchableInfo::initialize (const AsmMatcherInfo &Info,
939- SmallPtrSetImpl<Record *> &SingletonRegisters ,
940- AsmVariantInfo const &Variant ,
941- bool HasMnemonicFirst) {
940+ void MatchableInfo::initialize (
941+ const AsmMatcherInfo &Info ,
942+ SmallPtrSetImpl< const Record *> &SingletonRegisters ,
943+ AsmVariantInfo const &Variant, bool HasMnemonicFirst) {
942944 AsmVariantID = Variant.AsmVariantNo ;
943945 AsmString = CodeGenInstruction::FlattenAsmStringVariants (
944946 AsmString, Variant.AsmVariantNo );
@@ -972,8 +974,8 @@ void MatchableInfo::initialize(const AsmMatcherInfo &Info,
972974 // Collect singleton registers, if used.
973975 for (MatchableInfo::AsmOperand &Op : AsmOperands) {
974976 extractSingletonRegisterForAsmOperand (Op, Info, Variant.RegisterPrefix );
975- if (Record *Reg = Op.SingletonReg )
976- SingletonRegisters.insert (Reg );
977+ if (Op.SingletonReg )
978+ SingletonRegisters.insert (Op. SingletonReg );
977979 }
978980
979981 const RecordVal *DepMask = TheDef->getValue (" DeprecatedFeatureMask" );
@@ -1253,7 +1255,7 @@ struct LessRegisterSet {
12531255};
12541256
12551257void AsmMatcherInfo::buildRegisterClasses (
1256- SmallPtrSetImpl<Record *> &SingletonRegisters) {
1258+ SmallPtrSetImpl<const Record *> &SingletonRegisters) {
12571259 const auto &Registers = Target.getRegBank ().getRegisters ();
12581260 auto &RegClassList = Target.getRegBank ().getRegClasses ();
12591261
@@ -1268,14 +1270,14 @@ void AsmMatcherInfo::buildRegisterClasses(
12681270 RegisterSet (RC.getOrder ().begin (), RC.getOrder ().end ()));
12691271
12701272 // Add any required singleton sets.
1271- for (Record *Rec : SingletonRegisters) {
1273+ for (const Record *Rec : SingletonRegisters) {
12721274 RegisterSets.insert (RegisterSet (&Rec, &Rec + 1 ));
12731275 }
12741276
12751277 // Introduce derived sets where necessary (when a register does not determine
12761278 // a unique register set class), and build the mapping of registers to the set
12771279 // they should classify to.
1278- std::map<Record *, RegisterSet> RegisterMap;
1280+ std::map<const Record *, RegisterSet> RegisterMap;
12791281 for (const CodeGenRegister &CGR : Registers) {
12801282 // Compute the intersection of all sets containing this register.
12811283 RegisterSet ContainingSet;
@@ -1369,7 +1371,7 @@ void AsmMatcherInfo::buildRegisterClasses(
13691371 RegisterClasses[It.first ] = RegisterSetClasses[It.second ];
13701372
13711373 // Name the register classes which correspond to singleton registers.
1372- for (Record *Rec : SingletonRegisters) {
1374+ for (const Record *Rec : SingletonRegisters) {
13731375 ClassInfo *CI = RegisterClasses[Rec];
13741376 assert (CI && " Missing singleton register class info!" );
13751377
@@ -1526,7 +1528,7 @@ void AsmMatcherInfo::buildInfo() {
15261528
15271529 // Parse the instructions; we need to do this first so that we can gather the
15281530 // singleton register classes.
1529- SmallPtrSet<Record *, 16 > SingletonRegisters;
1531+ SmallPtrSet<const Record *, 16 > SingletonRegisters;
15301532 unsigned VariantCount = Target.getAsmParserVariantCount ();
15311533 for (unsigned VC = 0 ; VC != VariantCount; ++VC) {
15321534 Record *AsmVariant = Target.getAsmParserVariant (VC);
@@ -1617,7 +1619,7 @@ void AsmMatcherInfo::buildInfo() {
16171619 StringRef Token = Op.Token ;
16181620
16191621 // Check for singleton registers.
1620- if (Record *RegRecord = Op.SingletonReg ) {
1622+ if (const Record *RegRecord = Op.SingletonReg ) {
16211623 Op.Class = RegisterClasses[RegRecord];
16221624 assert (Op.Class && Op.Class ->Registers .size () == 1 &&
16231625 " Unexpected class for singleton register" );
0 commit comments