@@ -23,7 +23,7 @@ using namespace llvm;
23
23
// / getRegisterValueType - Look up and return the ValueType of the specified
24
24
// / register. If the register is a member of multiple register classes, they
25
25
// / must all have the same type.
26
- static MVT::SimpleValueType getRegisterValueType (Record *R,
26
+ static MVT::SimpleValueType getRegisterValueType (const Record *R,
27
27
const CodeGenTarget &T) {
28
28
bool FoundRC = false ;
29
29
MVT::SimpleValueType VT = MVT::Other;
@@ -91,7 +91,7 @@ class MatcherGen {
91
91
// / PhysRegInputs - List list has an entry for each explicitly specified
92
92
// / physreg input to the pattern. The first elt is the Register node, the
93
93
// / 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;
95
95
96
96
// / Matcher - This is the top level of the generated matcher, the result.
97
97
Matcher *TheMatcher;
@@ -220,13 +220,13 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode &N) {
220
220
return ;
221
221
}
222
222
223
- DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ());
223
+ const DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ());
224
224
if (!DI) {
225
225
errs () << " Unknown leaf kind: " << N << " \n " ;
226
226
abort ();
227
227
}
228
228
229
- Record *LeafRec = DI->getDef ();
229
+ const Record *LeafRec = DI->getDef ();
230
230
231
231
// A ValueType leaf node can represent a register when named, or itself when
232
232
// unnamed.
@@ -673,7 +673,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N,
673
673
674
674
// If this is an explicit register reference, handle it.
675
675
if (DefInit *DI = dyn_cast<DefInit>(N.getLeafValue ())) {
676
- Record *Def = DI->getDef ();
676
+ const Record *Def = DI->getDef ();
677
677
if (Def->isSubClassOf (" Register" )) {
678
678
const CodeGenRegister *Reg = CGP.getTargetInfo ().getRegBank ().getReg (Def);
679
679
AddMatcher (new EmitRegisterMatcher (Reg, N.getSimpleType (0 )));
@@ -690,7 +690,7 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode &N,
690
690
if (Def->getName () == " undef_tied_input" ) {
691
691
MVT::SimpleValueType ResultVT = N.getSimpleType (0 );
692
692
auto IDOperandNo = NextRecordedOperandNo++;
693
- Record *ImpDef = Def->getRecords ().getDef (" IMPLICIT_DEF" );
693
+ const Record *ImpDef = Def->getRecords ().getDef (" IMPLICIT_DEF" );
694
694
CodeGenInstruction &II = CGP.getTargetInfo ().getInstruction (ImpDef);
695
695
AddMatcher (new EmitNodeMatcher (II, ResultVT, std::nullopt, false , false ,
696
696
false , false , -1 , IDOperandNo));
@@ -907,11 +907,11 @@ void MatcherGen::EmitResultInstructionAsOperand(
907
907
if (isRoot && !Pattern.getDstRegs ().empty ()) {
908
908
// If the root came from an implicit def in the instruction handling stuff,
909
909
// don't re-add it.
910
- Record *HandledReg = nullptr ;
910
+ const Record *HandledReg = nullptr ;
911
911
if (II.HasOneImplicitDefWithKnownVT (CGT) != MVT::Other)
912
912
HandledReg = II.ImplicitDefs [0 ];
913
913
914
- for (Record *Reg : Pattern.getDstRegs ()) {
914
+ for (const Record *Reg : Pattern.getDstRegs ()) {
915
915
if (!Reg->isSubClassOf (" Register" ) || Reg == HandledReg)
916
916
continue ;
917
917
ResultVTs.push_back (getRegisterValueType (Reg, CGT));
@@ -1042,7 +1042,7 @@ void MatcherGen::EmitResultCode() {
1042
1042
if (!Pattern.getDstRegs ().empty ()) {
1043
1043
// If the root came from an implicit def in the instruction handling stuff,
1044
1044
// don't re-add it.
1045
- Record *HandledReg = nullptr ;
1045
+ const Record *HandledReg = nullptr ;
1046
1046
const TreePatternNode &DstPat = Pattern.getDstPattern ();
1047
1047
if (!DstPat.isLeaf () && DstPat.getOperator ()->isSubClassOf (" Instruction" )) {
1048
1048
const CodeGenTarget &CGT = CGP.getTargetInfo ();
@@ -1052,7 +1052,7 @@ void MatcherGen::EmitResultCode() {
1052
1052
HandledReg = II.ImplicitDefs [0 ];
1053
1053
}
1054
1054
1055
- for (Record *Reg : Pattern.getDstRegs ()) {
1055
+ for (const Record *Reg : Pattern.getDstRegs ()) {
1056
1056
if (!Reg->isSubClassOf (" Register" ) || Reg == HandledReg)
1057
1057
continue ;
1058
1058
++NumSrcResults;
0 commit comments