From fee3e72cdf4f2971f534dbea8ba8b1f49a1230ff Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 26 Aug 2014 19:31:29 +0000 Subject: [PATCH] Strengthen various insn emission functions gcc/ 2014-08-26 David Malcolm * rtl.h (push_to_sequence): Strengthen param from rtx to rtx_insn *. (push_to_sequence2): Likewise for both params. (delete_insns_since): Likewise for param. (reorder_insns_nobb): Likewise for all three params. (set_new_first_and_last_insn): Likewise for both params. * emit-rtl.h (set_first_insn): Strengthen param "insn" from rtx to rtx_insn *. Remove now-redundant cast. (set_last_insn): Likewise. * builtins.c (expand_builtin_return): Strengthen local "call_fusage" from rtx to rtx_insn *. * cfgrtl.c (create_basic_block_structure): Likewise for local "after". * emit-rtl.c (set_new_first_and_last_insn): Likewise for params "first", "last" and local "insn". (delete_insns_since): Likewise for param "from". (reorder_insns_nobb): Likewise for params "from", "to", "after" and local "x". (push_to_sequence): Likewise for param "first" and local "last". (push_to_sequence2): Likewise for params "first" and "last". * lra.c (emit_add3_insn): Likewise for local "last". (lra_emit_add): Likewise. * lra-constraints.c (base_to_reg): Likewise for locals "insn", "last_insn". (process_address_1): Likewise for locals "insn", last". * modulo-sched.c (ps_first_note): Likewise for return type. * optabs.c (expand_binop_directly): Likewise for param "last". From-SVN: r214539 --- gcc/ChangeLog | 32 ++++++++++++++++++++++++++++++++ gcc/builtins.c | 2 +- gcc/cfgrtl.c | 2 +- gcc/emit-rtl.c | 16 ++++++++-------- gcc/emit-rtl.h | 8 ++++---- gcc/lra-constraints.c | 8 ++++---- gcc/lra.c | 6 ++++-- gcc/modulo-sched.c | 2 +- gcc/optabs.c | 2 +- gcc/rtl.h | 10 +++++----- 10 files changed, 61 insertions(+), 27 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef9dd0dca7d..81f9bd5a9ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,35 @@ +2014-08-26 David Malcolm + + * rtl.h (push_to_sequence): Strengthen param from rtx to + rtx_insn *. + (push_to_sequence2): Likewise for both params. + (delete_insns_since): Likewise for param. + (reorder_insns_nobb): Likewise for all three params. + (set_new_first_and_last_insn): Likewise for both params. + + * emit-rtl.h (set_first_insn): Strengthen param "insn" from rtx to + rtx_insn *. Remove now-redundant cast. + (set_last_insn): Likewise. + + * builtins.c (expand_builtin_return): Strengthen local + "call_fusage" from rtx to rtx_insn *. + * cfgrtl.c (create_basic_block_structure): Likewise for local + "after". + * emit-rtl.c (set_new_first_and_last_insn): Likewise for params + "first", "last" and local "insn". + (delete_insns_since): Likewise for param "from". + (reorder_insns_nobb): Likewise for params "from", "to", "after" + and local "x". + (push_to_sequence): Likewise for param "first" and local "last". + (push_to_sequence2): Likewise for params "first" and "last". + * lra.c (emit_add3_insn): Likewise for local "last". + (lra_emit_add): Likewise. + * lra-constraints.c (base_to_reg): Likewise for locals "insn", + "last_insn". + (process_address_1): Likewise for locals "insn", last". + * modulo-sched.c (ps_first_note): Likewise for return type. + * optabs.c (expand_binop_directly): Likewise for param "last". + 2014-08-26 David Malcolm * rtl.h (get_last_insn_anywhere): Strengthen return type from rtx diff --git a/gcc/builtins.c b/gcc/builtins.c index 971e525f19f..e5a9b4d7228 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1743,7 +1743,7 @@ expand_builtin_return (rtx result) int size, align, regno; enum machine_mode mode; rtx reg; - rtx call_fusage = 0; + rtx_insn *call_fusage = 0; result = convert_memory_address (Pmode, result); diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 7b1fc2c4c94..c39049202a3 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -283,7 +283,7 @@ create_basic_block_structure (rtx_insn *head, rtx_insn *end, rtx_note *bb_note, { /* If we found an existing note, thread it back onto the chain. */ - rtx after; + rtx_insn *after; if (LABEL_P (head)) after = head; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 51f799c9d20..8fe13312ab4 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2488,9 +2488,9 @@ gen_label_rtx (void) Used for an inline-procedure after copying the insn chain. */ void -set_new_first_and_last_insn (rtx first, rtx last) +set_new_first_and_last_insn (rtx_insn *first, rtx_insn *last) { - rtx insn; + rtx_insn *insn; set_first_insn (first); set_last_insn (last); @@ -4165,7 +4165,7 @@ add_function_usage_to (rtx call_insn, rtx call_fusage) FROM becomes the new last instruction. */ void -delete_insns_since (rtx from) +delete_insns_since (rtx_insn *from) { if (from == 0) set_first_insn (0); @@ -4185,10 +4185,10 @@ delete_insns_since (rtx from) called after delay-slot filling has been done. */ void -reorder_insns_nobb (rtx from, rtx to, rtx after) +reorder_insns_nobb (rtx_insn *from, rtx_insn *to, rtx_insn *after) { #ifdef ENABLE_CHECKING - rtx x; + rtx_insn *x; for (x = from; x != to; x = NEXT_INSN (x)) gcc_assert (after != x); gcc_assert (after != to); @@ -5309,9 +5309,9 @@ start_sequence (void) start_sequence for more information about how to use this function. */ void -push_to_sequence (rtx first) +push_to_sequence (rtx_insn *first) { - rtx last; + rtx_insn *last; start_sequence (); @@ -5326,7 +5326,7 @@ push_to_sequence (rtx first) looping through the list. */ void -push_to_sequence2 (rtx first, rtx last) +push_to_sequence2 (rtx_insn *first, rtx_insn *last) { start_sequence (); diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index e2e64a213d3..9f5ebe856fc 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -86,10 +86,10 @@ get_insns (void) /* Specify a new insn as the first in the chain. */ static inline void -set_first_insn (rtx insn) +set_first_insn (rtx_insn *insn) { gcc_checking_assert (!insn || !PREV_INSN (insn)); - crtl->emit.x_first_insn = safe_as_a (insn); + crtl->emit.x_first_insn = insn; } /* Return the last insn emitted in current sequence or current function. */ @@ -103,10 +103,10 @@ get_last_insn (void) /* Specify a new insn as the last in the chain. */ static inline void -set_last_insn (rtx insn) +set_last_insn (rtx_insn *insn) { gcc_checking_assert (!insn || !NEXT_INSN (insn)); - crtl->emit.x_last_insn = safe_as_a (insn); + crtl->emit.x_last_insn = insn; } /* Return a number larger than any instruction's uid in this function. */ diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 6e6f04bf07d..9152ffeb3ef 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2567,8 +2567,8 @@ base_to_reg (struct address_info *ad) int code = -1; rtx new_inner = NULL_RTX; rtx new_reg = NULL_RTX; - rtx insn; - rtx last_insn = get_last_insn(); + rtx_insn *insn; + rtx_insn *last_insn = get_last_insn(); lra_assert (ad->base == ad->base_term && ad->disp == ad->disp_term); cl = base_reg_class (ad->mode, ad->as, ad->base_outer_code, @@ -2834,8 +2834,8 @@ process_address_1 (int nop, rtx_insn **before, rtx_insn **after) new_reg = lra_create_new_reg (Pmode, NULL_RTX, cl, "addr"); #ifdef HAVE_lo_sum { - rtx insn; - rtx last = get_last_insn (); + rtx_insn *insn; + rtx_insn *last = get_last_insn (); /* addr => lo_sum (new_base, addr), case (2) above. */ insn = emit_insn (gen_rtx_SET diff --git a/gcc/lra.c b/gcc/lra.c index b8b09689f19..f16705ef120 100644 --- a/gcc/lra.c +++ b/gcc/lra.c @@ -252,7 +252,8 @@ lra_delete_dead_insn (rtx_insn *insn) static rtx emit_add3_insn (rtx x, rtx y, rtx z) { - rtx insn, last; + rtx_insn *last; + rtx insn; last = get_last_insn (); @@ -309,7 +310,8 @@ void lra_emit_add (rtx x, rtx y, rtx z) { int old; - rtx insn, last; + rtx insn; + rtx_insn *last; rtx a1, a2, base, index, disp, scale, index_scale; bool ok_p; diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index fc211ffd2d1..3b62eafe157 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -319,7 +319,7 @@ ps_rtl_insn (partial_schedule_ptr ps, int id) in the loop that was associated with ps_rtl_insn (PS, ID). If the instruction had some notes before it, this is the first of those notes. */ -static rtx +static rtx_insn * ps_first_note (partial_schedule_ptr ps, int id) { gcc_assert (id < ps->g->num_nodes); diff --git a/gcc/optabs.c b/gcc/optabs.c index 08d5c6e43be..ef8941b00ee 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1412,7 +1412,7 @@ static rtx expand_binop_directly (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, rtx target, int unsignedp, enum optab_methods methods, - rtx last) + rtx_insn *last) { enum machine_mode from_mode = widened_mode (mode, op0, op1); enum insn_code icode = find_widening_optab_handler (binoptab, mode, diff --git a/gcc/rtl.h b/gcc/rtl.h index 588fe3b0109..12b9147ed75 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2362,8 +2362,8 @@ extern rtx_insn *get_last_insn_anywhere (void); extern rtx get_first_nonnote_insn (void); extern rtx get_last_nonnote_insn (void); extern void start_sequence (void); -extern void push_to_sequence (rtx); -extern void push_to_sequence2 (rtx, rtx); +extern void push_to_sequence (rtx_insn *); +extern void push_to_sequence2 (rtx_insn *, rtx_insn *); extern void end_sequence (void); #if TARGET_SUPPORTS_WIDE_INT == 0 extern double_int rtx_to_double_int (const_rtx); @@ -3094,13 +3094,13 @@ extern int max_reg_num (void); extern int max_label_num (void); extern int get_first_label_num (void); extern void maybe_set_first_label_num (rtx); -extern void delete_insns_since (rtx); +extern void delete_insns_since (rtx_insn *); extern void mark_reg_pointer (rtx, int); extern void mark_user_reg (rtx); extern void reset_used_flags (rtx); extern void set_used_flags (rtx); extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *); -extern void reorder_insns_nobb (rtx, rtx, rtx); +extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *); extern int get_max_insn_count (void); extern int in_sequence_p (void); extern void init_emit (void); @@ -3109,7 +3109,7 @@ extern void init_derived_machine_modes (void); extern void init_emit_once (void); extern void push_topmost_sequence (void); extern void pop_topmost_sequence (void); -extern void set_new_first_and_last_insn (rtx, rtx); +extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *); extern unsigned int unshare_all_rtl (void); extern void unshare_all_rtl_again (rtx_insn *); extern void unshare_all_rtl_in_chain (rtx); -- 2.30.2