Patchwork [3/4] tcg/i386: Remove unused registers from tcg_target_call_iarg_regs

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

Comments

Stefan Weil - Sept. 13, 2012, 5:37 p.m.
32 bit x86 hosts don't need registers for helper function arguments
because they use the default stack based calling convention.

Removing the registers allows simpler code for function
tcg_target_get_call_iarg_regs_count.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 tcg/i386/tcg-target.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
Aurelien Jarno - Sept. 13, 2012, 9:22 p.m.
On Thu, Sep 13, 2012 at 07:37:45PM +0200, Stefan Weil wrote:
> 32 bit x86 hosts don't need registers for helper function arguments
> because they use the default stack based calling convention.
> 
> Removing the registers allows simpler code for function
> tcg_target_get_call_iarg_regs_count.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  tcg/i386/tcg-target.c |   10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index ef63967..375d87d 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -75,9 +75,7 @@ static const int tcg_target_call_iarg_regs[] = {
>      TCG_REG_R8,
>      TCG_REG_R9,
>  #else
> -    TCG_REG_EAX,
> -    TCG_REG_EDX,
> -    TCG_REG_ECX
> +    /* 32 bit mode uses stack based calling convention (GCC default). */
>  #endif
>  };
>  
> @@ -127,11 +125,7 @@ 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)
>  {
> -    if (TCG_TARGET_REG_BITS == 64) {
> -        return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -    }
> -
> -    return 0;
> +    return ARRAY_SIZE(tcg_target_call_iarg_regs);
>  }
>  
>  /* parse target specific constraints */
> -- 
> 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:45PM +0200, Stefan Weil wrote:
> 32 bit x86 hosts don't need registers for helper function arguments
> because they use the default stack based calling convention.
> 
> Removing the registers allows simpler code for function
> tcg_target_get_call_iarg_regs_count.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  tcg/i386/tcg-target.c |   10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index ef63967..375d87d 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -75,9 +75,7 @@ static const int tcg_target_call_iarg_regs[] = {
>      TCG_REG_R8,
>      TCG_REG_R9,
>  #else
> -    TCG_REG_EAX,
> -    TCG_REG_EDX,
> -    TCG_REG_ECX
> +    /* 32 bit mode uses stack based calling convention (GCC default). */
>  #endif
>  };
>  
> @@ -127,11 +125,7 @@ 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)
>  {
> -    if (TCG_TARGET_REG_BITS == 64) {
> -        return ARRAY_SIZE(tcg_target_call_iarg_regs);
> -    }
> -
> -    return 0;
> +    return ARRAY_SIZE(tcg_target_call_iarg_regs);
>  }
>  
>  /* parse target specific constraints */
> -- 
> 1.7.10
> 
> 

Thanks, applied.

Patch

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index ef63967..375d87d 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -75,9 +75,7 @@  static const int tcg_target_call_iarg_regs[] = {
     TCG_REG_R8,
     TCG_REG_R9,
 #else
-    TCG_REG_EAX,
-    TCG_REG_EDX,
-    TCG_REG_ECX
+    /* 32 bit mode uses stack based calling convention (GCC default). */
 #endif
 };
 
@@ -127,11 +125,7 @@  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)
 {
-    if (TCG_TARGET_REG_BITS == 64) {
-        return ARRAY_SIZE(tcg_target_call_iarg_regs);
-    }
-
-    return 0;
+    return ARRAY_SIZE(tcg_target_call_iarg_regs);
 }
 
 /* parse target specific constraints */