@@ -85,16 +85,15 @@ using namespace llvm;
8585namespace {
8686class CompressInstEmitter {
8787 struct OpData {
88- enum MapKind { Operand, Imm, Reg };
89- MapKind Kind;
88+ enum MapKind { Operand, Imm, Reg } Kind;
9089 union {
9190 // Operand number mapped to.
92- unsigned Operand ;
91+ unsigned OpNo ;
9392 // Integer immediate value.
94- int64_t Imm ;
93+ int64_t ImmVal ;
9594 // Physical register.
96- const Record *Reg ;
97- } Data ;
95+ const Record *RegRec ;
96+ };
9897 // Tied operand index within the instruction.
9998 int TiedOpIdx = -1 ;
10099 };
@@ -255,7 +254,7 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
255254 " ' is not in register class '" +
256255 OpndRec->getName () + " '" );
257256 OperandMap[OpNo].Kind = OpData::Reg;
258- OperandMap[OpNo].Data . Reg = DI->getDef ();
257+ OperandMap[OpNo].RegRec = DI->getDef ();
259258 continue ;
260259 }
261260 // Validate that Dag operand type matches the type defined in the
@@ -282,7 +281,7 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
282281 " operand expected a register!" );
283282 // No pattern validation check possible for values of fixed immediate.
284283 OperandMap[OpNo].Kind = OpData::Imm;
285- OperandMap[OpNo].Data . Imm = II->getValue ();
284+ OperandMap[OpNo].ImmVal = II->getValue ();
286285 LLVM_DEBUG (
287286 dbgs () << " Found immediate '" << II->getValue () << " ' at "
288287 << (IsSourceInst ? " input " : " output " )
@@ -403,9 +402,8 @@ void CompressInstEmitter::createInstOperandMapping(
403402 if (DestOperandMap[OpNo].Kind == OpData::Operand)
404403 // No need to fill the SourceOperandMap here since it was mapped to
405404 // 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 '"
409407 << TiedInstOpIdx << " '\n " );
410408 ++OpNo;
411409 continue ;
@@ -430,8 +428,8 @@ void CompressInstEmitter::createInstOperandMapping(
430428 " Incorrect operand mapping detected!\n " );
431429
432430 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;
435433 LLVM_DEBUG (dbgs () << " " << SourceOpNo << " ====> " << OpNo << " \n " );
436434 }
437435 }
@@ -774,11 +772,10 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
774772 CondStream.indent (8 )
775773 << " (MI.getOperand(" << OpNo << " ).isImm()) &&\n "
776774 << " (MI.getOperand(" << OpNo
777- << " ).getImm() == " << SourceOperandMap[OpNo].Data .Imm
778- << " ) &&\n " ;
775+ << " ).getImm() == " << SourceOperandMap[OpNo].ImmVal << " ) &&\n " ;
779776 break ;
780777 case OpData::Reg: {
781- const Record *Reg = SourceOperandMap[OpNo].Data . Reg ;
778+ const Record *Reg = SourceOperandMap[OpNo].RegRec ;
782779 CondStream.indent (8 ) << " (MI.getOperand(" << OpNo << " ).isReg()) &&\n "
783780 << indent (8 ) << " (MI.getOperand(" << OpNo
784781 << " ).getReg() == " << TargetName
@@ -806,7 +803,7 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
806803
807804 switch (DestOperandMap[OpNo].Kind ) {
808805 case OpData::Operand: {
809- unsigned OpIdx = DestOperandMap[OpNo].Data . Operand ;
806+ unsigned OpIdx = DestOperandMap[OpNo].OpNo ;
810807 // Check that the operand in the Source instruction fits
811808 // the type for the Dest instruction.
812809 if (DestRec->isSubClassOf (" RegisterClass" ) ||
@@ -862,7 +859,7 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
862859 DestRec, " MCOperandPredicate" );
863860 CondStream.indent (8 )
864861 << ValidatorName << " ("
865- << " MCOperand::createImm(" << DestOperandMap[OpNo].Data . Imm
862+ << " MCOperand::createImm(" << DestOperandMap[OpNo].Imm
866863 << " ), STI, " << Entry << " ) &&\n " ;
867864 } else {
868865 unsigned Entry =
@@ -871,17 +868,17 @@ void CompressInstEmitter::emitCompressInstEmitter(raw_ostream &OS,
871868 CondStream.indent (8 )
872869 << TargetName
873870 << " ValidateMachineOperand(MachineOperand::CreateImm("
874- << DestOperandMap[OpNo].Data . Imm << " ), &STI, " << Entry
871+ << DestOperandMap[OpNo].ImmVal << " ), &STI, " << Entry
875872 << " ) &&\n " ;
876873 }
877874 if (CompressOrUncompress)
878875 CodeStream.indent (6 ) << " OutInst.addOperand(MCOperand::createImm("
879- << DestOperandMap[OpNo].Data . Imm << " ));\n " ;
876+ << DestOperandMap[OpNo].ImmVal << " ));\n " ;
880877 } break ;
881878 case OpData::Reg: {
882879 if (CompressOrUncompress) {
883880 // Fixed register has been validated at pattern validation time.
884- const Record *Reg = DestOperandMap[OpNo].Data . Reg ;
881+ const Record *Reg = DestOperandMap[OpNo].RegRec ;
885882 CodeStream.indent (6 )
886883 << " OutInst.addOperand(MCOperand::createReg(" << TargetName
887884 << " ::" << Reg->getName () << " ));\n " ;
0 commit comments