@@ -1365,24 +1365,6 @@ static DecodeStatus DecodeRFEInstruction(MCInst &Inst, unsigned Insn,
1365
1365
DecodeStatus S = MCDisassembler::Success;
1366
1366
1367
1367
unsigned Rn = fieldFromInstruction (Insn, 16 , 4 );
1368
- unsigned mode = fieldFromInstruction (Insn, 23 , 2 );
1369
-
1370
- switch (mode) {
1371
- case 0 :
1372
- mode = ARM_AM::da;
1373
- break ;
1374
- case 1 :
1375
- mode = ARM_AM::ia;
1376
- break ;
1377
- case 2 :
1378
- mode = ARM_AM::db;
1379
- break ;
1380
- case 3 :
1381
- mode = ARM_AM::ib;
1382
- break ;
1383
- }
1384
-
1385
- Inst.addOperand (MCOperand::createImm (mode));
1386
1368
if (!Check (S, DecodeGPRRegisterClass (Inst, Rn, Address, Decoder)))
1387
1369
return MCDisassembler::Fail;
1388
1370
@@ -2779,10 +2761,6 @@ static DecodeStatus DecodeMVEModImmInstruction(MCInst &Inst, unsigned Insn,
2779
2761
2780
2762
Inst.addOperand (MCOperand::createImm (imm));
2781
2763
2782
- Inst.addOperand (MCOperand::createImm (ARMVCC::None));
2783
- Inst.addOperand (MCOperand::createReg (0 ));
2784
- Inst.addOperand (MCOperand::createImm (0 ));
2785
-
2786
2764
return S;
2787
2765
}
2788
2766
@@ -2807,7 +2785,6 @@ static DecodeStatus DecodeMVEVADCInstruction(MCInst &Inst, unsigned Insn,
2807
2785
return MCDisassembler::Fail;
2808
2786
if (!fieldFromInstruction (Insn, 12 , 1 )) // I bit clear => need input FPSCR
2809
2787
Inst.addOperand (MCOperand::createReg (ARM::FPSCR_NZCV));
2810
- Inst.addOperand (MCOperand::createImm (Qd));
2811
2788
2812
2789
return S;
2813
2790
}
@@ -5956,10 +5933,6 @@ static DecodeStatus DecodeMVEVCMP(MCInst &Inst, unsigned Insn, uint64_t Address,
5956
5933
if (!Check (S, predicate_decoder (Inst, fc, Address, Decoder)))
5957
5934
return MCDisassembler::Fail;
5958
5935
5959
- Inst.addOperand (MCOperand::createImm (ARMVCC::None));
5960
- Inst.addOperand (MCOperand::createReg (0 ));
5961
- Inst.addOperand (MCOperand::createImm (0 ));
5962
-
5963
5936
return S;
5964
5937
}
5965
5938
@@ -6103,9 +6076,23 @@ DecodeStatus ARMDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
6103
6076
ArrayRef<uint8_t > Bytes,
6104
6077
uint64_t Address,
6105
6078
raw_ostream &CS) const {
6079
+ DecodeStatus S;
6106
6080
if (STI.hasFeature (ARM::ModeThumb))
6107
- return getThumbInstruction (MI, Size, Bytes, Address, CS);
6108
- return getARMInstruction (MI, Size, Bytes, Address, CS);
6081
+ S = getThumbInstruction (MI, Size, Bytes, Address, CS);
6082
+ else
6083
+ S = getARMInstruction (MI, Size, Bytes, Address, CS);
6084
+ if (S == DecodeStatus::Fail)
6085
+ return S;
6086
+
6087
+ // Verify that the decoded instruction has the correct number of operands.
6088
+ const MCInstrDesc &MCID = MCII->get (MI.getOpcode ());
6089
+ if (!MCID.isVariadic () && MI.getNumOperands () != MCID.getNumOperands ()) {
6090
+ reportFatalInternalError (MCII->getName (MI.getOpcode ()) + " : expected " +
6091
+ Twine (MCID.getNumOperands ()) + " operands, got " +
6092
+ Twine (MI.getNumOperands ()) + " \n " );
6093
+ }
6094
+
6095
+ return S;
6109
6096
}
6110
6097
6111
6098
DecodeStatus ARMDisassembler::getARMInstruction (MCInst &MI, uint64_t &Size,
@@ -6144,7 +6131,7 @@ DecodeStatus ARMDisassembler::getARMInstruction(MCInst &MI, uint64_t &Size,
6144
6131
const DecodeTable Tables[] = {
6145
6132
{DecoderTableVFP32, false }, {DecoderTableVFPV832, false },
6146
6133
{DecoderTableNEONData32, true }, {DecoderTableNEONLoadStore32, true },
6147
- {DecoderTableNEONDup32, true }, {DecoderTablev8NEON32, false },
6134
+ {DecoderTableNEONDup32, false }, {DecoderTablev8NEON32, false },
6148
6135
{DecoderTablev8Crypto32, false },
6149
6136
};
6150
6137
@@ -6154,8 +6141,10 @@ DecodeStatus ARMDisassembler::getARMInstruction(MCInst &MI, uint64_t &Size,
6154
6141
Size = 4 ;
6155
6142
// Add a fake predicate operand, because we share these instruction
6156
6143
// definitions with Thumb2 where these instructions are predicable.
6157
- if (Table.DecodePred && !DecodePredicateOperand (MI, 0xE , Address, this ))
6158
- return MCDisassembler::Fail;
6144
+ if (Table.DecodePred && MCII->get (MI.getOpcode ()).isPredicable ()) {
6145
+ MI.addOperand (MCOperand::createImm (ARMCC::AL));
6146
+ MI.addOperand (MCOperand::createReg (ARM::NoRegister));
6147
+ }
6159
6148
return Result;
6160
6149
}
6161
6150
}
@@ -6189,8 +6178,6 @@ void ARMDisassembler::AddThumb1SBit(MCInst &MI, bool InITBlock) const {
6189
6178
return ;
6190
6179
}
6191
6180
}
6192
-
6193
- MI.insert (I, MCOperand::createReg (InITBlock ? ARM::NoRegister : ARM::CPSR));
6194
6181
}
6195
6182
6196
6183
bool ARMDisassembler::isVectorPredicable (const MCInst &MI) const {
@@ -6491,7 +6478,6 @@ DecodeStatus ARMDisassembler::getThumbInstruction(MCInst &MI, uint64_t &Size,
6491
6478
STI);
6492
6479
if (Result != MCDisassembler::Fail) {
6493
6480
Size = 4 ;
6494
- Check (Result, AddThumbPredicate (MI));
6495
6481
return Result;
6496
6482
}
6497
6483
}
0 commit comments