@@ -85,16 +85,15 @@ using namespace llvm;
85
85
namespace {
86
86
class CompressInstEmitter {
87
87
struct OpData {
88
- enum MapKind { Operand, Imm, Reg };
89
- MapKind Kind;
88
+ enum MapKind { Operand, Imm, Reg } Kind;
90
89
union {
91
90
// Operand number mapped to.
92
- unsigned Operand ;
91
+ unsigned OpNo ;
93
92
// Integer immediate value.
94
- int64_t Imm ;
93
+ int64_t ImmVal ;
95
94
// Physical register.
96
- const Record *Reg ;
97
- } Data ;
95
+ const Record *RegRec ;
96
+ };
98
97
// Tied operand index within the instruction.
99
98
int TiedOpIdx = -1 ;
100
99
};
@@ -255,7 +254,7 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
255
254
" ' is not in register class '" +
256
255
OpndRec->getName () + " '" );
257
256
OperandMap[OpNo].Kind = OpData::Reg;
258
- OperandMap[OpNo].Data . Reg = DI->getDef ();
257
+ OperandMap[OpNo].RegRec = DI->getDef ();
259
258
continue ;
260
259
}
261
260
// Validate that Dag operand type matches the type defined in the
@@ -282,7 +281,7 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
282
281
" operand expected a register!" );
283
282
// No pattern validation check possible for values of fixed immediate.
284
283
OperandMap[OpNo].Kind = OpData::Imm;
285
- OperandMap[OpNo].Data . Imm = II->getValue ();
284
+ OperandMap[OpNo].ImmVal = II->getValue ();
286
285
LLVM_DEBUG (
287
286
dbgs () << " Found immediate '" << II->getValue () << " ' at "
288
287
<< (IsSourceInst ? " input " : " output " )
@@ -403,9 +402,8 @@ void CompressInstEmitter::createInstOperandMapping(
403
402
if (DestOperandMap[OpNo].Kind == OpData::Operand)
404
403
// No need to fill the SourceOperandMap here since it was mapped to
405
404
// destination operand 'TiedInstOpIdx' in a previous iteration.
406
- LLVM_DEBUG (dbgs () << " " << DestOperandMap[OpNo].Data .Operand
407
- << " ====> " << OpNo
408
- << " Dest operand tied with operand '"
405
+ LLVM_DEBUG (dbgs () << " " << DestOperandMap[OpNo].OpNo << " ====> "
406
+ << OpNo << " Dest operand tied with operand '"
409
407
<< TiedInstOpIdx << " '\n " );
410
408
++OpNo;
411
409
continue ;
@@ -430,8 +428,8 @@ void CompressInstEmitter::createInstOperandMapping(
430
428
" Incorrect operand mapping detected!\n " );
431
429
432
430
unsigned SourceOpNo = SourceOp->getValue ().MIOpNo ;
433
- DestOperandMap[OpNo].Data . Operand = SourceOpNo;
434
- SourceOperandMap[SourceOpNo].Data . Operand = OpNo;
431
+ DestOperandMap[OpNo].OpNo = SourceOpNo;
432
+ SourceOperandMap[SourceOpNo].OpNo = OpNo;
435
433
LLVM_DEBUG (dbgs () << " " << SourceOpNo << " ====> " << OpNo << " \n " );
436
434
}
437
435
}
@@ -774,11 +772,10 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
774
772
CondStream.indent (8 )
775
773
<< " (MI.getOperand(" << OpNo << " ).isImm()) &&\n "
776
774
<< " (MI.getOperand(" << OpNo
777
- << " ).getImm() == " << SourceOperandMap[OpNo].Data .Imm
778
- << " ) &&\n " ;
775
+ << " ).getImm() == " << SourceOperandMap[OpNo].ImmVal << " ) &&\n " ;
779
776
break ;
780
777
case OpData::Reg: {
781
- const Record *Reg = SourceOperandMap[OpNo].Data . Reg ;
778
+ const Record *Reg = SourceOperandMap[OpNo].RegRec ;
782
779
CondStream.indent (8 ) << " (MI.getOperand(" << OpNo << " ).isReg()) &&\n "
783
780
<< indent (8 ) << " (MI.getOperand(" << OpNo
784
781
<< " ).getReg() == " << TargetName
@@ -806,7 +803,7 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
806
803
807
804
switch (DestOperandMap[OpNo].Kind ) {
808
805
case OpData::Operand: {
809
- unsigned OpIdx = DestOperandMap[OpNo].Data . Operand ;
806
+ unsigned OpIdx = DestOperandMap[OpNo].OpNo ;
810
807
// Check that the operand in the Source instruction fits
811
808
// the type for the Dest instruction.
812
809
if (DestRec->isSubClassOf (" RegisterClass" ) ||
@@ -862,7 +859,7 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
862
859
DestRec, " MCOperandPredicate" );
863
860
CondStream.indent (8 )
864
861
<< ValidatorName << " ("
865
- << " MCOperand::createImm(" << DestOperandMap[OpNo].Data . Imm
862
+ << " MCOperand::createImm(" << DestOperandMap[OpNo].Imm
866
863
<< " ), STI, " << Entry << " ) &&\n " ;
867
864
} else {
868
865
unsigned Entry =
@@ -871,17 +868,17 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
871
868
CondStream.indent (8 )
872
869
<< TargetName
873
870
<< " ValidateMachineOperand(MachineOperand::CreateImm("
874
- << DestOperandMap[OpNo].Data . Imm << " ), &STI, " << Entry
871
+ << DestOperandMap[OpNo].ImmVal << " ), &STI, " << Entry
875
872
<< " ) &&\n " ;
876
873
}
877
874
if (CompressOrUncompress)
878
875
CodeStream.indent (6 ) << " OutInst.addOperand(MCOperand::createImm("
879
- << DestOperandMap[OpNo].Data . Imm << " ));\n " ;
876
+ << DestOperandMap[OpNo].ImmVal << " ));\n " ;
880
877
} break ;
881
878
case OpData::Reg: {
882
879
if (CompressOrUncompress) {
883
880
// Fixed register has been validated at pattern validation time.
884
- const Record *Reg = DestOperandMap[OpNo].Data . Reg ;
881
+ const Record *Reg = DestOperandMap[OpNo].RegRec ;
885
882
CodeStream.indent (6 )
886
883
<< " OutInst.addOperand(MCOperand::createReg(" << TargetName
887
884
<< " ::" << Reg->getName () << " ));\n " ;
0 commit comments