qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1 for-2.11 01/10] target/s390x: move cc_name()


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH v1 for-2.11 01/10] target/s390x: move cc_name() to cc_helper.c
Date: Fri, 18 Aug 2017 11:59:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 17.08.2017 11:22, David Hildenbrand wrote:
> While at it, move the translations into the function.
> 
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
>  target/s390x/cc_helper.c | 48 
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  target/s390x/cpu.h       | 48 
> +-----------------------------------------------
>  2 files changed, 49 insertions(+), 47 deletions(-)
> 
> diff --git a/target/s390x/cc_helper.c b/target/s390x/cc_helper.c
> index 1cf8551..a4562e5 100644
> --- a/target/s390x/cc_helper.c
> +++ b/target/s390x/cc_helper.c
> @@ -31,6 +31,54 @@
>  #define HELPER_LOG(x...)
>  #endif
>  
> +const char *cc_name(int cc_op)
> +{
> +    static const char *cc_names[] = {
> +        [CC_OP_CONST0]    = "CC_OP_CONST0",
> +        [CC_OP_CONST1]    = "CC_OP_CONST1",
> +        [CC_OP_CONST2]    = "CC_OP_CONST2",
> +        [CC_OP_CONST3]    = "CC_OP_CONST3",
> +        [CC_OP_DYNAMIC]   = "CC_OP_DYNAMIC",
> +        [CC_OP_STATIC]    = "CC_OP_STATIC",
> +        [CC_OP_NZ]        = "CC_OP_NZ",
> +        [CC_OP_LTGT_32]   = "CC_OP_LTGT_32",
> +        [CC_OP_LTGT_64]   = "CC_OP_LTGT_64",
> +        [CC_OP_LTUGTU_32] = "CC_OP_LTUGTU_32",
> +        [CC_OP_LTUGTU_64] = "CC_OP_LTUGTU_64",
> +        [CC_OP_LTGT0_32]  = "CC_OP_LTGT0_32",
> +        [CC_OP_LTGT0_64]  = "CC_OP_LTGT0_64",
> +        [CC_OP_ADD_64]    = "CC_OP_ADD_64",
> +        [CC_OP_ADDU_64]   = "CC_OP_ADDU_64",
> +        [CC_OP_ADDC_64]   = "CC_OP_ADDC_64",
> +        [CC_OP_SUB_64]    = "CC_OP_SUB_64",
> +        [CC_OP_SUBU_64]   = "CC_OP_SUBU_64",
> +        [CC_OP_SUBB_64]   = "CC_OP_SUBB_64",
> +        [CC_OP_ABS_64]    = "CC_OP_ABS_64",
> +        [CC_OP_NABS_64]   = "CC_OP_NABS_64",
> +        [CC_OP_ADD_32]    = "CC_OP_ADD_32",
> +        [CC_OP_ADDU_32]   = "CC_OP_ADDU_32",
> +        [CC_OP_ADDC_32]   = "CC_OP_ADDC_32",
> +        [CC_OP_SUB_32]    = "CC_OP_SUB_32",
> +        [CC_OP_SUBU_32]   = "CC_OP_SUBU_32",
> +        [CC_OP_SUBB_32]   = "CC_OP_SUBB_32",
> +        [CC_OP_ABS_32]    = "CC_OP_ABS_32",
> +        [CC_OP_NABS_32]   = "CC_OP_NABS_32",
> +        [CC_OP_COMP_32]   = "CC_OP_COMP_32",
> +        [CC_OP_COMP_64]   = "CC_OP_COMP_64",
> +        [CC_OP_TM_32]     = "CC_OP_TM_32",
> +        [CC_OP_TM_64]     = "CC_OP_TM_64",
> +        [CC_OP_NZ_F32]    = "CC_OP_NZ_F32",
> +        [CC_OP_NZ_F64]    = "CC_OP_NZ_F64",
> +        [CC_OP_NZ_F128]   = "CC_OP_NZ_F128",
> +        [CC_OP_ICM]       = "CC_OP_ICM",
> +        [CC_OP_SLA_32]    = "CC_OP_SLA_32",
> +        [CC_OP_SLA_64]    = "CC_OP_SLA_64",
> +        [CC_OP_FLOGR]     = "CC_OP_FLOGR",
> +    };
> +
> +    return cc_names[cc_op];
> +}
> +
>  static uint32_t cc_calc_ltgt_32(int32_t src, int32_t dst)
>  {
>      if (src == dst) {
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index 29fdd5d..3e798ef 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -744,53 +744,7 @@ enum cc_op {
>      CC_OP_MAX
>  };
>  
> -static const char *cc_names[] = {
> -    [CC_OP_CONST0]    = "CC_OP_CONST0",
> -    [CC_OP_CONST1]    = "CC_OP_CONST1",
> -    [CC_OP_CONST2]    = "CC_OP_CONST2",
> -    [CC_OP_CONST3]    = "CC_OP_CONST3",
> -    [CC_OP_DYNAMIC]   = "CC_OP_DYNAMIC",
> -    [CC_OP_STATIC]    = "CC_OP_STATIC",
> -    [CC_OP_NZ]        = "CC_OP_NZ",
> -    [CC_OP_LTGT_32]   = "CC_OP_LTGT_32",
> -    [CC_OP_LTGT_64]   = "CC_OP_LTGT_64",
> -    [CC_OP_LTUGTU_32] = "CC_OP_LTUGTU_32",
> -    [CC_OP_LTUGTU_64] = "CC_OP_LTUGTU_64",
> -    [CC_OP_LTGT0_32]  = "CC_OP_LTGT0_32",
> -    [CC_OP_LTGT0_64]  = "CC_OP_LTGT0_64",
> -    [CC_OP_ADD_64]    = "CC_OP_ADD_64",
> -    [CC_OP_ADDU_64]   = "CC_OP_ADDU_64",
> -    [CC_OP_ADDC_64]   = "CC_OP_ADDC_64",
> -    [CC_OP_SUB_64]    = "CC_OP_SUB_64",
> -    [CC_OP_SUBU_64]   = "CC_OP_SUBU_64",
> -    [CC_OP_SUBB_64]   = "CC_OP_SUBB_64",
> -    [CC_OP_ABS_64]    = "CC_OP_ABS_64",
> -    [CC_OP_NABS_64]   = "CC_OP_NABS_64",
> -    [CC_OP_ADD_32]    = "CC_OP_ADD_32",
> -    [CC_OP_ADDU_32]   = "CC_OP_ADDU_32",
> -    [CC_OP_ADDC_32]   = "CC_OP_ADDC_32",
> -    [CC_OP_SUB_32]    = "CC_OP_SUB_32",
> -    [CC_OP_SUBU_32]   = "CC_OP_SUBU_32",
> -    [CC_OP_SUBB_32]   = "CC_OP_SUBB_32",
> -    [CC_OP_ABS_32]    = "CC_OP_ABS_32",
> -    [CC_OP_NABS_32]   = "CC_OP_NABS_32",
> -    [CC_OP_COMP_32]   = "CC_OP_COMP_32",
> -    [CC_OP_COMP_64]   = "CC_OP_COMP_64",
> -    [CC_OP_TM_32]     = "CC_OP_TM_32",
> -    [CC_OP_TM_64]     = "CC_OP_TM_64",
> -    [CC_OP_NZ_F32]    = "CC_OP_NZ_F32",
> -    [CC_OP_NZ_F64]    = "CC_OP_NZ_F64",
> -    [CC_OP_NZ_F128]   = "CC_OP_NZ_F128",
> -    [CC_OP_ICM]       = "CC_OP_ICM",
> -    [CC_OP_SLA_32]    = "CC_OP_SLA_32",
> -    [CC_OP_SLA_64]    = "CC_OP_SLA_64",
> -    [CC_OP_FLOGR]     = "CC_OP_FLOGR",
> -};
> -
> -static inline const char *cc_name(int cc_op)
> -{
> -    return cc_names[cc_op];
> -}
> +const char *cc_name(int cc_op);
>  
>  static inline void setcc(S390CPU *cpu, uint64_t cc)
>  {
> 

Just compiled with --disable-tcg

s390_cpu_dump_state() needs cc_name. I suggest moving it to helper.c
instead. Opinions?

-- 

Thanks,

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]