Patchwork [4/4] tcg: Remove tcg_target_get_call_iarg_regs_count

login
register
mail settings
Submitter Stefan Weil
Date Sept. 13, 2012, 5:37 p.m.
Message ID <1347557866-7256-5-git-send-email-sw@weilnetz.de>
Download mbox | patch
Permalink /patch/183690/
State Accepted
Headers show

Comments

Stefan Weil - Sept. 13, 2012, 5:37 p.m.
The TCG targets no longer need individual implementations.

Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,
'flags' is no longer used in tcg_target_get_call_iarg_regs_count.

The remaining tcg_target_get_call_iarg_regs_count is trivial and only
called once. Therefore the patch eliminates it completely.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 tcg/arm/tcg-target.c   |    6 ------
 tcg/hppa/tcg-target.c  |    6 ------
 tcg/i386/tcg-target.c  |    6 ------
 tcg/ia64/tcg-target.c  |    6 ------
 tcg/mips/tcg-target.c  |    6 ------
 tcg/ppc/tcg-target.c   |    6 ------
 tcg/ppc64/tcg-target.c |    6 ------
 tcg/s390/tcg-target.c  |    5 -----
 tcg/sparc/tcg-target.c |    6 ------
 tcg/tcg.c              |    3 +--
 tcg/tci/tcg-target.c   |    6 ------
 11 files changed, 1 insertion(+), 61 deletions(-)
