diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2021-05-29 20:13:44 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2021-06-24 16:48:08 +0200 |
commit | 06106772933bd215a797d28cdbff4aac5676b430 (patch) | |
tree | 3afc1b13ef4335b9314cf401f4e3ec71e8eb733d | |
parent | dae7324b97ebe2c4012f299f0b6ec48ac8c1e74d (diff) | |
download | qemu-06106772933bd215a797d28cdbff4aac5676b430.zip qemu-06106772933bd215a797d28cdbff4aac5676b430.tar.gz qemu-06106772933bd215a797d28cdbff4aac5676b430.tar.bz2 |
target/mips: Optimize regnames[] arrays
Since all entries are no more than 3/4/6 bytes (including nul
terminator), can save space and pie runtime relocations by
declaring regnames[] as array of 3/4/6 const char.
Inspired-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210617174323.2900831-10-f4bug@amsat.org>
-rw-r--r-- | target/mips/cpu.c | 2 | ||||
-rw-r--r-- | target/mips/internal.h | 2 | ||||
-rw-r--r-- | target/mips/tcg/msa_translate.c | 2 | ||||
-rw-r--r-- | target/mips/tcg/mxu_translate.c | 4 | ||||
-rw-r--r-- | target/mips/tcg/translate.c | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 96236ab..d426918 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -35,7 +35,7 @@ #include "qapi/qapi-commands-machine-target.h" #include "fpu_helper.h" -const char regnames[32][4] = { +const char regnames[32][3] = { "r0", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", diff --git a/target/mips/internal.h b/target/mips/internal.h index 18d5da6..eecdd10 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -74,7 +74,7 @@ struct mips_def_t { int32_t SAARP; }; -extern const char regnames[32][4]; +extern const char regnames[32][3]; extern const char fregnames[32][4]; extern const struct mips_def_t mips_defs[]; diff --git a/target/mips/tcg/msa_translate.c b/target/mips/tcg/msa_translate.c index ae6587e..b0df4f8 100644 --- a/target/mips/tcg/msa_translate.c +++ b/target/mips/tcg/msa_translate.c @@ -255,7 +255,7 @@ enum { OPC_BINSRI_df = (0x7 << 23) | OPC_MSA_BIT_09, }; -static const char * const msaregnames[] = { +static const char msaregnames[][6] = { "w0.d0", "w0.d1", "w1.d0", "w1.d1", "w2.d0", "w2.d1", "w3.d0", "w3.d1", "w4.d0", "w4.d1", "w5.d0", "w5.d1", diff --git a/target/mips/tcg/mxu_translate.c b/target/mips/tcg/mxu_translate.c index fb0a811..963d4ba 100644 --- a/target/mips/tcg/mxu_translate.c +++ b/target/mips/tcg/mxu_translate.c @@ -447,9 +447,9 @@ enum { static TCGv mxu_gpr[NUMBER_OF_MXU_REGISTERS - 1]; static TCGv mxu_CR; -static const char * const mxuregnames[] = { +static const char mxuregnames[][4] = { "XR1", "XR2", "XR3", "XR4", "XR5", "XR6", "XR7", "XR8", - "XR9", "XR10", "XR11", "XR12", "XR13", "XR14", "XR15", "MXU_CR", + "XR9", "XR10", "XR11", "XR12", "XR13", "XR14", "XR15", "XCR", }; void mxu_translate_init(void) diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index d248b5e..b4a454e 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -1280,11 +1280,11 @@ TCGv_i64 fpu_f64[32]; #define DISAS_STOP DISAS_TARGET_0 #define DISAS_EXIT DISAS_TARGET_1 -static const char * const regnames_HI[] = { +static const char regnames_HI[][4] = { "HI0", "HI1", "HI2", "HI3", }; -static const char * const regnames_LO[] = { +static const char regnames_LO[][4] = { "LO0", "LO1", "LO2", "LO3", }; |