Patchwork [2/4] tcg-hppa: Fix 64-bit argument ordering.

login
register
mail settings
Submitter Richard Henderson
Date Feb. 20, 2010, 7:32 p.m.
Message ID <027d44173ad08343a293da9d00aad4c215b64449.1268754659.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/47866/
State New
Headers show

Comments

Richard Henderson - Feb. 20, 2010, 7:32 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/tcg.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
Stuart Brady - March 17, 2010, 1:49 a.m.
On Sat, Feb 20, 2010 at 11:32:23AM -0800, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Acked-by: Stuart Brady <stuart.brady@gmail.com>

> ---
>  tcg/tcg.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 1818868..d753149 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -596,7 +596,17 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,
>                  real_args++;
>              }
>  #endif
> -#ifdef TCG_TARGET_WORDS_BIGENDIAN
> +	    /* If stack grows up, then we will be placing successive
> +	       arguments at lower addresses, which means we need to
> +	       reverse the order compared to how we would normally
> +	       treat either big or little-endian.  For those arguments
> +	       that will wind up in registers, this still works for
> +	       HPPA (the only current STACK_GROWSUP target) since the
> +	       argument registers are *also* allocated in decreasing
> +	       order.  If another such target is added, this logic may
> +	       have to get more complicated to differentiate between
> +	       stack arguments and register arguments.  */
> +#if defined(TCG_TARGET_WORDS_BIGENDIAN) != defined(TCG_TARGET_STACK_GROWSUP)
>              *gen_opparam_ptr++ = args[i] + 1;
>              *gen_opparam_ptr++ = args[i];
>  #else
> -- 
> 1.6.6.1
> 
>
Aurelien Jarno - March 23, 2010, 9:27 p.m.
On Sat, Feb 20, 2010 at 11:32:23AM -0800, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Thanks, applied.

> ---
>  tcg/tcg.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 1818868..d753149 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -596,7 +596,17 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,
>                  real_args++;
>              }
>  #endif
> -#ifdef TCG_TARGET_WORDS_BIGENDIAN
> +	    /* If stack grows up, then we will be placing successive
> +	       arguments at lower addresses, which means we need to
> +	       reverse the order compared to how we would normally
> +	       treat either big or little-endian.  For those arguments
> +	       that will wind up in registers, this still works for
> +	       HPPA (the only current STACK_GROWSUP target) since the
> +	       argument registers are *also* allocated in decreasing
> +	       order.  If another such target is added, this logic may
> +	       have to get more complicated to differentiate between
> +	       stack arguments and register arguments.  */
> +#if defined(TCG_TARGET_WORDS_BIGENDIAN) != defined(TCG_TARGET_STACK_GROWSUP)
>              *gen_opparam_ptr++ = args[i] + 1;
>              *gen_opparam_ptr++ = args[i];
>  #else
> -- 
> 1.6.6.1
> 
> 
> 
>

Patch

diff --git a/tcg/tcg.c b/tcg/tcg.c
index 1818868..d753149 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -596,7 +596,17 @@  void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,
                 real_args++;
             }
 #endif
-#ifdef TCG_TARGET_WORDS_BIGENDIAN
+	    /* If stack grows up, then we will be placing successive
+	       arguments at lower addresses, which means we need to
+	       reverse the order compared to how we would normally
+	       treat either big or little-endian.  For those arguments
+	       that will wind up in registers, this still works for
+	       HPPA (the only current STACK_GROWSUP target) since the
+	       argument registers are *also* allocated in decreasing
+	       order.  If another such target is added, this logic may
+	       have to get more complicated to differentiate between
+	       stack arguments and register arguments.  */
+#if defined(TCG_TARGET_WORDS_BIGENDIAN) != defined(TCG_TARGET_STACK_GROWSUP)
             *gen_opparam_ptr++ = args[i] + 1;
             *gen_opparam_ptr++ = args[i];
 #else