@@ -23,7 +23,7 @@ using namespace llvm;
2323// / getRegisterValueType - Look up and return the ValueType of the specified
2424// / register. If the register is a member of multiple register classes, they
2525// / must all have the same type.
26- static MVT::SimpleValueType getRegisterValueType (Record *R,
26+ static MVT::SimpleValueType getRegisterValueType (const Record *R,
2727 const CodeGenTarget &T) {
2828 bool FoundRC = false ;
2929 MVT::SimpleValueType VT = MVT::Other;
@@ -91,7 +91,7 @@ class MatcherGen {
9191 // / PhysRegInputs - List list has an entry for each explicitly specified
9292 // / physreg input to the pattern. The first elt is the Register node, the
9393 // / second is the recorded slot number the input pattern match saved it in.
94- SmallVector<std::pair<Record *, unsigned >, 2 > PhysRegInputs;
94+ SmallVector<std::pair<const Record *, unsigned >, 2 > PhysRegInputs;
9595
9696 // / Matcher - This is the top level of the generated matcher, the result.
9797 Matcher *TheMatcher;
@@ -220,13 +220,13 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode &N) {
220220 return ;
221221 }
222222
223- DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ());
223+ const DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ());
224224 if (!DI) {
225225 errs () << " Unknown leaf kind: " << N << " \n " ;
226226 abort ();
227227 }
228228
229- Record *LeafRec = DI->getDef ();
229+ const Record *LeafRec = DI->getDef ();
230230
231231 // A ValueType leaf node can represent a register when named, or itself when
232232 // unnamed.
@@ -673,7 +673,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N,
673673
674674 // If this is an explicit register reference, handle it.
675675 if (DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ())) {
676- Record *Def = DI->getDef ();
676+ const Record *Def = DI->getDef ();
677677 if (Def->isSubClassOf (" Register" )) {
678678 const CodeGenRegister *Reg = CGP.getTargetInfo ().getRegBank ().getReg (Def);
679679 AddMatcher (new EmitRegisterMatcher (Reg, N.getSimpleType (0 )));
@@ -690,7 +690,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N,
690690 if (Def->getName () == " undef_tied_input" ) {
691691 MVT::SimpleValueType ResultVT = N.getSimpleType (0 );
692692 auto IDOperandNo = NextRecordedOperandNo++;
693- Record *ImpDef = Def->getRecords ().getDef (" IMPLICIT_DEF" );
693+ const Record *ImpDef = Def->getRecords ().getDef (" IMPLICIT_DEF" );
694694 CodeGenInstruction &II = CGP.getTargetInfo ().getInstruction (ImpDef);
695695 AddMatcher (new EmitNodeMatcher (II, ResultVT, std::nullopt , false , false ,
696696 false , false , -1 , IDOperandNo));
@@ -907,11 +907,11 @@ void MatcherGen::EmitResultInstructionAsOperand(
907907 if (isRoot && !Pattern.getDstRegs ().empty ()) {
908908 // If the root came from an implicit def in the instruction handling stuff,
909909 // don't re-add it.
910- Record *HandledReg = nullptr ;
910+ const Record *HandledReg = nullptr ;
911911 if (II.HasOneImplicitDefWithKnownVT (CGT) != MVT::Other)
912912 HandledReg = II.ImplicitDefs [0 ];
913913
914- for (Record *Reg : Pattern.getDstRegs ()) {
914+ for (const Record *Reg : Pattern.getDstRegs ()) {
915915 if (!Reg->isSubClassOf (" Register" ) || Reg == HandledReg)
916916 continue ;
917917 ResultVTs.push_back (getRegisterValueType (Reg, CGT));
@@ -1042,7 +1042,7 @@ void MatcherGen::EmitResultCode() {
10421042 if (!Pattern.getDstRegs ().empty ()) {
10431043 // If the root came from an implicit def in the instruction handling stuff,
10441044 // don't re-add it.
1045- Record *HandledReg = nullptr ;
1045+ const Record *HandledReg = nullptr ;
10461046 const TreePatternNode &DstPat = Pattern.getDstPattern ();
10471047 if (!DstPat.isLeaf () && DstPat.getOperator ()->isSubClassOf (" Instruction" )) {
10481048 const CodeGenTarget &CGT = CGP.getTargetInfo ();
@@ -1052,7 +1052,7 @@ void MatcherGen::EmitResultCode() {
10521052 HandledReg = II.ImplicitDefs [0 ];
10531053 }
10541054
1055- for (Record *Reg : Pattern.getDstRegs ()) {
1055+ for (const Record *Reg : Pattern.getDstRegs ()) {
10561056 if (!Reg->isSubClassOf (" Register" ) || Reg == HandledReg)
10571057 continue ;
10581058 ++NumSrcResults;
0 commit comments