15
15
using namespace llvm ;
16
16
17
17
std::pair<std::string, bool >
18
- InstructionEncoding::findOperandDecoderMethod (const CodeGenTarget &Target,
19
- const Record *Record) {
18
+ InstructionEncoding::findOperandDecoderMethod (const Record *Record) {
20
19
std::string Decoder;
21
20
22
21
const RecordVal *DecoderString = Record->getValue (" DecoderMethod" );
@@ -30,7 +29,7 @@ InstructionEncoding::findOperandDecoderMethod(const CodeGenTarget &Target,
30
29
31
30
if (Record->isSubClassOf (" RegisterOperand" ))
32
31
// Allows use of a DecoderMethod in referenced RegisterClass if set.
33
- return findOperandDecoderMethod (Target, Record->getValueAsDef (" RegClass" ));
32
+ return findOperandDecoderMethod (Record->getValueAsDef (" RegClass" ));
34
33
35
34
if (Record->isSubClassOf (" RegisterClass" )) {
36
35
Decoder = " Decode" + Record->getName ().str () + " RegisterClass" ;
@@ -44,8 +43,7 @@ InstructionEncoding::findOperandDecoderMethod(const CodeGenTarget &Target,
44
43
return {Decoder, true };
45
44
}
46
45
47
- OperandInfo InstructionEncoding::getOpInfo (const CodeGenTarget &Target,
48
- const Record *TypeRecord) {
46
+ OperandInfo InstructionEncoding::getOpInfo (const Record *TypeRecord) {
49
47
const RecordVal *HasCompleteDecoderVal =
50
48
TypeRecord->getValue (" hasCompleteDecoder" );
51
49
const BitInit *HasCompleteDecoderBit =
@@ -55,7 +53,7 @@ OperandInfo InstructionEncoding::getOpInfo(const CodeGenTarget &Target,
55
53
bool HasCompleteDecoder =
56
54
HasCompleteDecoderBit ? HasCompleteDecoderBit->getValue () : true ;
57
55
58
- return OperandInfo (findOperandDecoderMethod (Target, TypeRecord).first ,
56
+ return OperandInfo (findOperandDecoderMethod (TypeRecord).first ,
59
57
HasCompleteDecoder);
60
58
}
61
59
@@ -177,16 +175,15 @@ void InstructionEncoding::parseFixedLenEncoding(
177
175
}
178
176
}
179
177
180
- void InstructionEncoding::parseVarLenOperands (const CodeGenTarget &Target,
181
- const VarLenInst &VLI) {
178
+ void InstructionEncoding::parseVarLenOperands (const VarLenInst &VLI) {
182
179
SmallVector<int > TiedTo;
183
180
184
181
for (const auto &[Idx, Op] : enumerate(Inst->Operands )) {
185
182
if (Op.MIOperandInfo && Op.MIOperandInfo ->getNumArgs () > 0 )
186
183
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 ()));
188
185
else
189
- Operands.push_back (getOpInfo (Target, Op.Rec ));
186
+ Operands.push_back (getOpInfo (Op.Rec ));
190
187
191
188
int TiedReg = Op.getTiedRegister ();
192
189
TiedTo.push_back (-1 );
@@ -321,8 +318,7 @@ static void addOneOperandFields(const Record *EncodingDef,
321
318
}
322
319
}
323
320
324
- void InstructionEncoding::parseFixedLenOperands (const CodeGenTarget &Target,
325
- const BitsInit &Bits) {
321
+ void InstructionEncoding::parseFixedLenOperands (const BitsInit &Bits) {
326
322
// Search for tied operands, so that we can correctly instantiate
327
323
// operands that are not explicitly represented in the encoding.
328
324
std::map<StringRef, StringRef> TiedNames;
@@ -348,7 +344,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
348
344
for (const CGIOperandList::OperandInfo &Op : Inst->Operands ) {
349
345
// Lookup the decoder method and construct a new OperandInfo to hold our
350
346
// result.
351
- OperandInfo OpInfo = getOpInfo (Target, Op.Rec );
347
+ OperandInfo OpInfo = getOpInfo (Op.Rec );
352
348
353
349
// If we have named sub-operands...
354
350
if (Op.MIOperandInfo && !Op.SubOpNames [0 ].empty ()) {
@@ -367,7 +363,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
367
363
for (auto [SubOpName, SubOp] :
368
364
zip_equal (Op.SubOpNames , Op.MIOperandInfo ->getArgs ())) {
369
365
const Record *SubOpRec = cast<DefInit>(SubOp)->getDef ();
370
- OperandInfo SubOpInfo = getOpInfo (Target, SubOpRec);
366
+ OperandInfo SubOpInfo = getOpInfo (SubOpRec);
371
367
addOneOperandFields (EncodingDef, Bits, TiedNames, SubOpRec, SubOpName,
372
368
SubOpInfo);
373
369
Operands.push_back (std::move (SubOpInfo));
@@ -395,8 +391,7 @@ void InstructionEncoding::parseFixedLenOperands(const CodeGenTarget &Target,
395
391
}
396
392
}
397
393
398
- InstructionEncoding::InstructionEncoding (const CodeGenTarget &Target,
399
- const Record *EncodingDef,
394
+ InstructionEncoding::InstructionEncoding (const Record *EncodingDef,
400
395
const CodeGenInstruction *Inst)
401
396
: EncodingDef(EncodingDef), Inst(Inst) {
402
397
const Record *InstDef = Inst->TheDef ;
@@ -417,13 +412,13 @@ InstructionEncoding::InstructionEncoding(const CodeGenTarget &Target,
417
412
parseVarLenEncoding (VLI);
418
413
// If the encoding has a custom decoder, don't bother parsing the operands.
419
414
if (DecoderMethod.empty ())
420
- parseVarLenOperands (Target, VLI);
415
+ parseVarLenOperands (VLI);
421
416
} else {
422
417
const auto *BI = cast<BitsInit>(InstField->getValue ());
423
418
parseFixedLenEncoding (*BI);
424
419
// If the encoding has a custom decoder, don't bother parsing the operands.
425
420
if (DecoderMethod.empty ())
426
- parseFixedLenOperands (Target, *BI);
421
+ parseFixedLenOperands (*BI);
427
422
}
428
423
429
424
if (DecoderMethod.empty ()) {
0 commit comments