diff mbox series

[2/2] Hexagon: fix outdated `hex_new_*` references in comments

Message ID eeb2d1a1d3db8c9444db20a3df01fe93faddc3cd.1684873957.git.quic_mathbern@quicinc.com
State New
Headers show
Series Hexagon: two minor cleanups to comments and python scripts | expand

Commit Message

Matheus Tavares Bernardino May 23, 2023, 8:36 p.m. UTC
Some code comments refer to hex_new_value and hex_new_pred_value, which
have been transferred to DisasContext and, in the case of hex_new_value,
should now be accessed through get_result_gpr(). Let's update these
comments to reflect the new state of the codebase. Since they are only
meant to assist developers, we can replace the old names with some
pseudocode when convenient.

Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
 target/hexagon/genptr.c    | 10 +++++-----
 target/hexagon/translate.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Taylor Simpson May 23, 2023, 9:09 p.m. UTC | #1
> -----Original Message-----
> From: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> Sent: Tuesday, May 23, 2023 3:36 PM
> To: qemu-devel@nongnu.org
> Cc: Taylor Simpson <tsimpson@quicinc.com>; Brian Cain
> <bcain@quicinc.com>; Marco Liebel (QUIC) <quic_mliebel@quicinc.com>
> Subject: [PATCH 2/2] Hexagon: fix outdated `hex_new_*` references in
> comments
> 
> Some code comments refer to hex_new_value and hex_new_pred_value,
> which have been transferred to DisasContext and, in the case of
> hex_new_value, should now be accessed through get_result_gpr(). Let's
> update these comments to reflect the new state of the codebase. Since they
> are only meant to assist developers, we can replace the old names with some
> pseudocode when convenient.
> 
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>  target/hexagon/genptr.c    | 10 +++++-----
>  target/hexagon/translate.c |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index
> cb2aa28a19..8d11d928c9 100644
> --- a/target/hexagon/genptr.c
> +++ b/target/hexagon/genptr.c
> @@ -880,7 +880,7 @@ static void gen_endloop0(DisasContext *ctx)
>          /*
>           *    if (hex_gpr[HEX_REG_LC0] > 1) {
>           *        PC = hex_gpr[HEX_REG_SA0];
> -         *        hex_new_value[HEX_REG_LC0] = hex_gpr[HEX_REG_LC0] - 1;
> +         *        result_gpr(HEX_REG_LC0) = hex_gpr[HEX_REG_LC0] - 1;
>           *    }
>           */

Go ahead and change these completely to pseudo-code
    If (LC0 > 1) {
        PC = SA0;
        LC0 = LC0 - 1;
    }

Thanks,
Taylor
diff mbox series

Patch

diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
index cb2aa28a19..8d11d928c9 100644
--- a/target/hexagon/genptr.c
+++ b/target/hexagon/genptr.c
@@ -880,7 +880,7 @@  static void gen_endloop0(DisasContext *ctx)
         /*
          *    if (hex_gpr[HEX_REG_LC0] > 1) {
          *        PC = hex_gpr[HEX_REG_SA0];
-         *        hex_new_value[HEX_REG_LC0] = hex_gpr[HEX_REG_LC0] - 1;
+         *        result_gpr(HEX_REG_LC0) = hex_gpr[HEX_REG_LC0] - 1;
          *    }
          */
         TCGLabel *label3 = gen_new_label();
@@ -899,7 +899,7 @@  static void gen_endloop1(DisasContext *ctx)
     /*
      *    if (hex_gpr[HEX_REG_LC1] > 1) {
      *        PC = hex_gpr[HEX_REG_SA1];
-     *        hex_new_value[HEX_REG_LC1] = hex_gpr[HEX_REG_LC1] - 1;
+     *        result_gpr(HEX_REG_LC1) = hex_gpr[HEX_REG_LC1] - 1;
      *    }
      */
     TCGLabel *label = gen_new_label();
@@ -948,11 +948,11 @@  static void gen_endloop01(DisasContext *ctx)
     /*
      *    if (hex_gpr[HEX_REG_LC0] > 1) {
      *        PC = hex_gpr[HEX_REG_SA0];
-     *        hex_new_value[HEX_REG_LC0] = hex_gpr[HEX_REG_LC0] - 1;
+     *        result_gpr(HEX_REG_LC0) = hex_gpr[HEX_REG_LC0] - 1;
      *    } else {
      *        if (hex_gpr[HEX_REG_LC1] > 1) {
-     *            hex_next_pc = hex_gpr[HEX_REG_SA1];
-     *            hex_new_value[HEX_REG_LC1] = hex_gpr[HEX_REG_LC1] - 1;
+     *            next_pc = hex_gpr[HEX_REG_SA1];
+     *            result_gpr(HEX_REG_LC1) = hex_gpr[HEX_REG_LC1] - 1;
      *        }
      *    }
      */
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index b18f1a9051..8838ab2364 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -556,7 +556,7 @@  static void gen_start_packet(DisasContext *ctx)
     }
 
     /*
-     * Preload the predicated pred registers into hex_new_pred_value[pred_num]
+     * Preload the predicated pred registers into ctx->new_pred_value[pred_num]
      * Only endloop instructions conditionally write to pred registers
      */
     if (ctx->need_commit && pkt->pkt_has_endloop) {