Aurelien Jarno - Sept. 13, 2012, 9:22 p.m.
On Thu, Sep 13, 2012 at 07:37:46PM +0200, Stefan Weil wrote:
> The TCG targets no longer need individual implementations.
> 
> Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,
> 'flags' is no longer used in tcg_target_get_call_iarg_regs_count.
> 
> The remaining tcg_target_get_call_iarg_regs_count is trivial and only
> called once. Therefore the patch eliminates it completely.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  tcg/arm/tcg-target.c   |    6 ------
>  tcg/hppa/tcg-target.c  |    6 ------
>  tcg/i386/tcg-target.c  |    6 ------
>  tcg/ia64/tcg-target.c  |    6 ------
>  tcg/mips/tcg-target.c  |    6 ------
>  tcg/ppc/tcg-target.c   |    6 ------
>  tcg/ppc64/tcg-target.c |    6 ------
>  tcg/s390/tcg-target.c  |    5 -----
>  tcg/sparc/tcg-target.c |    6 ------
>  tcg/tcg.c              |    3 +--
>  tcg/tci/tcg-target.c   |    6 ------
>  11 files changed, 1 insertion(+), 61 deletions(-)
> 
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index cf0ca3d..38e2057 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -145,12 +145,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
> index 4f17928..985476a 100644
> --- a/tcg/hppa/tcg-target.c
> +++ b/tcg/hppa/tcg-target.c
> @@ -175,12 +175,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      *insn_ptr = insn;
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 375d87d..18c44ff 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -122,12 +122,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
> index dc588db..7f31876 100644
> --- a/tcg/ia64/tcg-target.c
> +++ b/tcg/ia64/tcg-target.c
> @@ -176,12 +176,6 @@ static const int tcg_target_call_oarg_regs[] = {
>      TCG_REG_R8
>  };
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 8;
> -}
> -
>  /*
>   * opcode formation
>   */
> diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
> index 1006e28..aad590c 100644
> --- a/tcg/mips/tcg-target.c
> +++ b/tcg/mips/tcg-target.c
> @@ -185,12 +185,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
> index 0cff181..b889e34 100644
> --- a/tcg/ppc/tcg-target.c
> +++ b/tcg/ppc/tcg-target.c
> @@ -221,12 +221,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE (tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
> index 27a0ae8..08c5c0f 100644
> --- a/tcg/ppc64/tcg-target.c
> +++ b/tcg/ppc64/tcg-target.c
> @@ -208,12 +208,6 @@ static void patch_reloc (uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static int tcg_target_get_call_iarg_regs_count (int flags)
> -{
> -    return ARRAY_SIZE (tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint (TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
> index 99b5339..287f010 100644
> --- a/tcg/s390/tcg-target.c
> +++ b/tcg/s390/tcg-target.c
> @@ -376,11 +376,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return sizeof(tcg_target_call_iarg_regs) / sizeof(int);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
> index 247a278..3b6c108 100644
> --- a/tcg/sparc/tcg-target.c
> +++ b/tcg/sparc/tcg-target.c
> @@ -137,12 +137,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 6;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index a4e7f42..988f25c 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -89,7 +89,6 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
>                         tcg_target_long arg2);
>  static int tcg_target_const_match(tcg_target_long val,
>                                    const TCGArgConstraint *arg_ct);
> -static int tcg_target_get_call_iarg_regs_count(int flags);
>  
>  TCGOpDef tcg_op_defs[] = {
>  #define DEF(s, oargs, iargs, cargs, flags) { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
> @@ -1866,7 +1865,7 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
>  
>      flags = args[nb_oargs + nb_iargs];
>  
> -    nb_regs = tcg_target_get_call_iarg_regs_count(flags);
> +    nb_regs = ARRAY_SIZE(tcg_target_call_iarg_regs);
>      if (nb_regs > nb_params)
>          nb_regs = nb_params;
>  
> diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
> index 7124b15..7d43132 100644
> --- a/tcg/tci/tcg-target.c
> +++ b/tcg/tci/tcg-target.c
> @@ -891,12 +891,6 @@ static int tcg_target_const_match(tcg_target_long val,
>      return arg_ct->ct & TCG_CT_CONST;
>  }
>  
> -/* Maximum number of register used for input function arguments. */
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -}
> -
>  static void tcg_target_init(TCGContext *s)
>  {
>  #if defined(CONFIG_DEBUG_TCG_INTERPRETER)
> -- 
> 1.7.10
> 
> 

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Aurelien Jarno - Sept. 22, 2012, 2:55 p.m.
On Thu, Sep 13, 2012 at 07:37:46PM +0200, Stefan Weil wrote:
> The TCG targets no longer need individual implementations.
> 
> Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,
> 'flags' is no longer used in tcg_target_get_call_iarg_regs_count.
> 
> The remaining tcg_target_get_call_iarg_regs_count is trivial and only
> called once. Therefore the patch eliminates it completely.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  tcg/arm/tcg-target.c   |    6 ------
>  tcg/hppa/tcg-target.c  |    6 ------
>  tcg/i386/tcg-target.c  |    6 ------
>  tcg/ia64/tcg-target.c  |    6 ------
>  tcg/mips/tcg-target.c  |    6 ------
>  tcg/ppc/tcg-target.c   |    6 ------
>  tcg/ppc64/tcg-target.c |    6 ------
>  tcg/s390/tcg-target.c  |    5 -----
>  tcg/sparc/tcg-target.c |    6 ------
>  tcg/tcg.c              |    3 +--
>  tcg/tci/tcg-target.c   |    6 ------
>  11 files changed, 1 insertion(+), 61 deletions(-)
> 
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index cf0ca3d..38e2057 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -145,12 +145,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
> index 4f17928..985476a 100644
> --- a/tcg/hppa/tcg-target.c
> +++ b/tcg/hppa/tcg-target.c
> @@ -175,12 +175,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      *insn_ptr = insn;
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 375d87d..18c44ff 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -122,12 +122,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
> index dc588db..7f31876 100644
> --- a/tcg/ia64/tcg-target.c
> +++ b/tcg/ia64/tcg-target.c
> @@ -176,12 +176,6 @@ static const int tcg_target_call_oarg_regs[] = {
>      TCG_REG_R8
>  };
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 8;
> -}
> -
>  /*
>   * opcode formation
>   */
> diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
> index 1006e28..aad590c 100644
> --- a/tcg/mips/tcg-target.c
> +++ b/tcg/mips/tcg-target.c
> @@ -185,12 +185,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 4;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
> index 0cff181..b889e34 100644
> --- a/tcg/ppc/tcg-target.c
> +++ b/tcg/ppc/tcg-target.c
> @@ -221,12 +221,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE (tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
> index 27a0ae8..08c5c0f 100644
> --- a/tcg/ppc64/tcg-target.c
> +++ b/tcg/ppc64/tcg-target.c
> @@ -208,12 +208,6 @@ static void patch_reloc (uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static int tcg_target_get_call_iarg_regs_count (int flags)
> -{
> -    return ARRAY_SIZE (tcg_target_call_iarg_regs);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint (TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
> index 99b5339..287f010 100644
> --- a/tcg/s390/tcg-target.c
> +++ b/tcg/s390/tcg-target.c
> @@ -376,11 +376,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return sizeof(tcg_target_call_iarg_regs) / sizeof(int);
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
> index 247a278..3b6c108 100644
> --- a/tcg/sparc/tcg-target.c
> +++ b/tcg/sparc/tcg-target.c
> @@ -137,12 +137,6 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>      }
>  }
>  
> -/* maximum number of register used for input function arguments */
> -static inline int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return 6;
> -}
> -
>  /* parse target specific constraints */
>  static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
>  {
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index a4e7f42..988f25c 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -89,7 +89,6 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
>                         tcg_target_long arg2);
>  static int tcg_target_const_match(tcg_target_long val,
>                                    const TCGArgConstraint *arg_ct);
> -static int tcg_target_get_call_iarg_regs_count(int flags);
>  
>  TCGOpDef tcg_op_defs[] = {
>  #define DEF(s, oargs, iargs, cargs, flags) { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
> @@ -1866,7 +1865,7 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
>  
>      flags = args[nb_oargs + nb_iargs];
>  
> -    nb_regs = tcg_target_get_call_iarg_regs_count(flags);
> +    nb_regs = ARRAY_SIZE(tcg_target_call_iarg_regs);
>      if (nb_regs > nb_params)
>          nb_regs = nb_params;
>  
> diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
> index 7124b15..7d43132 100644
> --- a/tcg/tci/tcg-target.c
> +++ b/tcg/tci/tcg-target.c
> @@ -891,12 +891,6 @@ static int tcg_target_const_match(tcg_target_long val,
>      return arg_ct->ct & TCG_CT_CONST;
>  }
>  
> -/* Maximum number of register used for input function arguments. */
> -static int tcg_target_get_call_iarg_regs_count(int flags)
> -{
> -    return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -}
> -
>  static void tcg_target_init(TCGContext *s)
>  {
>  #if defined(CONFIG_DEBUG_TCG_INTERPRETER)
> -- 
> 1.7.10
> 
> 

Thanks, applied.

Patch

diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index cf0ca3d..38e2057 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -145,12 +145,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return 4;
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
index 4f17928..985476a 100644
--- a/tcg/hppa/tcg-target.c
+++ b/tcg/hppa/tcg-target.c
@@ -175,12 +175,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     *insn_ptr = insn;
 }
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return 4;
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 375d87d..18c44ff 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -122,12 +122,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return ARRAY_SIZE(tcg_target_call_iarg_regs);
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
index dc588db..7f31876 100644
--- a/tcg/ia64/tcg-target.c
+++ b/tcg/ia64/tcg-target.c
@@ -176,12 +176,6 @@  static const int tcg_target_call_oarg_regs[] = {
     TCG_REG_R8
 };
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return 8;
-}
-
 /*
  * opcode formation
  */
diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
index 1006e28..aad590c 100644
--- a/tcg/mips/tcg-target.c
+++ b/tcg/mips/tcg-target.c
@@ -185,12 +185,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return 4;
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index 0cff181..b889e34 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -221,12 +221,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return ARRAY_SIZE (tcg_target_call_iarg_regs);
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
index 27a0ae8..08c5c0f 100644
--- a/tcg/ppc64/tcg-target.c
+++ b/tcg/ppc64/tcg-target.c
@@ -208,12 +208,6 @@  static void patch_reloc (uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static int tcg_target_get_call_iarg_regs_count (int flags)
-{
-    return ARRAY_SIZE (tcg_target_call_iarg_regs);
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint (TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index 99b5339..287f010 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -376,11 +376,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-static int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return sizeof(tcg_target_call_iarg_regs) / sizeof(int);
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 247a278..3b6c108 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -137,12 +137,6 @@  static void patch_reloc(uint8_t *code_ptr, int type,
     }
 }
 
-/* maximum number of register used for input function arguments */
-static inline int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return 6;
-}
-
 /* parse target specific constraints */
 static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
 {
diff --git a/tcg/tcg.c b/tcg/tcg.c
index a4e7f42..988f25c 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -89,7 +89,6 @@  static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
                        tcg_target_long arg2);
 static int tcg_target_const_match(tcg_target_long val,
                                   const TCGArgConstraint *arg_ct);
-static int tcg_target_get_call_iarg_regs_count(int flags);
 
 TCGOpDef tcg_op_defs[] = {
 #define DEF(s, oargs, iargs, cargs, flags) { #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
@@ -1866,7 +1865,7 @@  static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
 
     flags = args[nb_oargs + nb_iargs];
 
-    nb_regs = tcg_target_get_call_iarg_regs_count(flags);
+    nb_regs = ARRAY_SIZE(tcg_target_call_iarg_regs);
     if (nb_regs > nb_params)
         nb_regs = nb_params;
 
diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
index 7124b15..7d43132 100644
--- a/tcg/tci/tcg-target.c
+++ b/tcg/tci/tcg-target.c
@@ -891,12 +891,6 @@  static int tcg_target_const_match(tcg_target_long val,
     return arg_ct->ct & TCG_CT_CONST;
 }
 
-/* Maximum number of register used for input function arguments. */
-static int tcg_target_get_call_iarg_regs_count(int flags)
-{
-    return ARRAY_SIZE(tcg_target_call_iarg_regs);
-}
-
 static void tcg_target_init(TCGContext *s)
 {
 #if defined(CONFIG_DEBUG_TCG_INTERPRETER)