[05/20] target/arm: Mark some arrays const

Message ID 20181011205206.3552-6-richard.henderson@linaro.org
State New
Headers show
Series
  • target/arm: Convert some neon insns to gvec
Related show

Commit Message

Richard Henderson Oct. 11, 2018, 8:51 p.m.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/translate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.17.1

Comments

Philippe Mathieu-Daudé Oct. 11, 2018, 11:34 p.m. | #1
On 11/10/2018 22:51, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


> ---

>  target/arm/translate.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

> 

> diff --git a/target/arm/translate.c b/target/arm/translate.c

> index 736880ee71..d59ffa1c67 100644

> --- a/target/arm/translate.c

> +++ b/target/arm/translate.c

> @@ -72,7 +72,7 @@ static TCGv_i64 cpu_F0d, cpu_F1d;

>  

>  #include "exec/gen-icount.h"

>  

> -static const char *regnames[] =

> +static const char * const regnames[] =

>      { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",

>        "r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" };

>  

> @@ -4907,7 +4907,7 @@ static struct {

>      int nregs;

>      int interleave;

>      int spacing;

> -} neon_ls_element_type[11] = {

> +} const neon_ls_element_type[11] = {

>      {4, 4, 1},

>      {4, 4, 2},

>      {4, 1, 1},

> @@ -13089,7 +13089,7 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)

>      translator_loop(ops, &dc.base, cpu, tb);

>  }

>  

> -static const char *cpu_mode_names[16] = {

> +static const char * const cpu_mode_names[16] = {

>    "usr", "fiq", "irq", "svc", "???", "???", "mon", "abt",

>    "???", "???", "hyp", "und", "???", "???", "???", "sys"

>  };

>
Peter Maydell Oct. 19, 2018, 1:05 p.m. | #2
On 11 October 2018 at 21:51, Richard Henderson
<richard.henderson@linaro.org> wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/arm/translate.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/target/arm/translate.c b/target/arm/translate.c

> index 736880ee71..d59ffa1c67 100644

> --- a/target/arm/translate.c

> +++ b/target/arm/translate.c

> @@ -72,7 +72,7 @@ static TCGv_i64 cpu_F0d, cpu_F1d;

>

>  #include "exec/gen-icount.h"

>

> -static const char *regnames[] =

> +static const char * const regnames[] =

>      { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",

>        "r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" };

>

> @@ -4907,7 +4907,7 @@ static struct {

>      int nregs;

>      int interleave;

>      int spacing;

> -} neon_ls_element_type[11] = {

> +} const neon_ls_element_type[11] = {

>      {4, 4, 1},

>      {4, 4, 2},

>      {4, 1, 1},

> @@ -13089,7 +13089,7 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)

>      translator_loop(ops, &dc.base, cpu, tb);

>  }

>

> -static const char *cpu_mode_names[16] = {

> +static const char * const cpu_mode_names[16] = {

>    "usr", "fiq", "irq", "svc", "???", "???", "mon", "abt",

>    "???", "???", "hyp", "und", "???", "???", "???", "sys"

>  };


I dropped the last hunk here as one of my other patches
has moved this array (and fixed the constness in passing).

thanks
-- PMM

Patch

diff --git a/target/arm/translate.c b/target/arm/translate.c
index 736880ee71..d59ffa1c67 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -72,7 +72,7 @@  static TCGv_i64 cpu_F0d, cpu_F1d;
 
 #include "exec/gen-icount.h"
 
-static const char *regnames[] =
+static const char * const regnames[] =
     { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
       "r8", "r9", "r10", "r11", "r12", "r13", "r14", "pc" };
 
@@ -4907,7 +4907,7 @@  static struct {
     int nregs;
     int interleave;
     int spacing;
-} neon_ls_element_type[11] = {
+} const neon_ls_element_type[11] = {
     {4, 4, 1},
     {4, 4, 2},
     {4, 1, 1},
@@ -13089,7 +13089,7 @@  void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
     translator_loop(ops, &dc.base, cpu, tb);
 }
 
-static const char *cpu_mode_names[16] = {
+static const char * const cpu_mode_names[16] = {
   "usr", "fiq", "irq", "svc", "???", "???", "mon", "abt",
   "???", "???", "hyp", "und", "???", "???", "???", "sys"
 };