@@ -164,11 +164,11 @@ static DecodeStatus DecodeBRNInstruction(MCInst *Inst, unsigned Insn, uint64_t A
164164
165165
166166#define GET_SUBTARGETINFO_ENUM
167+
167168#include " TriCoreGenSubtargetInfo.inc"
168169
169170
170- bool TriCore_getFeatureBits (unsigned int mode, unsigned int feature)
171- {
171+ bool TriCore_getFeatureBits (unsigned int mode, unsigned int feature) {
172172 // TODO: TriCore_getFeatureBits
173173 return true ;
174174}
@@ -272,9 +272,11 @@ static DecodeStatus DecodeSRInstruction(MCInst *Inst, unsigned Insn,
272272 if (status != MCDisassembler_Success)
273273 return status;
274274
275- status = DecodeRegisterClass (Inst, s1_d, &desc->OpInfo [1 ], Decoder);
276- if (status != MCDisassembler_Success)
277- return status;
275+ if (desc->NumOperands > 1 ) {
276+ status = DecodeRegisterClass (Inst, s1_d, &desc->OpInfo [1 ], Decoder);
277+ if (status != MCDisassembler_Success)
278+ return status;
279+ }
278280
279281 return MCDisassembler_Success;
280282}
@@ -611,6 +613,22 @@ static DecodeStatus DecodeRRInstruction(MCInst *Inst, unsigned Insn,
611613 return MCDisassembler_Fail;
612614
613615 const MCInstrDesc *desc = &TriCoreInsts[MCInst_getOpcode (Inst)];
616+ // / But even if the instruction is in RR format and has only one operand,
617+ // / we cannot be sure whether the operand is s1 or s2
618+ if (desc->NumOperands == 1 ) {
619+ if (desc->OpInfo [0 ].OperandType == MCOI_OPERAND_REGISTER) {
620+ switch (MCInst_getOpcode (Inst)) {
621+ case TriCore_CALLI_rr_v110: {
622+ return DecodeRegisterClass (Inst, s2, &desc->OpInfo [0 ], Decoder);
623+ }
624+ default : {
625+ return DecodeRegisterClass (Inst, s1, &desc->OpInfo [0 ], Decoder);
626+ }
627+ }
628+ }
629+ return MCDisassembler_Fail;
630+ }
631+
614632 // Decode d.
615633 status = DecodeRegisterClass (Inst, d, &desc->OpInfo [0 ], Decoder);
616634 if (status != MCDisassembler_Success)
@@ -1331,14 +1349,14 @@ static DecodeStatus DecodeRCRWInstruction(MCInst *Inst, unsigned Insn, uint64_t
13311349 return status;
13321350 }
13331351
1334- // Decode const4.
1335- MCOperand_CreateImm0 (Inst, const4);
1336-
13371352 // Decode s3.
1338- status = DecodeRegisterClass (Inst, s1 , &desc->OpInfo [opIdx+ 2 ], Decoder);
1353+ status = DecodeRegisterClass (Inst, s3 , &desc->OpInfo [opIdx + 1 ], Decoder);
13391354 if (status != MCDisassembler_Success)
13401355 return status;
13411356
1357+ // Decode const4.
1358+ MCOperand_CreateImm0 (Inst, const4);
1359+
13421360 // Decode width.
13431361 MCOperand_CreateImm0 (Inst, width);
13441362
0 commit comments