predict.*: Use rtx_insn (also touches function.c and config/cris/cris.c)
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 22 Aug 2014 19:51:23 +0000 (19:51 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 22 Aug 2014 19:51:23 +0000 (19:51 +0000)
gcc/
* predict.h (predict_insn_def): Strengthen param "insn" from rtx
to rtx_insn *.

* function.c (stack_protect_epilogue): Add checked cast to
rtx_insn for now when invoking predict_insn_def.

* predict.c (predict_insn): Strengthen param "insn" from rtx to
rtx_insn *.
(predict_insn_def): Likewise.
(rtl_predict_edge): Likewise for local "last_insn".
(can_predict_insn_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(combine_predictions_for_insn): Strengthen param "insn" from rtx
to rtx_insn *.
(bb_estimate_probability_locally): Likewise for local "last_insn".
(expensive_function_p): Likewise for local "insn".

* config/cris/cris.c (cris_emit_trap_for_misalignment): Likewise for
local "jmp", since this is used when invoking predict_insn_def.

From-SVN: r214361

gcc/ChangeLog
gcc/config/cris/cris.c
gcc/function.c
gcc/predict.c
gcc/predict.h

index caa40b3..ef34753 100644 (file)
@@ -1,3 +1,25 @@
+2014-08-22  David Malcolm  <dmalcolm@redhat.com>
+
+       * predict.h (predict_insn_def): Strengthen param "insn" from rtx
+       to rtx_insn *.
+
+       * function.c (stack_protect_epilogue): Add checked cast to
+       rtx_insn for now when invoking predict_insn_def.
+
+       * predict.c (predict_insn): Strengthen param "insn" from rtx to
+       rtx_insn *.
+       (predict_insn_def): Likewise.
+       (rtl_predict_edge): Likewise for local "last_insn".
+       (can_predict_insn_p): Strengthen param "insn" from const_rtx to
+       const rtx_insn *.
+       (combine_predictions_for_insn): Strengthen param "insn" from rtx
+       to rtx_insn *.
+       (bb_estimate_probability_locally): Likewise for local "last_insn".
+       (expensive_function_p): Likewise for local "insn".
+
+       * config/cris/cris.c (cris_emit_trap_for_misalignment): Likewise for
+       local "jmp", since this is used when invoking predict_insn_def.
+
 2014-08-22  Marek Polacek  <polacek@redhat.com>
 
        PR c++/62199
index 4a2e387..787c3fc 100644 (file)
@@ -2034,7 +2034,8 @@ cris_simple_epilogue (void)
 void
 cris_emit_trap_for_misalignment (rtx mem)
 {
-  rtx addr, reg, ok_label, andop, jmp;
+  rtx addr, reg, ok_label, andop;
+  rtx_insn *jmp;
   int natural_alignment;
   gcc_assert (MEM_P (mem));
 
index 6a85b56..4e43471 100644 (file)
@@ -4691,7 +4691,7 @@ stack_protect_epilogue (void)
      except adding the prediction by hand.  */
   tmp = get_last_insn ();
   if (JUMP_P (tmp))
-    predict_insn_def (tmp, PRED_NORETURN, TAKEN);
+    predict_insn_def (as_a <rtx_insn *> (tmp), PRED_NORETURN, TAKEN);
 
   expand_call (targetm.stack_protect_fail (), NULL_RTX, /*ignore=*/true);
   free_temp_slots ();
index f7b86f1..0fdf9f5 100644 (file)
@@ -74,11 +74,11 @@ along with GCC; see the file COPYING3.  If not see
 static sreal real_zero, real_one, real_almost_one, real_br_prob_base,
             real_inv_br_prob_base, real_one_half, real_bb_freq_max;
 
-static void combine_predictions_for_insn (rtx, basic_block);
+static void combine_predictions_for_insn (rtx_insn *, basic_block);
 static void dump_prediction (FILE *, enum br_predictor, int, basic_block, int);
 static void predict_paths_leading_to (basic_block, enum br_predictor, enum prediction);
 static void predict_paths_leading_to_edge (edge, enum br_predictor, enum prediction);
-static bool can_predict_insn_p (const_rtx);
+static bool can_predict_insn_p (const rtx_insn *);
 
 /* Information we hold about each branch predictor.
    Filled using information from predict.def.  */
@@ -563,7 +563,7 @@ br_prob_note_reliable_p (const_rtx note)
 }
 
 static void
-predict_insn (rtx insn, enum br_predictor predictor, int probability)
+predict_insn (rtx_insn *insn, enum br_predictor predictor, int probability)
 {
   gcc_assert (any_condjump_p (insn));
   if (!flag_guess_branch_prob)
@@ -578,7 +578,7 @@ predict_insn (rtx insn, enum br_predictor predictor, int probability)
 /* Predict insn by given predictor.  */
 
 void
-predict_insn_def (rtx insn, enum br_predictor predictor,
+predict_insn_def (rtx_insn *insn, enum br_predictor predictor,
                  enum prediction taken)
 {
    int probability = predictor_info[(int) predictor].hitrate;
@@ -594,7 +594,7 @@ predict_insn_def (rtx insn, enum br_predictor predictor,
 void
 rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
 {
-  rtx last_insn;
+  rtx_insn *last_insn;
   last_insn = BB_END (e->src);
 
   /* We can store the branch prediction information only about
@@ -681,7 +681,7 @@ clear_bb_predictions (basic_block bb)
    At the moment we represent predictions only on conditional
    jumps, not at computed jump or other complicated cases.  */
 static bool
-can_predict_insn_p (const_rtx insn)
+can_predict_insn_p (const rtx_insn *insn)
 {
   return (JUMP_P (insn)
          && any_condjump_p (insn)
@@ -774,7 +774,7 @@ set_even_probabilities (basic_block bb)
    note if not already present.  Remove now useless REG_BR_PRED notes.  */
 
 static void
-combine_predictions_for_insn (rtx insn, basic_block bb)
+combine_predictions_for_insn (rtx_insn *insn, basic_block bb)
 {
   rtx prob_note;
   rtx *pnote;
@@ -1668,7 +1668,7 @@ predict_loops (void)
 static void
 bb_estimate_probability_locally (basic_block bb)
 {
-  rtx last_insn = BB_END (bb);
+  rtx_insn *last_insn = BB_END (bb);
   rtx cond;
 
   if (! can_predict_insn_p (last_insn))
@@ -2890,7 +2890,7 @@ expensive_function_p (int threshold)
   limit = ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency * threshold;
   FOR_EACH_BB_FN (bb, cfun)
     {
-      rtx insn;
+      rtx_insn *insn;
 
       FOR_BB_INSNS (bb, insn)
        if (active_insn_p (insn))
index 1555f80..c75b6b6 100644 (file)
@@ -45,7 +45,7 @@ enum prediction
    TAKEN
 };
 
-extern void predict_insn_def (rtx, enum br_predictor, enum prediction);
+extern void predict_insn_def (rtx_insn *, enum br_predictor, enum prediction);
 extern int counts_to_freqs (void);
 extern void handle_missing_profiles (void);
 extern void estimate_bb_frequencies (bool);