target-cris: Avoid unused-function warnings
cover target-cris: Avoid unused-function warnings
These patches correct some unused-function warnings in target-cris. I've included some cleanup and removal of wrapper functions to maintain symmetry between the to-reg and from-reg code.
thanks
-- PMM
Peter Maydell (2):
target-cris/translate.c: Remove t_gen_mov_TN_reg and t_gen_mov_reg_TN target-cris/translate.c: Remove _t_gen_mov_TN_env and
_t_gen_mov_env_TN
target-cris/translate.c | 40 +++++----------------------------------- target-cris/translate_v10.c | 2 +- 2 files changed, 6 insertions(+), 36 deletions(-)
Signature · 1 line
1.8.5.4
PATCH 1/2 target-cris/translate.c: Remove t_gen_mov_TN_reg and t_gen_mov_reg_TN
Remove the t_gen_mov_TN_reg and t_gen_mov_reg_TN wrappers: the latter is completely unused, and the former only used in a few places (which are thus inconsistent with the rest of the decoder which directly accesses cpu_R[]).
---
My main aim here is to remove the unused function; I think dropping the used-a-few-times function makes the code clearer, but am happy to drop it if you disagree.
--- target-cris/translate.c | 21 +++------------------ target-cris/translate_v10.c | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-)
target-cris/translate.c +3 -18
@@ -163,21 +163,6 @@ static int preg_sizes[] = {#define t_gen_mov_env_TN (member, tn) \ _t_gen_mov_env_TN(offsetof(CPUCRISState, member), (tn)) -static inline void t_gen_mov_TN_reg (TCGv tn,int r) -{ -if (r <0 || r >15 ) { -fprintf (stderr,"wrong register read $r%d\n" , r); - } -tcg_gen_mov_tl (tn, cpu_R[r]); -} -static inline void t_gen_mov_reg_TN (int r,TCGv tn) -{ -if (r <0 || r >15 ) { -fprintf (stderr,"wrong register write $r%d\n" , r); - } -tcg_gen_mov_tl (cpu_R[r], tn); -} -static inline void _t_gen_mov_TN_env (TCGv tn,int offset) {if (offset >sizeof (CPUCRISState)) {
@@ -1811,7 +1796,7 @@ static int dec_swap_r(CPUCRISState *env, DisasContext *dc)cris_cc_mask (dc,CC_MASK_NZ ); t0 =tcg_temp_new (); -t_gen_mov_TN_reg (t0, dc->op1); +tcg_gen_mov_tl (t0, cpu_R[dc->op1]);if (dc->op2 &8 ) {tcg_gen_not_tl (t0, t0); }
@@ -2119,7 +2104,7 @@ static int dec_move_rp(CPUCRISState *env, DisasContext *dc) t[0 ] =tcg_temp_new ();if (dc->op2 ==PR_CCS ) {cris_evaluate_flags (dc); -t_gen_mov_TN_reg (t[0 ], dc->op1); +tcg_gen_mov_tl (t[0 ], cpu_R[dc->op1]);if (dc->tb_flags &U_FLAG ) { t[1 ] =tcg_temp_new ();/* User space is not allowed to touch all flags. */
@@ -2129,7 +2114,7 @@ static int dec_move_rp(CPUCRISState *env, DisasContext *dc)tcg_temp_free (t[1 ]); } }else { -t_gen_mov_TN_reg (t[0 ], dc->op1); +tcg_gen_mov_tl (t[0 ], cpu_R[dc->op1]); }t_gen_mov_preg_TN (dc, dc->op2, t[0 ]);
target-cris/translate_v10.c +1 -1
@@ -516,7 +516,7 @@ static void dec10_reg_swap(DisasContext *dc)cris_cc_mask (dc,CC_MASK_NZVC ); t0 =tcg_temp_new (); -t_gen_mov_TN_reg (t0, dc->src); +tcg_gen_mov_tl (t0, cpu_R[dc->src]);if (dc->dst &8 )tcg_gen_not_tl (t0, t0);if (dc->dst &4 )
Signature · 1 line
1.8.5.4
PATCH 2/2 target-cris/translate.c: Remove _t_gen_mov_TN_env and _t_gen_mov_env_TN
In reply to Peter MaydellThe wrapper functions _t_gen_mov_TN_env and _t_gen_mov_env_TN are only used via their accompanying non-underscore macros. The check they add on offset is thus pointless, since the compiler will complain if the struct field passed to the macro is not part of the struct. Remove the functions and make the macros directly expand to the appropriate tcg_gen_{ld,st}_tl calls.
This conveniently avoids a warning due to _t_gen_mov_TN_env() being unused.
--- target-cris/translate.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
target-cris/translate.c +2 -17
@@ -159,24 +159,9 @@ static int preg_sizes[] = { };#define t_gen_mov_TN_env (tn, member) \ - _t_gen_mov_TN_env((tn), offsetof(CPUCRISState, member)) + tcg_gen_ld_tl(tn, cpu_env, offsetof(CPUCRISState, member))#define t_gen_mov_env_TN (member, tn) \ - _t_gen_mov_env_TN(offsetof(CPUCRISState, member), (tn)) - -static inline void _t_gen_mov_TN_env (TCGv tn,int offset) -{ -if (offset >sizeof (CPUCRISState)) { -fprintf (stderr,"wrong load from env from off=%d\n" , offset); - } -tcg_gen_ld_tl (tn, cpu_env, offset); -} -static inline void _t_gen_mov_env_TN (int offset,TCGv tn) -{ -if (offset >sizeof (CPUCRISState)) { -fprintf (stderr,"wrong store to env at off=%d\n" , offset); - } -tcg_gen_st_tl (tn, cpu_env, offset); -} + tcg_gen_st_tl(tn, cpu_env, offsetof(CPUCRISState, member))static inline void t_gen_mov_TN_preg (TCGv tn,int r) {
Signature · 1 line
1.8.5.4
Edgar E. Iglesias
AppliedQuoted 3 lines · Peter Maydell
These patches correct some unused-function warnings in target-cris. I've included some cleanup and removal of wrapper functions to maintain symmetry between the to-reg and from-reg code.
Applied both, thanks,
Edgar
Quoted 17 lines
thanks
-- PMMPeter Maydell (2):
target-cris/translate.c: Removet_gen_mov_TN_regandt_gen_mov_reg_TNtarget-cris/translate.c: Remove_t_gen_mov_TN_envand_t_gen_mov_env_TNtarget-cris/translate.c | 40 +++++----------------------------------- target-cris/translate_v10.c | 2 +- 2 files changed, 6 insertions(+), 36 deletions(-)Signature · 1 line
1.8.5.4