diff mbox series

[v2,7/7] target/nios2: Clean up goto in handle_instruction

Message ID 20210620221046.1526418-8-richard.henderson@linaro.org
State Superseded
Headers show
Series target/nios2: Convert to TranslatorOps | expand

Commit Message

Richard Henderson June 20, 2021, 10:10 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/nios2/translate.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

-- 
2.25.1

Comments

Peter Maydell June 28, 2021, 3:33 p.m. UTC | #1
On Sun, 20 Jun 2021 at 23:13, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/nios2/translate.c | 8 ++------

>  1 file changed, 2 insertions(+), 6 deletions(-)

>

> diff --git a/target/nios2/translate.c b/target/nios2/translate.c

> index 31f63d9faa..276643cee0 100644

> --- a/target/nios2/translate.c

> +++ b/target/nios2/translate.c

> @@ -753,7 +753,8 @@ static void handle_instruction(DisasContext *dc, CPUNios2State *env)

>      op = get_opcode(code);

>

>      if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) {

> -        goto illegal_op;

> +        t_gen_helper_raise_exception(dc, EXCP_ILLEGAL);

> +        return;

>      }

>

>      dc->zero = NULL;

> @@ -764,11 +765,6 @@ static void handle_instruction(DisasContext *dc, CPUNios2State *env)

>      if (dc->zero) {

>          tcg_temp_free(dc->zero);

>      }

> -

> -    return;

> -

> -illegal_op:

> -    t_gen_helper_raise_exception(dc, EXCP_ILLEGAL);

>  }


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


For consistency, we should do the same for the identical code pattern
in handle_r_type_instr().

thanks
-- PMM
diff mbox series

Patch

diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 31f63d9faa..276643cee0 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -753,7 +753,8 @@  static void handle_instruction(DisasContext *dc, CPUNios2State *env)
     op = get_opcode(code);
 
     if (unlikely(op >= ARRAY_SIZE(i_type_instructions))) {
-        goto illegal_op;
+        t_gen_helper_raise_exception(dc, EXCP_ILLEGAL);
+        return;
     }
 
     dc->zero = NULL;
@@ -764,11 +765,6 @@  static void handle_instruction(DisasContext *dc, CPUNios2State *env)
     if (dc->zero) {
         tcg_temp_free(dc->zero);
     }
-
-    return;
-
-illegal_op:
-    t_gen_helper_raise_exception(dc, EXCP_ILLEGAL);
 }
 
 static const char * const regnames[] = {