Skip to content

Commit

Permalink
Update inc files and insn names
Browse files Browse the repository at this point in the history
  • Loading branch information
R33v0LT committed Jan 5, 2025
1 parent 43da7fa commit e2fa94f
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 266 deletions.
4 changes: 2 additions & 2 deletions arch/ARC/ARCDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static DecodeStatus getInstruction(MCInst *Instr, uint64_t *Size, const uint8_t
uint64_t Insn64;
if (!readInstruction64(Bytes, BytesLen, Address, Size, &Insn64))
return MCDisassembler_Fail;
Result = decodeInstruction(DecoderTable64, Instr,
Result = decodeInstruction_8(DecoderTable64, Instr,
Insn64, Address, NULL);
if (MCDisassembler_Success == Result) {
;
Expand All @@ -444,7 +444,7 @@ static DecodeStatus getInstruction(MCInst *Instr, uint64_t *Size, const uint8_t
uint64_t Insn48;
if (!readInstruction48(Bytes, BytesLen, Address, Size, &Insn48))
return MCDisassembler_Fail;
Result = decodeInstruction(DecoderTable48, Instr,
Result = decodeInstruction_8(DecoderTable48, Instr,
Insn48, Address, NULL);
if (MCDisassembler_Success == Result) {
;
Expand Down
20 changes: 10 additions & 10 deletions arch/ARC/ARCGenAsmWriter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/* https://github.com/capstone-engine/llvm-capstone */

#include <capstone/platform.h>
#include <assert.h>
#include "../../cs_priv.h"

/// getMnemonic - This method is automatically generated by tablegen
/// from the instruction set description.
Expand Down Expand Up @@ -1001,11 +1001,11 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {
SStream_concat0(O, MnemonicInfo.first);

uint32_t Bits = MnemonicInfo.second;
assert(Bits != 0 && "Cannot print this instruction.");
CS_ASSERT_RET(Bits != 0 && "Cannot print this instruction.");

// Fragment 0 encoded into 4 bits for 10 unique commands.
switch ((Bits >> 11) & 15) {
default: assert(0 && "Invalid command number.");
default: CS_ASSERT_RET(0 && "Invalid command number.");
case 0:
// DBG_VALUE, DBG_VALUE_LIST, DBG_INSTR_REF, DBG_PHI, DBG_LABEL, BUNDLE, ...
return;
Expand Down Expand Up @@ -1074,7 +1074,7 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {

// Fragment 1 encoded into 4 bits for 10 unique commands.
switch ((Bits >> 15) & 15) {
default: assert(0 && "Invalid command number.");
default: CS_ASSERT_RET(0 && "Invalid command number.");
case 0:
// ADJCALLSTACKDOWN, CTLZ, CTTZ, GETFI, STB_FAR, STH_FAR, ST_FAR, ADC_f_r...
SStream_concat0(O, ", ");
Expand Down Expand Up @@ -1135,7 +1135,7 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {

// Fragment 2 encoded into 3 bits for 6 unique commands.
switch ((Bits >> 19) & 7) {
default: assert(0 && "Invalid command number.");
default: CS_ASSERT_RET(0 && "Invalid command number.");
case 0:
// ADJCALLSTACKDOWN, CTLZ, CTTZ, GETFI, ADC_f_rrlimm, ADC_f_rrr, ADC_f_rr...
printOperand(MI, 1, O);
Expand Down Expand Up @@ -1173,7 +1173,7 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {

// Fragment 3 encoded into 2 bits for 3 unique commands.
switch ((Bits >> 22) & 3) {
default: assert(0 && "Invalid command number.");
default: CS_ASSERT_RET(0 && "Invalid command number.");
case 0:
// ADJCALLSTACKDOWN, CTLZ, CTTZ, GETFI, STB_FAR, STH_FAR, ST_FAR, ADD_S_l...
return;
Expand All @@ -1192,7 +1192,7 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {

// Fragment 4 encoded into 2 bits for 3 unique commands.
switch ((Bits >> 24) & 3) {
default: assert(0 && "Invalid command number.");
default: CS_ASSERT_RET(0 && "Invalid command number.");
case 0:
// ADC_f_rrlimm, ADC_f_rrr, ADC_f_rrs12, ADC_f_rru6, ADC_rrlimm, ADC_rrr,...
printOperand(MI, 2, O);
Expand Down Expand Up @@ -1228,7 +1228,7 @@ static void printInstruction(MCInst *MI, uint64_t Address, SStream *O) {
/// for the specified register.
static const char *getRegisterName(unsigned RegNo) {
#ifndef CAPSTONE_DIET
assert(RegNo && RegNo < 66 && "Invalid register number!");
CS_ASSERT_RET_VAL(RegNo && RegNo < 66 && "Invalid register number!", NULL);

static const char AsmStrs[] = {
/* 0 */ "%r10\0"
Expand Down Expand Up @@ -1305,8 +1305,8 @@ static const char *getRegisterName(unsigned RegNo) {
213, 237, 261, 285, 25, 54, 97, 131, 78,
};

assert (*(AsmStrs+RegAsmOffset[RegNo-1]) &&
"Invalid alt name index for register!");
CS_ASSERT_RET_VAL(*(AsmStrs+RegAsmOffset[RegNo-1]) &&
"Invalid alt name index for register!", NULL);
return AsmStrs+RegAsmOffset[RegNo-1];
#else
return NULL;
Expand Down
68 changes: 23 additions & 45 deletions arch/ARC/ARCGenCSInsnEnum.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,27 @@
/* https://github.com/capstone-engine/llvm-capstone */

ARC_INS_INVALID,
ARC_INS_HASH,
ARC_INS_h,
ARC_INS_PBR,
ARC_INS_ERROR_FLS,
ARC_INS_ERROR_FFS,
ARC_INS_PLDFI,
ARC_INS_STB_FAR,
ARC_INS_STH_FAR,
ARC_INS_ST_FAR,
ARC_INS_ADC_,
ARC_INS_ADC_F,
ARC_INS_ADC,
ARC_INS_ADC_F,
ARC_INS_ADD_S,
ARC_INS_ADD_,
ARC_INS_ADD_F,
ARC_INS_ADD,
ARC_INS_AND_,
ARC_INS_AND_F,
ARC_INS_ADD_F,
ARC_INS_AND,
ARC_INS_AND_F,
ARC_INS_ASL_S,
ARC_INS_ASL_,
ARC_INS_ASL_F,
ARC_INS_ASL,
ARC_INS_ASL_F,
ARC_INS_ASR_S,
ARC_INS_ASR_,
ARC_INS_ASR_F,
ARC_INS_ASR,
ARC_INS_ASR_F,
ARC_INS_BCLR_S,
ARC_INS_BEQ_S,
ARC_INS_BGE_S,
Expand Down Expand Up @@ -141,49 +136,37 @@
ARC_INS_LD,
ARC_INS_LEAVE_S,
ARC_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ARC_INS_SUB_,
ARC_INS_SUB_F,
ARC_INS_SUB3_F,
ARC_INS_SUB,
ARC_INS_XOR_,
ARC_INS_XOR_F,
ARC_INS_SUB_F,
ARC_INS_XOR,
ARC_INS_XOR_F,
Loading

0 comments on commit e2fa94f

Please sign in to comment.