@@ -1783,7 +1783,7 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1783
1783
bool validateMIMGMSAA (const MCInst &Inst);
1784
1784
bool validateOpSel (const MCInst &Inst);
1785
1785
bool validateTrue16OpSel (const MCInst &Inst);
1786
- bool validateNeg (const MCInst &Inst, int OpName);
1786
+ bool validateNeg (const MCInst &Inst, AMDGPU::OpName OpName);
1787
1787
bool validateDPP (const MCInst &Inst, const OperandVector &Operands);
1788
1788
bool validateVccOperand (MCRegister Reg) const ;
1789
1789
bool validateVOPLiteral (const MCInst &Inst, const OperandVector &Operands);
@@ -3959,8 +3959,9 @@ bool AMDGPUAsmParser::validateMIMGAddrSize(const MCInst &Inst,
3959
3959
const AMDGPU::MIMGBaseOpcodeInfo *BaseOpcode =
3960
3960
AMDGPU::getMIMGBaseOpcodeInfo (Info->BaseOpcode );
3961
3961
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;
3964
3965
int SrsrcIdx = AMDGPU::getNamedOperandIdx (Opc, RSrcOpName);
3965
3966
int DimIdx = AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::dim);
3966
3967
int A16Idx = AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::a16);
@@ -4671,8 +4672,8 @@ bool AMDGPUAsmParser::validateTrue16OpSel(const MCInst &Inst) {
4671
4672
if (OpSelOpValue == 0 )
4672
4673
return true ;
4673
4674
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}) {
4676
4677
int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), OpName);
4677
4678
if (OpIdx == -1 )
4678
4679
continue ;
@@ -4690,7 +4691,7 @@ bool AMDGPUAsmParser::validateTrue16OpSel(const MCInst &Inst) {
4690
4691
return true ;
4691
4692
}
4692
4693
4693
- bool AMDGPUAsmParser::validateNeg (const MCInst &Inst, int OpName) {
4694
+ bool AMDGPUAsmParser::validateNeg (const MCInst &Inst, AMDGPU::OpName OpName) {
4694
4695
assert (OpName == AMDGPU::OpName::neg_lo || OpName == AMDGPU::OpName::neg_hi);
4695
4696
4696
4697
const unsigned Opc = Inst.getOpcode ();
@@ -4715,9 +4716,9 @@ bool AMDGPUAsmParser::validateNeg(const MCInst &Inst, int OpName) {
4715
4716
// It is convenient that such instructions don't have src_modifiers operand
4716
4717
// for src operands that don't allow neg because they also don't allow opsel.
4717
4718
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};
4721
4722
4722
4723
for (unsigned i = 0 ; i < 3 ; ++i) {
4723
4724
if (!AMDGPU::hasNamedOperand (Opc, SrcMods[i])) {
@@ -4844,9 +4845,9 @@ bool AMDGPUAsmParser::validateVOPLiteral(const MCInst &Inst,
4844
4845
}
4845
4846
4846
4847
// 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 ,
4848
4849
const MCRegisterInfo *MRI) {
4849
- int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), NameIdx );
4850
+ int OpIdx = AMDGPU::getNamedOperandIdx (Inst.getOpcode (), Name );
4850
4851
if (OpIdx < 0 )
4851
4852
return -1 ;
4852
4853
@@ -4867,12 +4868,13 @@ bool AMDGPUAsmParser::validateAGPRLdSt(const MCInst &Inst) const {
4867
4868
SIInstrFlags::DS)) == 0 )
4868
4869
return true ;
4869
4870
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;
4872
4874
4873
4875
const MCRegisterInfo *MRI = getMRI ();
4874
4876
int DstAreg = IsAGPROperand (Inst, AMDGPU::OpName::vdst, MRI);
4875
- int DataAreg = IsAGPROperand (Inst, DataNameIdx , MRI);
4877
+ int DataAreg = IsAGPROperand (Inst, DataName , MRI);
4876
4878
4877
4879
if ((TSFlags & SIInstrFlags::DS) && DataAreg >= 0 ) {
4878
4880
int Data2Areg = IsAGPROperand (Inst, AMDGPU::OpName::data1, MRI);
@@ -8703,9 +8705,8 @@ static void cvtVOP3DstOpSelOnly(MCInst &Inst, const MCRegisterInfo &MRI) {
8703
8705
return ;
8704
8706
8705
8707
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};
8709
8710
for (SrcNum = 0 ; SrcNum < 3 && AMDGPU::hasNamedOperand (Opc, Ops[SrcNum]);
8710
8711
++SrcNum)
8711
8712
;
@@ -8827,12 +8828,11 @@ void AMDGPUAsmParser::cvtVINTERP(MCInst &Inst, const OperandVector &Operands)
8827
8828
if (OpSelIdx == -1 )
8828
8829
return ;
8829
8830
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};
8836
8836
8837
8837
unsigned OpSel = Inst.getOperand (OpSelIdx).getImm ();
8838
8838
@@ -8968,12 +8968,11 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands,
8968
8968
if (NegHiIdx != -1 )
8969
8969
addOptionalImmOperand (Inst, Operands, OptIdx, AMDGPUOperand::ImmTyNegHi);
8970
8970
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};
8977
8976
8978
8977
unsigned OpSel = 0 ;
8979
8978
unsigned OpSelHi = 0 ;
@@ -9036,7 +9035,8 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands) {
9036
9035
}
9037
9036
9038
9037
static void addSrcModifiersAndSrc (MCInst &Inst, const OperandVector &Operands,
9039
- unsigned i, unsigned Opc, unsigned OpName) {
9038
+ unsigned i, unsigned Opc,
9039
+ AMDGPU::OpName OpName) {
9040
9040
if (AMDGPU::getNamedOperandIdx (Opc, OpName) != -1 )
9041
9041
((AMDGPUOperand &)*Operands[i]).addRegOrImmWithFPInputModsOperands (Inst, 2 );
9042
9042
else
0 commit comments