@@ -1783,7 +1783,7 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
17831783 bool validateMIMGMSAA (const MCInst &Inst);
17841784 bool validateOpSel (const MCInst &Inst);
17851785 bool validateTrue16OpSel (const MCInst &Inst);
1786- bool validateNeg (const MCInst &Inst, int OpName);
1786+ bool validateNeg (const MCInst &Inst, AMDGPU::OpName OpName);
17871787 bool validateDPP (const MCInst &Inst, const OperandVector &Operands);
17881788 bool validateVccOperand (MCRegister Reg) const ;
17891789 bool validateVOPLiteral (const MCInst &Inst, const OperandVector &Operands);
@@ -3959,8 +3959,9 @@ bool AMDGPUAsmParser::validateMIMGAddrSize(const MCInst &Inst,
39593959 const AMDGPU::MIMGBaseOpcodeInfo *BaseOpcode =
39603960 AMDGPU::getMIMGBaseOpcodeInfo (Info->BaseOpcode );
39613961 int VAddr0Idx = AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::vaddr0);
3962- int RSrcOpName = (Desc.TSFlags & SIInstrFlags::MIMG) ? AMDGPU::OpName::srsrc
3963- : AMDGPU::OpName::rsrc;
3962+ AMDGPU::OpName RSrcOpName = (Desc.TSFlags & SIInstrFlags::MIMG)
3963+ ? AMDGPU::OpName::srsrc
3964+ : AMDGPU::OpName::rsrc;
39643965 int SrsrcIdx = AMDGPU::getNamedOperandIdx (Opc, RSrcOpName);
39653966 int DimIdx = AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::dim);
39663967 int A16Idx = AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::a16);
@@ -4671,8 +4672,8 @@ bool AMDGPUAsmParser::validateTrue16OpSel(const MCInst &Inst) {
46714672 if (OpSelOpValue == 0 )
46724673 return true ;
46734674 unsigned OpCount = 0 ;
4674- for (int OpName : {AMDGPU::OpName::src0, AMDGPU::OpName::src1,
4675- AMDGPU::OpName::src2, AMDGPU::OpName::vdst}) {
4675+ for (AMDGPU::OpName OpName : {AMDGPU::OpName::src0, AMDGPU::OpName::src1,
4676+ AMDGPU::OpName::src2, AMDGPU::OpName::vdst}) {
46764677 int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), OpName);
46774678 if (OpIdx == -1 )
46784679 continue ;
@@ -4690,7 +4691,7 @@ bool AMDGPUAsmParser::validateTrue16OpSel(const MCInst &Inst) {
46904691 return true ;
46914692}
46924693
4693- bool AMDGPUAsmParser::validateNeg (const MCInst &Inst, int OpName) {
4694+ bool AMDGPUAsmParser::validateNeg (const MCInst &Inst, AMDGPU::OpName OpName) {
46944695 assert (OpName == AMDGPU::OpName::neg_lo || OpName == AMDGPU::OpName::neg_hi);
46954696
46964697 const unsigned Opc = Inst.getOpcode ();
@@ -4715,9 +4716,9 @@ bool AMDGPUAsmParser::validateNeg(const MCInst &Inst, int OpName) {
47154716 // It is convenient that such instructions don't have src_modifiers operand
47164717 // for src operands that don't allow neg because they also don't allow opsel.
47174718
4718- int SrcMods[3 ] = {AMDGPU::OpName::src0_modifiers,
4719- AMDGPU::OpName::src1_modifiers,
4720- AMDGPU::OpName::src2_modifiers};
4719+ const AMDGPU::OpName SrcMods[3 ] = {AMDGPU::OpName::src0_modifiers,
4720+ AMDGPU::OpName::src1_modifiers,
4721+ AMDGPU::OpName::src2_modifiers};
47214722
47224723 for (unsigned i = 0 ; i < 3 ; ++i) {
47234724 if (!AMDGPU::hasNamedOperand (Opc, SrcMods[i])) {
@@ -4844,9 +4845,9 @@ bool AMDGPUAsmParser::validateVOPLiteral(const MCInst &Inst,
48444845}
48454846
48464847// Returns -1 if not a register, 0 if VGPR and 1 if AGPR.
4847- static int IsAGPROperand (const MCInst &Inst, uint16_t NameIdx ,
4848+ static int IsAGPROperand (const MCInst &Inst, AMDGPU::OpName Name ,
48484849 const MCRegisterInfo *MRI) {
4849- int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), NameIdx );
4850+ int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), Name );
48504851 if (OpIdx < 0 )
48514852 return -1 ;
48524853
@@ -4867,12 +4868,13 @@ bool AMDGPUAsmParser::validateAGPRLdSt(const MCInst &Inst) const {
48674868 SIInstrFlags::DS)) == 0 )
48684869 return true ;
48694870
4870- uint16_t DataNameIdx = (TSFlags & SIInstrFlags::DS) ? AMDGPU::OpName::data0
4871- : AMDGPU::OpName::vdata;
4871+ AMDGPU::OpName DataName = (TSFlags & SIInstrFlags::DS)
4872+ ? AMDGPU::OpName::data0
4873+ : AMDGPU::OpName::vdata;
48724874
48734875 const MCRegisterInfo *MRI = getMRI ();
48744876 int DstAreg = IsAGPROperand (Inst, AMDGPU::OpName::vdst, MRI);
4875- int DataAreg = IsAGPROperand (Inst, DataNameIdx , MRI);
4877+ int DataAreg = IsAGPROperand (Inst, DataName , MRI);
48764878
48774879 if ((TSFlags & SIInstrFlags::DS) && DataAreg >= 0 ) {
48784880 int Data2Areg = IsAGPROperand (Inst, AMDGPU::OpName::data1, MRI);
@@ -8703,9 +8705,8 @@ static void cvtVOP3DstOpSelOnly(MCInst &Inst, const MCRegisterInfo &MRI) {
87038705 return ;
87048706
87058707 int SrcNum;
8706- const int Ops[] = { AMDGPU::OpName::src0,
8707- AMDGPU::OpName::src1,
8708- AMDGPU::OpName::src2 };
8708+ const AMDGPU::OpName Ops[] = {AMDGPU::OpName::src0, AMDGPU::OpName::src1,
8709+ AMDGPU::OpName::src2};
87098710 for (SrcNum = 0 ; SrcNum < 3 && AMDGPU::hasNamedOperand (Opc, Ops[SrcNum]);
87108711 ++SrcNum)
87118712 ;
@@ -8827,12 +8828,11 @@ void AMDGPUAsmParser::cvtVINTERP(MCInst &Inst, const OperandVector &Operands)
88278828 if (OpSelIdx == -1 )
88288829 return ;
88298830
8830- const int Ops[] = { AMDGPU::OpName::src0,
8831- AMDGPU::OpName::src1,
8832- AMDGPU::OpName::src2 };
8833- const int ModOps[] = { AMDGPU::OpName::src0_modifiers,
8834- AMDGPU::OpName::src1_modifiers,
8835- AMDGPU::OpName::src2_modifiers };
8831+ const AMDGPU::OpName Ops[] = {AMDGPU::OpName::src0, AMDGPU::OpName::src1,
8832+ AMDGPU::OpName::src2};
8833+ const AMDGPU::OpName ModOps[] = {AMDGPU::OpName::src0_modifiers,
8834+ AMDGPU::OpName::src1_modifiers,
8835+ AMDGPU::OpName::src2_modifiers};
88368836
88378837 unsigned OpSel = Inst.getOperand (OpSelIdx).getImm ();
88388838
@@ -8968,12 +8968,11 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands,
89688968 if (NegHiIdx != -1 )
89698969 addOptionalImmOperand (Inst, Operands, OptIdx, AMDGPUOperand::ImmTyNegHi);
89708970
8971- const int Ops[] = { AMDGPU::OpName::src0,
8972- AMDGPU::OpName::src1,
8973- AMDGPU::OpName::src2 };
8974- const int ModOps[] = { AMDGPU::OpName::src0_modifiers,
8975- AMDGPU::OpName::src1_modifiers,
8976- AMDGPU::OpName::src2_modifiers };
8971+ const AMDGPU::OpName Ops[] = {AMDGPU::OpName::src0, AMDGPU::OpName::src1,
8972+ AMDGPU::OpName::src2};
8973+ const AMDGPU::OpName ModOps[] = {AMDGPU::OpName::src0_modifiers,
8974+ AMDGPU::OpName::src1_modifiers,
8975+ AMDGPU::OpName::src2_modifiers};
89778976
89788977 unsigned OpSel = 0 ;
89798978 unsigned OpSelHi = 0 ;
@@ -9036,7 +9035,8 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands) {
90369035}
90379036
90389037static void addSrcModifiersAndSrc (MCInst &Inst, const OperandVector &Operands,
9039- unsigned i, unsigned Opc, unsigned OpName) {
9038+ unsigned i, unsigned Opc,
9039+ AMDGPU::OpName OpName) {
90409040 if (AMDGPU::getNamedOperandIdx (Opc, OpName) != -1 )
90419041 ((AMDGPUOperand &)*Operands[i]).addRegOrImmWithFPInputModsOperands (Inst, 2 );
90429042 else
0 commit comments