[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 43/68] target/nios2: Split out named structs for [IRJ]_TYPE
From: |
Richard Henderson |
Subject: |
[PATCH v8 43/68] target/nios2: Split out named structs for [IRJ]_TYPE |
Date: |
Fri, 22 Apr 2022 09:52:13 -0700 |
Currently the structures are anonymous within the macro.
Pull them out to standalone types.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220421151735.31996-44-richard.henderson@linaro.org>
---
target/nios2/translate.c | 48 ++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 21 deletions(-)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index f33015f942..a3c63dbbbd 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -53,16 +53,18 @@
#define INSN_R_TYPE 0x3A
/* I-Type instruction parsing */
+typedef struct {
+ uint8_t op;
+ union {
+ uint16_t u;
+ int16_t s;
+ } imm16;
+ uint8_t b;
+ uint8_t a;
+} InstrIType;
+
#define I_TYPE(instr, code) \
- struct { \
- uint8_t op; \
- union { \
- uint16_t u; \
- int16_t s; \
- } imm16; \
- uint8_t b; \
- uint8_t a; \
- } (instr) = { \
+ InstrIType (instr) = { \
.op = extract32((code), 0, 6), \
.imm16.u = extract32((code), 6, 16), \
.b = extract32((code), 22, 5), \
@@ -70,15 +72,17 @@
}
/* R-Type instruction parsing */
+typedef struct {
+ uint8_t op;
+ uint8_t imm5;
+ uint8_t opx;
+ uint8_t c;
+ uint8_t b;
+ uint8_t a;
+} InstrRType;
+
#define R_TYPE(instr, code) \
- struct { \
- uint8_t op; \
- uint8_t imm5; \
- uint8_t opx; \
- uint8_t c; \
- uint8_t b; \
- uint8_t a; \
- } (instr) = { \
+ InstrRType (instr) = { \
.op = extract32((code), 0, 6), \
.imm5 = extract32((code), 6, 5), \
.opx = extract32((code), 11, 6), \
@@ -88,11 +92,13 @@
}
/* J-Type instruction parsing */
+typedef struct {
+ uint8_t op;
+ uint32_t imm26;
+} InstrJType;
+
#define J_TYPE(instr, code) \
- struct { \
- uint8_t op; \
- uint32_t imm26; \
- } (instr) = { \
+ InstrJType (instr) = { \
.op = extract32((code), 0, 6), \
.imm26 = extract32((code), 6, 26), \
}
--
2.34.1
- [PATCH v8 33/68] target/nios2: Hoist CPU_LOG_INT logging, (continued)
- [PATCH v8 33/68] target/nios2: Hoist CPU_LOG_INT logging, Richard Henderson, 2022/04/22
- [PATCH v8 34/68] target/nios2: Handle EXCP_UNALIGN and EXCP_UNALIGND, Richard Henderson, 2022/04/22
- [PATCH v8 35/68] target/nios2: Cleanup set of CR_EXCEPTION for do_interrupt, Richard Henderson, 2022/04/22
- [PATCH v8 36/68] target/nios2: Clean up handling of tlbmisc in do_exception, Richard Henderson, 2022/04/22
- [PATCH v8 38/68] target/nios2: Implement cpuid, Richard Henderson, 2022/04/22
- [PATCH v8 37/68] target/nios2: Prevent writes to read-only or reserved control fields, Richard Henderson, 2022/04/22
- [PATCH v8 39/68] target/nios2: Implement CR_STATUS.RSIE, Richard Henderson, 2022/04/22
- [PATCH v8 40/68] target/nios2: Remove CPU_INTERRUPT_NMI, Richard Henderson, 2022/04/22
- [PATCH v8 41/68] target/nios2: Support division error exception, Richard Henderson, 2022/04/22
- [PATCH v8 42/68] target/nios2: Use tcg_constant_tl, Richard Henderson, 2022/04/22
- [PATCH v8 43/68] target/nios2: Split out named structs for [IRJ]_TYPE,
Richard Henderson <=
- [PATCH v8 44/68] target/nios2: Split out helpers for gen_i_cmpxx, Richard Henderson, 2022/04/22
- [PATCH v8 45/68] target/nios2: Split out helpers for gen_i_math_logic, Richard Henderson, 2022/04/22
- [PATCH v8 46/68] target/nios2: Split out helpers for gen_r_math_logic, Richard Henderson, 2022/04/22
- [PATCH v8 47/68] target/nios2: Split out helpers for gen_rr_mul_high, Richard Henderson, 2022/04/22
- [PATCH v8 48/68] target/nios2: Split out helpers for gen_rr_shift, Richard Henderson, 2022/04/22