1515using namespace llvm ;
1616
1717std::pair<std::string, bool >
18- InstructionEncoding::findOperandDecoderMethod (const CodeGenTarget &Target,
19- const Record *Record) {
18+ InstructionEncoding::findOperandDecoderMethod (const Record *Record) {
2019 std::string Decoder;
2120
2221 const RecordVal *DecoderString = Record->getValue (" DecoderMethod" );
@@ -30,7 +29,7 @@ InstructionEncoding::findOperandDecoderMethod(const CodeGenTarget &Target,
3029
3130 if (Record->isSubClassOf (" RegisterOperand" ))
3231 // Allows use of a DecoderMethod in referenced RegisterClass if set.
33- return findOperandDecoderMethod (Target, Record->getValueAsDef (" RegClass" ));
32+ return findOperandDecoderMethod (Record->getValueAsDef (" RegClass" ));
3433
3534 if (Record->isSubClassOf (" RegisterClass" )) {
3635 Decoder = " Decode" + Record->getName ().str () + " RegisterClass" ;
@@ -44,8 +43,7 @@ InstructionEncoding::findOperandDecoderMethod(const CodeGenTarget &Target,
4443 return {Decoder, true };
4544}
4645
47- OperandInfo InstructionEncoding::getOpInfo (const CodeGenTarget &Target,
48- const Record *TypeRecord) {
46+ OperandInfo InstructionEncoding::getOpInfo (const Record *TypeRecord) {
4947 const RecordVal *HasCompleteDecoderVal =
5048 TypeRecord->getValue (" hasCompleteDecoder" );
5149 const BitInit *HasCompleteDecoderBit =
@@ -55,7 +53,7 @@ OperandInfo InstructionEncoding::getOpInfo(const CodeGenTarget &Target,
5553 bool HasCompleteDecoder =
5654 HasCompleteDecoderBit ? HasCompleteDecoderBit->getValue () : true ;
5755
58- return OperandInfo (findOperandDecoderMethod (Target, TypeRecord).first ,
56+ return OperandInfo (findOperandDecoderMethod (TypeRecord).first ,
5957 HasCompleteDecoder);
6058}
6159
@@ -177,16 +175,15 @@ void InstructionEncoding::parseFixedLenEncoding(
177175 }
178176}
179177
180- void InstructionEncoding::parseVarLenOperands (const CodeGenTarget &Target,
181- const VarLenInst &VLI) {
178+ void InstructionEncoding::parseVarLenOperands (const VarLenInst &VLI) {
182179 SmallVector<int > TiedTo;
183180
184181 for (const auto &[Idx, Op] : enumerate(Inst->Operands )) {
185182 if (Op.MIOperandInfo && Op.MIOperandInfo ->getNumArgs () > 0 )
186183 for (auto *Arg : Op.MIOperandInfo ->getArgs ())
187- Operands.push_back (getOpInfo (Target, cast<DefInit>(Arg)->getDef ()));
184+ Operands.push_back (getOpInfo (cast<DefInit>(Arg)->getDef ()));
188185 else
189- Operands.push_back (getOpInfo (Target, Op.Rec ));
186+ Operands.push_back (getOpInfo (Op.Rec ));
190187
191188 int TiedReg = Op.getTiedRegister ();
192189 TiedTo.push_back (-1 );
@@ -321,8 +318,7 @@ static void addOneOperandFields(const Record *EncodingDef,
321318 }
322319}
323320
324- void InstructionEncoding::parseFixedLenOperands (const CodeGenTarget &Target,
325- const BitsInit &Bits) {
321+ void InstructionEncoding::parseFixedLenOperands (const BitsInit &Bits) {
326322 // Search for tied operands, so that we can correctly instantiate
327323 // operands that are not explicitly represented in the encoding.
328324 std::map<StringRef, StringRef> TiedNames;
@@ -348,7 +344,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
348344 for (const CGIOperandList::OperandInfo &Op : Inst->Operands ) {
349345 // Lookup the decoder method and construct a new OperandInfo to hold our
350346 // result.
351- OperandInfo OpInfo = getOpInfo (Target, Op.Rec );
347+ OperandInfo OpInfo = getOpInfo (Op.Rec );
352348
353349 // If we have named sub-operands...
354350 if (Op.MIOperandInfo && !Op.SubOpNames [0 ].empty ()) {
@@ -367,7 +363,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
367363 for (auto [SubOpName, SubOp] :
368364 zip_equal (Op.SubOpNames , Op.MIOperandInfo ->getArgs ())) {
369365 const Record *SubOpRec = cast<DefInit>(SubOp)->getDef ();
370- OperandInfo SubOpInfo = getOpInfo (Target, SubOpRec);
366+ OperandInfo SubOpInfo = getOpInfo (SubOpRec);
371367 addOneOperandFields (EncodingDef, Bits, TiedNames, SubOpRec, SubOpName,
372368 SubOpInfo);
373369 Operands.push_back (std::move (SubOpInfo));
@@ -395,8 +391,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
395391 }
396392}
397393
398- InstructionEncoding::InstructionEncoding (const CodeGenTarget &Target,
399- const Record *EncodingDef,
394+ InstructionEncoding::InstructionEncoding (const Record *EncodingDef,
400395 const CodeGenInstruction *Inst)
401396 : EncodingDef(EncodingDef), Inst(Inst) {
402397 const Record *InstDef = Inst->TheDef ;
@@ -417,13 +412,13 @@ InstructionEncoding::InstructionEncoding(const CodeGenTarget &Target,
417412 parseVarLenEncoding (VLI);
418413 // If the encoding has a custom decoder, don't bother parsing the operands.
419414 if (DecoderMethod.empty ())
420- parseVarLenOperands (Target, VLI);
415+ parseVarLenOperands (VLI);
421416 } else {
422417 const auto *BI = cast<BitsInit>(InstField->getValue ());
423418 parseFixedLenEncoding (*BI);
424419 // If the encoding has a custom decoder, don't bother parsing the operands.
425420 if (DecoderMethod.empty ())
426- parseFixedLenOperands (Target, *BI);
421+ parseFixedLenOperands (*BI);
427422 }
428423
429424 if (DecoderMethod.empty ()) {
0 commit comments