From: David Malcolm Date: Tue, 9 Sep 2014 15:20:07 +0000 (+0000) Subject: INSN_LOCATION takes an rtx_insn X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1950df341b382e455df8f1e58fe29242cc55c08;p=gcc.git INSN_LOCATION takes an rtx_insn gcc/ChangeLog: 2014-09-09 David Malcolm * rtl.h (INSN_LOCATION): Strengthen param from const_rtx to const rtx_insn *, and from rtx to rtx_insn * for the other overloaded variant. (RTL_LOCATION): Add a checked cast to rtx_insn * when invoking INSN_LOCATION, since we know INSN_P holds. (insn_line): Strengthen param from const_rtx to const rtx_insn *. (insn_file): Likewise. (insn_scope): Likewise. (insn_location): Likewise. * config/mips/mips.c (mips16_gp_pseudo_reg): Strengthen local "insn" from rtx to rtx_insn *, introducing a new local rtx "set" for the result of gen_load_const_gp. * config/rs6000/rs6000-protos.h (output_call): Strengthen first param from rtx to rtx_insn *. * config/rs6000/rs6000.c (output_call): Likewise. * dwarf2out.c (dwarf2out_var_location): Likewise for local "prev", introducing a checked cast to rtx_sequence * and use of the insn method. * emit-rtl.c (emit_copy_of_insn_after): Strengthen both params from rtx to rtx_insn *. (insn_scope): Strengthen param from const_rtx to const rtx_insn *. (insn_line): Likewise. (insn_file): Likewise. (insn_location): Likewise. * emit-rtl.h (emit_copy_of_insn_after): Strengthen both params from rtx to rtx_insn *. * print-rtl.c (print_rtx): Introduce local "in_insn" via a checked cast, using it for calls to INSN_HAS_LOCATION and insn_location. * recog.c (peep2_attempt): Introduce local rtx_insn * "peepinsn" via a checked cast. * reorg.c (relax_delay_slots): Strengthen locals named "after" from rtx to rtx_insn *; use methods of "pat" for type-safety. From-SVN: r215084 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 97d0fbc7251..79c9df7abdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,39 @@ +2014-09-09 David Malcolm + + * rtl.h (INSN_LOCATION): Strengthen param from const_rtx to + const rtx_insn *, and from rtx to rtx_insn * for the other + overloaded variant. + (RTL_LOCATION): Add a checked cast to rtx_insn * when invoking + INSN_LOCATION, since we know INSN_P holds. + (insn_line): Strengthen param from const_rtx to const rtx_insn *. + (insn_file): Likewise. + (insn_scope): Likewise. + (insn_location): Likewise. + + * config/mips/mips.c (mips16_gp_pseudo_reg): Strengthen local + "insn" from rtx to rtx_insn *, introducing a new local rtx "set" + for the result of gen_load_const_gp. + * config/rs6000/rs6000-protos.h (output_call): Strengthen first + param from rtx to rtx_insn *. + * config/rs6000/rs6000.c (output_call): Likewise. + * dwarf2out.c (dwarf2out_var_location): Likewise for local "prev", + introducing a checked cast to rtx_sequence * and use of the insn + method. + * emit-rtl.c (emit_copy_of_insn_after): Strengthen both params + from rtx to rtx_insn *. + (insn_scope): Strengthen param from const_rtx to const rtx_insn *. + (insn_line): Likewise. + (insn_file): Likewise. + (insn_location): Likewise. + * emit-rtl.h (emit_copy_of_insn_after): Strengthen both params + from rtx to rtx_insn *. + * print-rtl.c (print_rtx): Introduce local "in_insn" via a checked + cast, using it for calls to INSN_HAS_LOCATION and insn_location. + * recog.c (peep2_attempt): Introduce local rtx_insn * "peepinsn" + via a checked cast. + * reorg.c (relax_delay_slots): Strengthen locals named "after" + from rtx to rtx_insn *; use methods of "pat" for type-safety. + 2014-09-09 David Malcolm * combine.c (try_combine): Eliminate checked cast on result of diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index f9713c17914..c8d48c45f18 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -2932,7 +2932,6 @@ mips16_gp_pseudo_reg (void) { if (cfun->machine->mips16_gp_pseudo_rtx == NULL_RTX) { - rtx insn; rtx_insn *scan; cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode); @@ -2943,8 +2942,8 @@ mips16_gp_pseudo_reg (void) while (NEXT_INSN (scan) && !INSN_P (NEXT_INSN (scan))) scan = NEXT_INSN (scan); - insn = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx); - insn = emit_insn_after (insn, scan); + rtx set = gen_load_const_gp (cfun->machine->mips16_gp_pseudo_rtx); + rtx_insn *insn = emit_insn_after (set, scan); INSN_LOCATION (insn) = 0; pop_topmost_sequence (); diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index b3a1a0a2b09..cf58f46632a 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -211,7 +211,7 @@ extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT); #if TARGET_MACHO -char *output_call (rtx, rtx *, int, int); +char *output_call (rtx_insn *, rtx *, int, int); #endif #ifdef NO_DOLLAR_IN_LABEL diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fd919866440..3ed8107dcec 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -28929,7 +28929,7 @@ get_prev_label (tree function_name) CALL_DEST is the routine we are calling. */ char * -output_call (rtx insn, rtx *operands, int dest_operand_number, +output_call (rtx_insn *insn, rtx *operands, int dest_operand_number, int cookie_operand_number) { static char buf[256]; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 23a80d831cb..0d5896cc563 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21435,7 +21435,8 @@ dwarf2out_var_location (rtx_insn *loc_note) { struct call_arg_loc_node *ca_loc = ggc_cleared_alloc (); - rtx prev = prev_real_insn (loc_note), x; + rtx_insn *prev = prev_real_insn (loc_note); + rtx x; ca_loc->call_arg_loc_note = loc_note; ca_loc->next = NULL; ca_loc->label = last_label; @@ -21445,7 +21446,7 @@ dwarf2out_var_location (rtx_insn *loc_note) && GET_CODE (PATTERN (prev)) == SEQUENCE && CALL_P (XVECEXP (PATTERN (prev), 0, 0))))); if (!CALL_P (prev)) - prev = XVECEXP (PATTERN (prev), 0, 0); + prev = as_a (PATTERN (prev))->insn (0); ca_loc->tail_call_p = SIBLING_CALL_P (prev); x = get_call_rtx_from (PATTERN (prev)); if (x) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 0acdd08bda4..34bf2717be2 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -6144,7 +6144,7 @@ init_emit_once (void) Care updating of libcall regions if present. */ rtx_insn * -emit_copy_of_insn_after (rtx insn, rtx after) +emit_copy_of_insn_after (rtx_insn *insn, rtx_insn *after) { rtx_insn *new_rtx; rtx link; @@ -6258,28 +6258,28 @@ curr_insn_location (void) /* Return lexical scope block insn belongs to. */ tree -insn_scope (const_rtx insn) +insn_scope (const rtx_insn *insn) { return LOCATION_BLOCK (INSN_LOCATION (insn)); } /* Return line number of the statement that produced this insn. */ int -insn_line (const_rtx insn) +insn_line (const rtx_insn *insn) { return LOCATION_LINE (INSN_LOCATION (insn)); } /* Return source file of the statement that produced this insn. */ const char * -insn_file (const_rtx insn) +insn_file (const rtx_insn *insn) { return LOCATION_FILE (INSN_LOCATION (insn)); } /* Return expanded location of the statement that produced this insn. */ expanded_location -insn_location (const_rtx insn) +insn_location (const rtx_insn *insn) { return expand_location (INSN_LOCATION (insn)); } diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index d0b1bcec31c..7cba8662d58 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -66,7 +66,7 @@ extern rtx copy_insn_1 (rtx); extern rtx copy_insn (rtx); extern rtx_insn *copy_delay_slot_insn (rtx_insn *); extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode); -extern rtx_insn *emit_copy_of_insn_after (rtx, rtx); +extern rtx_insn *emit_copy_of_insn_after (rtx_insn *, rtx_insn *); extern void set_reg_attrs_from_value (rtx, rtx); extern void set_reg_attrs_for_parm (rtx, rtx); extern void set_reg_attrs_for_decl_rtl (tree t, rtx x); diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 935145b5bd6..80ec96e9c0d 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -392,12 +392,14 @@ print_rtx (const_rtx in_rtx) if (i == 4 && INSN_P (in_rtx)) { #ifndef GENERATOR_FILE + const rtx_insn *in_insn = as_a (in_rtx); + /* Pretty-print insn locations. Ignore scoping as it is mostly redundant with line number information and do not print anything when there is no location information available. */ - if (INSN_HAS_LOCATION (as_a (in_rtx))) + if (INSN_HAS_LOCATION (in_insn)) { - expanded_location xloc = insn_location (in_rtx); + expanded_location xloc = insn_location (in_insn); fprintf (outfile, " %s:%i", xloc.file, xloc.line); } #endif diff --git a/gcc/recog.c b/gcc/recog.c index d07a57a7d25..6ccd84e513c 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3323,9 +3323,10 @@ peep2_attempt (basic_block bb, rtx uncast_insn, int match_len, rtx_insn *attempt eh_note = find_reg_note (peep2_insn_data[i].insn, REG_EH_REGION, NULL_RTX); /* Replace the old sequence with the new. */ + rtx_insn *peepinsn = as_a (peep2_insn_data[i].insn); last = emit_insn_after_setloc (attempt, peep2_insn_data[i].insn, - INSN_LOCATION (peep2_insn_data[i].insn)); + INSN_LOCATION (peepinsn)); before_try = PREV_INSN (insn); delete_insn_chain (insn, peep2_insn_data[i].insn, false); diff --git a/gcc/reorg.c b/gcc/reorg.c index 400a20fd01c..18820f01ba7 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -3297,7 +3297,7 @@ relax_delay_slots (rtx_insn *first) && JUMP_P (next) && PATTERN (next) == PATTERN (delay_insn)) { - rtx after; + rtx_insn *after; int i; /* Delete the RETURN and just execute the delay list insns. @@ -3321,8 +3321,8 @@ relax_delay_slots (rtx_insn *first) gcc_assert (GET_CODE (pat) == SEQUENCE); add_insn_after (delay_insn, trial, NULL); after = delay_insn; - for (i = 1; i < XVECLEN (pat, 0); i++) - after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after); + for (i = 1; i < pat->len (); i++) + after = emit_copy_of_insn_after (pat->insn (i), after); delete_scheduled_jump (delay_insn); continue; } @@ -3424,7 +3424,7 @@ relax_delay_slots (rtx_insn *first) #endif ) { - rtx after; + rtx_insn *after; int i; /* All this insn does is execute its delay list and jump to the @@ -3450,8 +3450,8 @@ relax_delay_slots (rtx_insn *first) gcc_assert (GET_CODE (pat) == SEQUENCE); add_insn_after (delay_insn, trial, NULL); after = delay_insn; - for (i = 1; i < XVECLEN (pat, 0); i++) - after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after); + for (i = 1; i < pat->len (); i++) + after = emit_copy_of_insn_after (pat->insn (i), after); delete_scheduled_jump (delay_insn); continue; } diff --git a/gcc/rtl.h b/gcc/rtl.h index fae3b5d5384..0f36c48bc15 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1369,12 +1369,12 @@ inline rtx& PATTERN (rtx insn) return XEXP (insn, 3); } -inline unsigned int INSN_LOCATION (const_rtx insn) +inline unsigned int INSN_LOCATION (const rtx_insn *insn) { return XUINT (insn, 4); } -inline unsigned int& INSN_LOCATION (rtx insn) +inline unsigned int& INSN_LOCATION (rtx_insn *insn) { return XUINT (insn, 4); } @@ -1386,7 +1386,8 @@ inline bool INSN_HAS_LOCATION (const rtx_insn *insn) /* LOCATION of an RTX if relevant. */ #define RTL_LOCATION(X) (INSN_P (X) ? \ - INSN_LOCATION (X) : UNKNOWN_LOCATION) + INSN_LOCATION (as_a (X)) \ + : UNKNOWN_LOCATION) /* Code number of instruction, from when it was recognized. -1 means this instruction has not been recognized yet. */ @@ -2644,10 +2645,10 @@ extern rtx_insn *next_cc0_user (rtx); extern rtx_insn *prev_cc0_setter (rtx); /* In emit-rtl.c */ -extern int insn_line (const_rtx); -extern const char * insn_file (const_rtx); -extern tree insn_scope (const_rtx); -extern expanded_location insn_location (const_rtx); +extern int insn_line (const rtx_insn *); +extern const char * insn_file (const rtx_insn *); +extern tree insn_scope (const rtx_insn *); +extern expanded_location insn_location (const rtx_insn *); extern location_t prologue_location, epilogue_location; /* In jump.c */