From 02302f29b67a11b1a1997eaf36ca54f106a1b74a Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 13 Oct 2024 11:54:05 -0300 Subject: [PATCH] Fix some instructions missing their corresponding AccessType --- CHANGELOG.md | 4 ++ Cargo.toml | 2 +- .../generated/AccessType_enum_class.hpp | 5 ++ include/generated/AccessType_enum.h | 5 ++ .../InstrDescriptor_Descriptors_array.h | 56 +++++++++---------- pyproject.toml | 2 +- rabbitizer/AccessType.pyi | 5 ++ rust/src/access_type_enum.rs | 5 ++ tables/tables/AccessType.inc | 5 ++ tables/tables/instr_id/cpu/cpu_normal.inc | 48 ++++++++++------ .../tables/instr_id/r5900/r5900_cop2_viwr.inc | 24 +++++--- tables/tables/instr_id/r5900/r5900_normal.inc | 12 ++-- tests/c/logic_checks/descriptor_logic_check.c | 4 ++ 13 files changed, 119 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1823f..6dabd26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix some instructions missing their corresponding AccessType. + ## [1.12.0] - 2024-07-21 ### Added diff --git a/Cargo.toml b/Cargo.toml index c52a58c..4b0a532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "rabbitizer" # Version should be synced with include/common/RabbitizerVersion.h -version = "1.12.0" +version = "1.12.1" edition = "2021" authors = ["Anghelo Carvajal "] description = "MIPS instruction decoder" diff --git a/cplusplus/include/generated/AccessType_enum_class.hpp b/cplusplus/include/generated/AccessType_enum_class.hpp index ae98cd9..6305429 100644 --- a/cplusplus/include/generated/AccessType_enum_class.hpp +++ b/cplusplus/include/generated/AccessType_enum_class.hpp @@ -12,8 +12,13 @@ enum class AccessType { SHORT, WORD, DOUBLEWORD, + QUADWORD, FLOAT, DOUBLEFLOAT, + WORD_LEFT, + WORD_RIGHT, + DOUBLEWORD_LEFT, + DOUBLEWORD_RIGHT, MAX, }; diff --git a/include/generated/AccessType_enum.h b/include/generated/AccessType_enum.h index 69f97cd..162e56b 100644 --- a/include/generated/AccessType_enum.h +++ b/include/generated/AccessType_enum.h @@ -12,8 +12,13 @@ typedef enum RabbitizerAccessType { RAB_ACCESSTYPE_SHORT, RAB_ACCESSTYPE_WORD, RAB_ACCESSTYPE_DOUBLEWORD, + RAB_ACCESSTYPE_QUADWORD, RAB_ACCESSTYPE_FLOAT, RAB_ACCESSTYPE_DOUBLEFLOAT, + RAB_ACCESSTYPE_WORD_LEFT, + RAB_ACCESSTYPE_WORD_RIGHT, + RAB_ACCESSTYPE_DOUBLEWORD_LEFT, + RAB_ACCESSTYPE_DOUBLEWORD_RIGHT, RAB_ACCESSTYPE_MAX, } RabbitizerAccessType; diff --git a/include/generated/InstrDescriptor_Descriptors_array.h b/include/generated/InstrDescriptor_Descriptors_array.h index caf28da..e7e2945 100644 --- a/include/generated/InstrDescriptor_Descriptors_array.h +++ b/include/generated/InstrDescriptor_Descriptors_array.h @@ -28,39 +28,39 @@ const RabbitizerInstrDescriptor RabbitizerInstrDescriptor_Descriptors[] = { [RABBITIZER_INSTR_ID_cpu_daddi] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_immediate}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true }, [RABBITIZER_INSTR_ID_cpu_daddiu] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_immediate}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true }, [RABBITIZER_INSTR_ID_cpu_lui] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate}, .instrType=RABBITIZER_INSTR_TYPE_I, .isUnsigned=true, .modifiesRt=true, .canBeHi=true }, - [RABBITIZER_INSTR_ID_cpu_ldl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_cpu_ldr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_cpu_ldl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT }, + [RABBITIZER_INSTR_ID_cpu_ldr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT }, [RABBITIZER_INSTR_ID_cpu_lb] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_BYTE }, [RABBITIZER_INSTR_ID_cpu_lh] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_SHORT }, - [RABBITIZER_INSTR_ID_cpu_lwl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_cpu_lwl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD_LEFT }, [RABBITIZER_INSTR_ID_cpu_lw] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, [RABBITIZER_INSTR_ID_cpu_lbu] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_BYTE, .doesUnsignedMemoryAccess=true }, [RABBITIZER_INSTR_ID_cpu_lhu] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_SHORT, .doesUnsignedMemoryAccess=true }, - [RABBITIZER_INSTR_ID_cpu_lwr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_cpu_lwr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD_RIGHT }, [RABBITIZER_INSTR_ID_cpu_lwu] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD, .doesUnsignedMemoryAccess=true }, [RABBITIZER_INSTR_ID_cpu_sb] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_BYTE }, [RABBITIZER_INSTR_ID_cpu_sh] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_SHORT }, - [RABBITIZER_INSTR_ID_cpu_swl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, + [RABBITIZER_INSTR_ID_cpu_swl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_WORD_LEFT }, [RABBITIZER_INSTR_ID_cpu_sw] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_WORD }, - [RABBITIZER_INSTR_ID_cpu_sdl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_cpu_sdr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_cpu_swr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_cpu_ll] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_cpu_sdl] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT }, + [RABBITIZER_INSTR_ID_cpu_sdr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT }, + [RABBITIZER_INSTR_ID_cpu_swr] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_WORD_RIGHT }, + [RABBITIZER_INSTR_ID_cpu_ll] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, [RABBITIZER_INSTR_ID_cpu_pref] = { .operands={RAB_OPERAND_cpu_hint, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true }, - [RABBITIZER_INSTR_ID_cpu_lld] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_cpu_lld] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, [RABBITIZER_INSTR_ID_cpu_ld] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, - [RABBITIZER_INSTR_ID_cpu_sc] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_cpu_scd] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, + [RABBITIZER_INSTR_ID_cpu_sc] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_cpu_scd] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, [RABBITIZER_INSTR_ID_cpu_sd] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, [RABBITIZER_INSTR_ID_cpu_cache] = { .operands={RAB_OPERAND_cpu_op, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .notEmittedByCompilers=true }, [RABBITIZER_INSTR_ID_cpu_lwc1] = { .operands={RAB_OPERAND_cpu_ft, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .isFloat=true, .readsRs=true, .modifiesFt=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_FLOAT }, [RABBITIZER_INSTR_ID_cpu_ldc1] = { .operands={RAB_OPERAND_cpu_ft, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .isFloat=true, .isDouble=true, .readsRs=true, .modifiesFt=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEFLOAT }, [RABBITIZER_INSTR_ID_cpu_swc1] = { .operands={RAB_OPERAND_cpu_ft, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .isFloat=true, .readsRs=true, .readsFt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_FLOAT }, [RABBITIZER_INSTR_ID_cpu_sdc1] = { .operands={RAB_OPERAND_cpu_ft, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .isFloat=true, .isDouble=true, .readsRs=true, .readsFt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEFLOAT }, - [RABBITIZER_INSTR_ID_cpu_lwc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_cpu_ldc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_cpu_swc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_cpu_sdc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, + [RABBITIZER_INSTR_ID_cpu_lwc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_cpu_ldc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, + [RABBITIZER_INSTR_ID_cpu_swc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_cpu_sdc2] = { .operands={RAB_OPERAND_cpu_cop2t, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_DOUBLEWORD }, [RABBITIZER_INSTR_ID_cpu_b] = { .operands={RAB_OPERAND_cpu_branch_target_label}, .instrType=RABBITIZER_INSTR_TYPE_I, .isBranch=true, .isPseudo=true }, [RABBITIZER_INSTR_ID_cpu_beqz] = { .operands={RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_branch_target_label}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .isBranch=true, .isPseudo=true }, [RABBITIZER_INSTR_ID_cpu_bnez] = { .operands={RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_branch_target_label}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .isBranch=true, .isPseudo=true }, @@ -776,10 +776,10 @@ const RabbitizerInstrDescriptor RabbitizerInstrDescriptor_Descriptors[] = { [RABBITIZER_INSTR_ID_r4000allegrex_USERDEF_19] = { .operands={0} }, [RABBITIZER_INSTR_ID_r4000allegrex_MAX] = { .operands={0} }, [RABBITIZER_INSTR_ID_r5900_INVALID] = { .operands={RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate}, .instrType=RABBITIZER_INSTR_TYPE_UNKNOWN }, - [RABBITIZER_INSTR_ID_r5900_lq] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_sq] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, - [RABBITIZER_INSTR_ID_r5900_lqc2] = { .operands={RAB_OPERAND_r5900_vft, RAB_OPERAND_cpu_immediate_base}, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_sqc2] = { .operands={RAB_OPERAND_r5900_vft, RAB_OPERAND_cpu_immediate_base}, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true }, + [RABBITIZER_INSTR_ID_r5900_lq] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .modifiesRt=true, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_QUADWORD }, + [RABBITIZER_INSTR_ID_r5900_sq] = { .operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_immediate_base}, .instrType=RABBITIZER_INSTR_TYPE_I, .readsRs=true, .readsRt=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_QUADWORD }, + [RABBITIZER_INSTR_ID_r5900_lqc2] = { .operands={RAB_OPERAND_r5900_vft, RAB_OPERAND_cpu_immediate_base}, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_QUADWORD }, + [RABBITIZER_INSTR_ID_r5900_sqc2] = { .operands={RAB_OPERAND_r5900_vft, RAB_OPERAND_cpu_immediate_base}, .readsRs=true, .canBeLo=true, .doesDereference=true, .doesStore=true, .accessType=RAB_ACCESSTYPE_QUADWORD }, [RABBITIZER_INSTR_ID_r5900_sync_p] = { .operands={0}, .instrType=RABBITIZER_INSTR_TYPE_R }, [RABBITIZER_INSTR_ID_r5900_mult] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_rt}, .instrType=RABBITIZER_INSTR_TYPE_R, .modifiesRd=true, .readsRs=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_mfsa] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, @@ -1030,14 +1030,14 @@ const RabbitizerInstrDescriptor RabbitizerInstrDescriptor_Descriptors[] = { [RABBITIZER_INSTR_ID_r5900_vrget] = { .operands={RAB_OPERAND_r5900_vftxyzw, RAB_OPERAND_r5900_R}, .instrSuffix=RABINSTRSUFFIX_R5900_xyzw, .isFloat=true }, [RABBITIZER_INSTR_ID_r5900_vrinit] = { .operands={RAB_OPERAND_r5900_R, RAB_OPERAND_r5900_vfsl} }, [RABBITIZER_INSTR_ID_r5900_vrxor] = { .operands={RAB_OPERAND_r5900_R, RAB_OPERAND_r5900_vfsl} }, - [RABBITIZER_INSTR_ID_r5900_vilwr_w] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_vilwr_z] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_vilwr_y] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_vilwr_x] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_viswr_w] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_viswr_z] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_viswr_y] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, - [RABBITIZER_INSTR_ID_r5900_viswr_x] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true }, + [RABBITIZER_INSTR_ID_r5900_vilwr_w] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_vilwr_z] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_vilwr_y] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_vilwr_x] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_viswr_w] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_viswr_z] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_viswr_y] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, + [RABBITIZER_INSTR_ID_r5900_viswr_x] = { .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, .doesLoad=true, .accessType=RAB_ACCESSTYPE_WORD }, [RABBITIZER_INSTR_ID_r5900_USERDEF_00] = { .operands={0} }, [RABBITIZER_INSTR_ID_r5900_USERDEF_01] = { .operands={0} }, [RABBITIZER_INSTR_ID_r5900_USERDEF_02] = { .operands={0} }, diff --git a/pyproject.toml b/pyproject.toml index 810c47f..cd5910c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "rabbitizer" # Version should be synced with include/common/RabbitizerVersion.h -version = "1.12.0" +version = "1.12.1" description = "MIPS instruction decoder" # license = "MIT" readme = "README.md" diff --git a/rabbitizer/AccessType.pyi b/rabbitizer/AccessType.pyi index 21e2700..4af364a 100644 --- a/rabbitizer/AccessType.pyi +++ b/rabbitizer/AccessType.pyi @@ -13,6 +13,11 @@ class AccessType: SHORT: Enum WORD: Enum DOUBLEWORD: Enum + QUADWORD: Enum FLOAT: Enum DOUBLEFLOAT: Enum + WORD_LEFT: Enum + WORD_RIGHT: Enum + DOUBLEWORD_LEFT: Enum + DOUBLEWORD_RIGHT: Enum MAX: Enum diff --git a/rust/src/access_type_enum.rs b/rust/src/access_type_enum.rs index 3bb1372..20b54c1 100644 --- a/rust/src/access_type_enum.rs +++ b/rust/src/access_type_enum.rs @@ -12,7 +12,12 @@ pub enum AccessType { SHORT, WORD, DOUBLEWORD, + QUADWORD, FLOAT, DOUBLEFLOAT, + WORD_LEFT, + WORD_RIGHT, + DOUBLEWORD_LEFT, + DOUBLEWORD_RIGHT, MAX, } diff --git a/tables/tables/AccessType.inc b/tables/tables/AccessType.inc index 48f76c7..24ccf2a 100644 --- a/tables/tables/AccessType.inc +++ b/tables/tables/AccessType.inc @@ -7,5 +7,10 @@ RAB_DEF_ACCESSTYPE(SHORT) RAB_DEF_ACCESSTYPE(WORD) RAB_DEF_ACCESSTYPE(DOUBLEWORD) + RAB_DEF_ACCESSTYPE(QUADWORD) RAB_DEF_ACCESSTYPE(FLOAT) RAB_DEF_ACCESSTYPE(DOUBLEFLOAT) + RAB_DEF_ACCESSTYPE(WORD_LEFT) + RAB_DEF_ACCESSTYPE(WORD_RIGHT) + RAB_DEF_ACCESSTYPE(DOUBLEWORD_LEFT) + RAB_DEF_ACCESSTYPE(DOUBLEWORD_RIGHT) diff --git a/tables/tables/instr_id/cpu/cpu_normal.inc b/tables/tables/instr_id/cpu/cpu_normal.inc index 65eb392..50c3583 100644 --- a/tables/tables/instr_id/cpu/cpu_normal.inc +++ b/tables/tables/instr_id/cpu/cpu_normal.inc @@ -198,7 +198,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT ) // Load Doubleword Left RABBITIZER_DEF_INSTR_ID( cpu, 0x1B, ldr, @@ -208,7 +209,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT ) // Load Doubleword Right RABBITIZER_DEF_INSTR_ID( cpu, 0x20, lb, @@ -240,7 +242,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD_LEFT ) // Load Word Left RABBITIZER_DEF_INSTR_ID( cpu, 0x23, lw, @@ -285,7 +288,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD_RIGHT ) // Load Word Right RABBITIZER_DEF_INSTR_ID( cpu, 0x27, lwu, @@ -329,7 +333,8 @@ .readsRt=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_WORD_LEFT ) // Store Word Left RABBITIZER_DEF_INSTR_ID( cpu, 0x2B, sw, @@ -350,7 +355,8 @@ .readsRt=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD_LEFT ) // Store Doubleword Left RABBITIZER_DEF_INSTR_ID( cpu, 0x2D, sdr, @@ -360,7 +366,8 @@ .readsRt=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD_RIGHT ) // Store Doubleword Right RABBITIZER_DEF_INSTR_ID( cpu, 0x2E, swr, @@ -370,7 +377,8 @@ .readsRt=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_WORD_RIGHT ) // Store Word Right RABBITIZER_DEF_INSTR_ID( cpu, 0x30, ll, @@ -381,7 +389,8 @@ .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Load Linked word RABBITIZER_DEF_INSTR_ID( cpu, 0x33, pref, @@ -398,7 +407,8 @@ .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD ) // Load Linked Doubleword RABBITIZER_DEF_INSTR_ID( cpu, 0x37, ld, @@ -420,7 +430,8 @@ .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Store Conditional word RABBITIZER_DEF_INSTR_ID( cpu, 0x3C, scd, @@ -431,7 +442,8 @@ .notEmittedByCompilers=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD ) // Store Conditional Doubleword RABBITIZER_DEF_INSTR_ID( cpu, 0x3F, sd, @@ -514,7 +526,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Load Word to Coprocessor z RABBITIZER_DEF_INSTR_ID( cpu, 0x36, ldc2, @@ -523,7 +536,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD ) // Load Doubleword to Coprocessor z RABBITIZER_DEF_INSTR_ID( cpu, 0x3A, swc2, @@ -532,7 +546,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Store Word from Coprocessor z RABBITIZER_DEF_INSTR_ID( cpu, 0x3E, sdc2, @@ -541,7 +556,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_DOUBLEWORD ) // Store Doubleword from Coprocessor z diff --git a/tables/tables/instr_id/r5900/r5900_cop2_viwr.inc b/tables/tables/instr_id/r5900/r5900_cop2_viwr.inc index d50425a..db2d651 100644 --- a/tables/tables/instr_id/r5900/r5900_cop2_viwr.inc +++ b/tables/tables/instr_id/r5900/r5900_cop2_viwr.inc @@ -30,28 +30,32 @@ .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer load word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x02 << 2) | 0x02, vilwr_z, vilwr.z, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer load word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x04 << 2) | 0x02, vilwr_y, vilwr.y, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer load word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x08 << 2) | 0x02, vilwr_x, vilwr.x, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer load word register RABBITIZER_DEF_INSTR_ID_ALTNAME( @@ -59,26 +63,30 @@ .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer store word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x02 << 2) | 0x03, viswr_z, viswr.z, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer store word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x04 << 2) | 0x03, viswr_y, viswr.y, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer store word register RABBITIZER_DEF_INSTR_ID_ALTNAME( r5900, (0x08 << 2) | 0x03, viswr_x, viswr.x, .operands={RAB_OPERAND_r5900_vit, RAB_OPERAND_r5900_vis_parenthesis}, .isFloat=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_WORD ) // Integer store word register diff --git a/tables/tables/instr_id/r5900/r5900_normal.inc b/tables/tables/instr_id/r5900/r5900_normal.inc index ecdd2ee..6836551 100644 --- a/tables/tables/instr_id/r5900/r5900_normal.inc +++ b/tables/tables/instr_id/r5900/r5900_normal.inc @@ -31,7 +31,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_QUADWORD ) // Load Quadword RABBITIZER_DEF_INSTR_ID( r5900, 0x1F, sq, @@ -41,7 +42,8 @@ .readsRt=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_QUADWORD ) // Store Quadword RABBITIZER_DEF_INSTR_ID( @@ -50,7 +52,8 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesLoad=true + .doesLoad=true, + .accessType=RAB_ACCESSTYPE_QUADWORD ) RABBITIZER_DEF_INSTR_ID( @@ -59,5 +62,6 @@ .readsRs=true, .canBeLo=true, .doesDereference=true, - .doesStore=true + .doesStore=true, + .accessType=RAB_ACCESSTYPE_QUADWORD ) diff --git a/tests/c/logic_checks/descriptor_logic_check.c b/tests/c/logic_checks/descriptor_logic_check.c index 924649b..92dbe3a 100644 --- a/tests/c/logic_checks/descriptor_logic_check.c +++ b/tests/c/logic_checks/descriptor_logic_check.c @@ -87,6 +87,10 @@ int main() { // A instruction should not have both doesLoad and doesStore LOGIC_ERROR(uniqueId, errorCount, !(descriptor->doesLoad && descriptor->doesStore)); + // A dereference must do a non INVALID memory access + LOGIC_ERROR(uniqueId, errorCount, !(descriptor->doesDereference ^ (descriptor->accessType != RAB_ACCESSTYPE_INVALID))); + LOGIC_ERROR_A_IMPLIES_B(uniqueId, errorCount, descriptor->doesUnsignedMemoryAccess, descriptor->doesDereference); + switch (uniqueId) { case RABBITIZER_INSTR_ID_cpu_move: case RABBITIZER_INSTR_ID_rsp_move: