Skip to content

Commit 1df4709

Browse files
authored
Merge pull request #78 from Decompollaborate/develop
1.13.0
2 parents 5a112c5 + fb4ab5e commit 1df4709

File tree

19 files changed

+158
-52
lines changed

19 files changed

+158
-52
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.13.0] - 2025-04-04
11+
12+
### Added
13+
14+
- Add support for a few missing R5900 instructions.
15+
- `cfc2.i`, `ctc2.i`, `qmfc2.i` and `qmtc2.i`.
16+
17+
### Changed
18+
19+
- Change some R5900 opcodes to use their suffix.
20+
- Specifically `cfc2`, `ctc2`, `qmfc2` and `qmtc2` are changed to `cfc2.ni`,
21+
`ctc2.ni`, `qmfc2.ni` and `qmtc2.ni`.
22+
23+
### Fixed
24+
25+
- Allow building Python bindings with Clang versions that do not support some
26+
some warning flags.
27+
- Specifically `-Wno-nonnull-compare`.
28+
1029
## [1.12.6] - 2025-02-06
1130

1231
### Fixed
@@ -709,6 +728,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
709728
- First version
710729

711730
[unreleased]: https://github.com/Decompollaborate/rabbitizer/compare/master...develop
731+
[1.13.0]: https://github.com/Decompollaborate/rabbitizer/compare/1.12.6...1.13.0
712732
[1.12.6]: https://github.com/Decompollaborate/rabbitizer/compare/1.12.5...1.12.6
713733
[1.12.5]: https://github.com/Decompollaborate/rabbitizer/compare/1.12.4...1.12.5
714734
[1.12.4]: https://github.com/Decompollaborate/rabbitizer/compare/1.12.3...1.12.4

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55
name = "rabbitizer"
66
# Version should be synced with include/common/RabbitizerVersion.h
7-
version = "1.12.6"
7+
version = "1.13.0"
88
edition = "2021"
99
authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
1010
description = "MIPS instruction decoder"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ If you use a `requirements.txt` file in your repository, then you can add this
6969
library with the following line:
7070

7171
```txt
72-
rabbitizer>=1.12.5,<2.0.0
72+
rabbitizer>=1.13.0,<2.0.0
7373
```
7474

7575
### Development version
@@ -109,7 +109,7 @@ cargo add rabbitizer
109109
Or you can add it manually to your `Cargo.toml`:
110110

111111
```toml
112-
rabbitizer = "1.12.6"
112+
rabbitizer = "1.13.0"
113113
```
114114

115115
See this crate at <https://crates.io/crates/rabbitizer>.

cplusplus/include/generated/UniqueId_enum_class.hpp

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/common/RabbitizerVersion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extern "C" {
1313

1414
// Header version
1515
#define RAB_VERSION_MAJOR 1
16-
#define RAB_VERSION_MINOR 12
17-
#define RAB_VERSION_PATCH 6
16+
#define RAB_VERSION_MINOR 13
17+
#define RAB_VERSION_PATCH 0
1818

1919
#define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH)
2020

include/generated/InstrDescriptor_Descriptors_array.h

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/generated/InstrId_Names_array.h

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/generated/InstrId_enum.h

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/instructions/RabbitizerInstructionR5900.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
#endif
1313

1414

15-
#define RAB_INSTR_R5900_GET_cop2_highbit(self) (SHIFTR((self)->word, 25, 1))
15+
#define RAB_INSTR_R5900_GET_cop2_highlowbit(self) ((SHIFTR((self)->word, 25, 1) << 1) | SHIFTR((self)->word, 0, 1))
1616
#define RAB_INSTR_R5900_GET_cop2_nohighbit_fmt(self) (SHIFTR((self)->word, 21, 4))
1717

1818
#define RAB_INSTR_R5900_GET_mmi_function(self) (SHIFTR((self)->word, 6, 5))
@@ -39,7 +39,7 @@ extern "C" {
3939
#define RAB_INSTR_R5900_GET_imm15(self) (SHIFTR((self)->word, 6, 15))
4040

4141

42-
#define RAB_INSTR_R5900_PACK_cop2_highbit(word, value) (BITREPACK((word), (value), 25, 1))
42+
#define RAB_INSTR_R5900_PACK_cop2_highlowbit(word, value) (BITREPACK(BITREPACK((word), (value) >> 1, 25, 1), (value), 0, 1))
4343
#define RAB_INSTR_R5900_PACK_cop2_nohighbit_fmt(word, value) (BITREPACK((word), (value), 21, 4))
4444

4545
#define RAB_INSTR_R5900_PACK_mmi_function(word, value) (BITREPACK((word), (value), 6, 5))

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[project]
55
name = "rabbitizer"
66
# Version should be synced with include/common/RabbitizerVersion.h
7-
version = "1.12.6"
7+
version = "1.13.0"
88
description = "MIPS instruction decoder"
99
# license = "MIT"
1010
readme = "README.md"

rabbitizer/InstrId.pyi

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/src/instr_id_enum.rs

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
extraCompileArgs = ["-std=c11", "-Wall", "-g",]
1515
if platform.system() == "Linux":
16+
extraCompileArgs += ["-Wno-unknown-warning-option",]
1617
extraCompileArgs += ["-Os", "-Wextra",]
1718
extraCompileArgs += ["-Werror=vla", "-Werror=switch", "-Werror=implicit-fallthrough", "-Werror=unused-function", "-Werror=unused-parameter", "-Werror=shadow", "-Werror=switch"]
1819
extraCompileArgs += ["-Werror=implicit-function-declaration", "-Werror=incompatible-pointer-types"]

src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,29 @@ void RabbitizerInstructionR5900_processUniqueId_Coprocessor2_Special1(Rabbitizer
222222
}
223223
}
224224

225-
void RabbitizerInstructionR5900_processUniqueId_Coprocessor2_nohighbit(RabbitizerInstruction *self) {
225+
void RabbitizerInstructionR5900_processUniqueId_Coprocessor2_ni(RabbitizerInstruction *self) {
226226
uint8_t fmt = RAB_INSTR_R5900_GET_cop2_nohighbit_fmt(self);
227227

228228
self->_mandatorybits = RAB_INSTR_R5900_PACK_cop2_nohighbit_fmt(self->_mandatorybits, fmt);
229229
self->instrIdType = RAB_INSTR_ID_TYPE_R5900_COP2_NOHIGHBIT;
230230

231231
switch (fmt) {
232-
#include "tables/instr_id/r5900/r5900_cop2.inc"
232+
#include "tables/instr_id/r5900/r5900_cop2_ni.inc"
233+
234+
case 0x08:
235+
RabbitizerInstruction_processUniqueId_Coprocessor2_BC2(self);
236+
break;
237+
}
238+
}
239+
240+
void RabbitizerInstructionR5900_processUniqueId_Coprocessor2_i(RabbitizerInstruction *self) {
241+
uint8_t fmt = RAB_INSTR_R5900_GET_cop2_nohighbit_fmt(self);
242+
243+
self->_mandatorybits = RAB_INSTR_R5900_PACK_cop2_nohighbit_fmt(self->_mandatorybits, fmt);
244+
self->instrIdType = RAB_INSTR_ID_TYPE_R5900_COP2_NOHIGHBIT;
245+
246+
switch (fmt) {
247+
#include "tables/instr_id/r5900/r5900_cop2_i.inc"
233248

234249
case 0x08:
235250
RabbitizerInstruction_processUniqueId_Coprocessor2_BC2(self);
@@ -238,17 +253,22 @@ void RabbitizerInstructionR5900_processUniqueId_Coprocessor2_nohighbit(Rabbitize
238253
}
239254

240255
void RabbitizerInstructionR5900_processUniqueId_Coprocessor2(RabbitizerInstruction *self) {
241-
uint8_t fmt = RAB_INSTR_R5900_GET_cop2_highbit(self);
256+
uint8_t fmt = RAB_INSTR_R5900_GET_cop2_highlowbit(self);
242257

243-
self->_mandatorybits = RAB_INSTR_R5900_PACK_cop2_highbit(self->_mandatorybits, fmt);
258+
self->_mandatorybits = RAB_INSTR_R5900_PACK_cop2_highlowbit(self->_mandatorybits, fmt);
244259
self->instrIdType = RAB_INSTR_ID_TYPE_R5900_COP2;
245260

246261
switch (fmt) {
247262
case 0x00:
248-
RabbitizerInstructionR5900_processUniqueId_Coprocessor2_nohighbit(self);
263+
RabbitizerInstructionR5900_processUniqueId_Coprocessor2_ni(self);
249264
break;
250265

251266
case 0x01:
267+
RabbitizerInstructionR5900_processUniqueId_Coprocessor2_i(self);
268+
break;
269+
270+
case 0x02:
271+
case 0x03:
252272
RabbitizerInstructionR5900_processUniqueId_Coprocessor2_Special1(self);
253273
break;
254274
}

tables/tables/instr_id/RabbitizerInstrId_r5900.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
#include "r5900/r5900_cop1_fpu_s.inc"
2525

26-
#include "r5900/r5900_cop2.inc"
26+
#include "r5900/r5900_cop2_ni.inc"
27+
#include "r5900/r5900_cop2_i.inc"
2728
#include "r5900/r5900_cop2_bc2.inc"
2829
#include "r5900/r5900_cop2_special1.inc"
2930
#include "r5900/r5900_cop2_special2.inc"
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* SPDX-FileCopyrightText: © 2022-2024 Decompollaborate */
1+
/* SPDX-FileCopyrightText: © 2025 Decompollaborate */
22
/* SPDX-License-Identifier: MIT */
33

44
/*
5-
31--------26-25------21 ----------------------------------------0
6-
| = COP2 | fmt | |
7-
------6----------5-----------------------------------------------
5+
31--------26-25------21 --------------------------------------1-0
6+
| = COP2 | fmt | |1|
7+
------6----------5---------------------------------------------1-
88
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
9-
00 | --- | QMFC2 | CFC2 | --- | --- | QMTC2 | CTC2 | --- |
9+
00 | --- |QMFC2.I| CFC2.I| --- | --- |QMTC2.I| CTC2.I| --- |
1010
01 | *1 | --- | --- | --- | --- | --- | --- | --- |
1111
10 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
1212
11 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
@@ -15,23 +15,23 @@
1515
*/
1616

1717
// TODO: properties
18-
RABBITIZER_DEF_INSTR_ID(
19-
r5900, 0x01, qmfc2,
18+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
19+
r5900, 0x01, qmfc2_i, qmfc2.i,
2020
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vfs},
2121
.modifiesRt=true
2222
)
23-
RABBITIZER_DEF_INSTR_ID(
24-
r5900, 0x02, cfc2,
23+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
24+
r5900, 0x02, cfc2_i, cfc2.i,
2525
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vis},
2626
.modifiesRt=true
2727
)
28-
RABBITIZER_DEF_INSTR_ID(
29-
r5900, 0x05, qmtc2,
28+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
29+
r5900, 0x05, qmtc2_i, qmtc2.i,
3030
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vfs},
3131
.readsRt=true
3232
)
33-
RABBITIZER_DEF_INSTR_ID(
34-
r5900, 0x06, ctc2,
33+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
34+
r5900, 0x06, ctc2_i, ctc2.i,
3535
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vis},
3636
.readsRt=true
3737
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* SPDX-FileCopyrightText: © 2025 Decompollaborate */
2+
/* SPDX-License-Identifier: MIT */
3+
4+
/*
5+
31--------26-25------21 --------------------------------------1-0
6+
| = COP2 | fmt | |0|
7+
------6----------5---------------------------------------------1-
8+
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
9+
00 | --- |QMFC2.NI|CFC2.NI| --- | --- |QMTC2.NI|CTC2.NI| --- |
10+
01 | *1 | --- | --- | --- | --- | --- | --- | --- |
11+
10 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
12+
11 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
13+
hi |-------|-------|-------|-------|-------|-------|-------|-------|
14+
*1 = BC instructions, see BC2 list *2 =see special1 table
15+
*/
16+
17+
// TODO: properties
18+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
19+
r5900, 0x01, qmfc2_ni, qmfc2.ni,
20+
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vfs},
21+
.modifiesRt=true
22+
)
23+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
24+
r5900, 0x02, cfc2_ni, cfc2.ni,
25+
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vis},
26+
.modifiesRt=true
27+
)
28+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
29+
r5900, 0x05, qmtc2_ni, qmtc2.ni,
30+
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vfs},
31+
.readsRt=true
32+
)
33+
RABBITIZER_DEF_INSTR_ID_ALTNAME(
34+
r5900, 0x06, ctc2_ni, ctc2.ni,
35+
.operands={RAB_OPERAND_cpu_rt, RAB_OPERAND_r5900_vis},
36+
.readsRt=true
37+
)

tests/c/instruction_checks/r5900_disasm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const TestEntry test_entries[] = {
4242
TEST_ENTRY_C(0x4A220BFF, NULL, "viswr.w $vi2, ($vi1)"),
4343

4444
TEST_ENTRY_C(0x4A0307B2, NULL, "viaddi $vi3, $vi0, -0x2"),
45+
46+
TEST_ENTRY_C(0x48500800, NULL, "cfc2.ni $s0, $vi1"),
47+
TEST_ENTRY_C(0x48500801, NULL, "cfc2.i $s0, $vi1"),
4548
};
4649

4750
size_t test_entries_len = ARRAY_COUNT(test_entries);

0 commit comments

Comments
 (0)