]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
INSN_LOCATION takes an rtx_insn
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2014 15:20:07 +0000 (15:20 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2014 15:20:07 +0000 (15:20 +0000)
gcc/ChangeLog:
2014-09-09  David Malcolm  <dmalcolm@redhat.com>

* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215084 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/dwarf2out.c
gcc/emit-rtl.c
gcc/emit-rtl.h
gcc/print-rtl.c
gcc/recog.c
gcc/reorg.c
gcc/rtl.h

index 97d0fbc725131c27f025af4ac5a4f5eca61efff6..79c9df7abdb4e523a2598bfa7de3081834ba5a3b 100644 (file)
@@ -1,3 +1,39 @@
+2014-09-09  David Malcolm  <dmalcolm@redhat.com>
+
+       * 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  <dmalcolm@redhat.com>
 
        * combine.c (try_combine): Eliminate checked cast on result of
index f9713c17914a93e58b35127b6a23ee9ac2cd990c..c8d48c45f18eecd421abfc744bfb189ab8dd7840 100644 (file)
@@ -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 ();
index b3a1a0a2b091ce7f083cf7822b1aff272e4e80f1..cf58f46632a3e7c974407fc8149cd08639d1dc16 100644 (file)
@@ -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
index fd9198664402bf45492309189391333c4d20ca02..3ed8107dcec94da523782b447333a2572af14543 100644 (file)
@@ -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];
index 23a80d831cbea38bb9d5d134e77936a0863ede93..0d5896cc5630ab3ca853549ceb9fb4bdd3fca752 100644 (file)
@@ -21435,7 +21435,8 @@ dwarf2out_var_location (rtx_insn *loc_note)
     {
       struct call_arg_loc_node *ca_loc
        = ggc_cleared_alloc<call_arg_loc_node> ();
-      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 <rtx_sequence *> (PATTERN (prev))->insn (0);
       ca_loc->tail_call_p = SIBLING_CALL_P (prev);
       x = get_call_rtx_from (PATTERN (prev));
       if (x)
index 0acdd08bda49885b1e634c7652be510a40976fb9..34bf2717be23a0cac3cc85171f6513fee69f50d1 100644 (file)
@@ -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));
 }
index d0b1bcec31ca832d6bb9027dc71a8b98c0d6c022..7cba8662d5869210a5f01db726a722be547aa340 100644 (file)
@@ -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);
index 935145b5bd65c4fcec07fe76096bdf1bc7b0c455..80ec96e9c0d9e6d8f59dc252f6abd6f8934afec1 100644 (file)
@@ -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 <const rtx_insn *> (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 <const rtx_insn *> (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
index d07a57a7d25dcb4c97a643578ec387945cd340e1..6ccd84e513c3e5dcd3e60c1b09d0de7a8f1db4d9 100644 (file)
@@ -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 <rtx_insn *> (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);
 
index 400a20fd01cc2ec7ae098f7398bb2fc36824dddb..18820f01ba71f2c43d18929893616362787992ac 100644 (file)
@@ -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;
        }
index fae3b5d53840fb56623987ddd3d34d6d0a6c71e2..0f36c48bc15d7e7c18b1a612a5628ea03194087f 100644 (file)
--- 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 <rtx_insn *> (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 */