@@ -155,12 +155,12 @@ raw_ostream &operator<<(raw_ostream &OS, const EncodingAndInst &Value) {
155
155
}
156
156
157
157
class DecoderEmitter {
158
- RecordKeeper &RK;
158
+ const RecordKeeper &RK;
159
159
std::vector<EncodingAndInst> NumberedEncodings;
160
160
161
161
public:
162
- DecoderEmitter (RecordKeeper &R, std::string PredicateNamespace)
163
- : RK(R), Target(R), PredicateNamespace(std::move( PredicateNamespace) ) {}
162
+ DecoderEmitter (const RecordKeeper &R, const std::string & PredicateNamespace)
163
+ : RK(R), Target(R), PredicateNamespace(PredicateNamespace) {}
164
164
165
165
// Emit the decoder state machine table.
166
166
void emitTable (formatted_raw_ostream &o, DecoderTable &Table,
@@ -181,7 +181,7 @@ class DecoderEmitter {
181
181
CodeGenTarget Target;
182
182
183
183
public:
184
- std::string PredicateNamespace;
184
+ const std::string & PredicateNamespace;
185
185
};
186
186
187
187
} // end anonymous namespace
@@ -1302,7 +1302,7 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation,
1302
1302
AllInstructions[Opc].EncodingDef ->getValueAsListInit (" Predicates" );
1303
1303
bool IsFirstEmission = true ;
1304
1304
for (unsigned i = 0 ; i < Predicates->size (); ++i) {
1305
- Record *Pred = Predicates->getElementAsRecord (i);
1305
+ const Record *Pred = Predicates->getElementAsRecord (i);
1306
1306
if (!Pred->getValue (" AssemblerMatcherPredicate" ))
1307
1307
continue ;
1308
1308
@@ -1320,10 +1320,10 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation,
1320
1320
}
1321
1321
1322
1322
bool FilterChooser::doesOpcodeNeedPredicate (unsigned Opc) const {
1323
- ListInit *Predicates =
1323
+ const ListInit *Predicates =
1324
1324
AllInstructions[Opc].EncodingDef ->getValueAsListInit (" Predicates" );
1325
1325
for (unsigned i = 0 ; i < Predicates->size (); ++i) {
1326
- Record *Pred = Predicates->getElementAsRecord (i);
1326
+ const Record *Pred = Predicates->getElementAsRecord (i);
1327
1327
if (!Pred->getValue (" AssemblerMatcherPredicate" ))
1328
1328
continue ;
1329
1329
@@ -1868,7 +1868,7 @@ static std::string findOperandDecoderMethod(const Record *Record) {
1868
1868
std::string Decoder;
1869
1869
1870
1870
const RecordVal *DecoderString = Record->getValue (" DecoderMethod" );
1871
- StringInit *String =
1871
+ const StringInit *String =
1872
1872
DecoderString ? dyn_cast<StringInit>(DecoderString->getValue ()) : nullptr ;
1873
1873
if (String) {
1874
1874
Decoder = std::string (String->getValue ());
@@ -2010,7 +2010,7 @@ static void addOneOperandFields(const Record &EncodingDef, const BitsInit &Bits,
2010
2010
}
2011
2011
2012
2012
static unsigned
2013
- populateInstruction (CodeGenTarget &Target, const Record &EncodingDef,
2013
+ populateInstruction (const CodeGenTarget &Target, const Record &EncodingDef,
2014
2014
const CodeGenInstruction &CGI, unsigned Opc,
2015
2015
std::map<unsigned , std::vector<OperandInfo>> &Operands,
2016
2016
bool IsVarLenInst) {
@@ -2089,12 +2089,12 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef,
2089
2089
DagInit *SubArgDag = dyn_cast<DagInit>(OpInit);
2090
2090
if (SubArgDag)
2091
2091
OpInit = SubArgDag->getOperator ();
2092
- Record *OpTypeRec = cast<DefInit>(OpInit)->getDef ();
2092
+ const Record *OpTypeRec = cast<DefInit>(OpInit)->getDef ();
2093
2093
// Lookup the sub-operands from the operand type record (note that only
2094
2094
// Operand subclasses have MIOperandInfo, see CodeGenInstruction.cpp).
2095
- DagInit *SubOps = OpTypeRec->isSubClassOf (" Operand" )
2096
- ? OpTypeRec->getValueAsDag (" MIOperandInfo" )
2097
- : nullptr ;
2095
+ const DagInit *SubOps = OpTypeRec->isSubClassOf (" Operand" )
2096
+ ? OpTypeRec->getValueAsDag (" MIOperandInfo" )
2097
+ : nullptr ;
2098
2098
2099
2099
// Lookup the decoder method and construct a new OperandInfo to hold our
2100
2100
// result.
@@ -2549,7 +2549,7 @@ namespace llvm {
2549
2549
handleHwModesUnrelatedEncodings (NumberedInstruction, HwModeNames,
2550
2550
NamespacesWithHwModes, NumberedEncodings);
2551
2551
}
2552
- for (const auto & NumberedAlias :
2552
+ for (const Record * NumberedAlias :
2553
2553
RK.getAllDerivedDefinitions (" AdditionalEncoding" ))
2554
2554
NumberedEncodings.emplace_back (
2555
2555
NumberedAlias,
0 commit comments