summaryrefslogtreecommitdiff
path: root/gcc/reorg.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-05 15:15:43 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-05 15:15:43 +0000
commit93ee8dfb44262805ace7599c2fa60423810f0567 (patch)
tree8272e74f022e13f012f684eb2e0cf6341dc29782 /gcc/reorg.c
parentd77c5bc0de6cd05c6d86571605556d99fb7e2371 (diff)
downloadlinaro-gcc-93ee8dfb44262805ace7599c2fa60423810f0567.tar.gz
linaro-gcc-93ee8dfb44262805ace7599c2fa60423810f0567.tar.bz2
linaro-gcc-93ee8dfb44262805ace7599c2fa60423810f0567.zip
Use rtx_insn for various jump-handling functions and predicates
gcc/ChangeLog: 2014-09-05 David Malcolm <dmalcolm@redhat.com> * config/arc/arc.c (arc_print_operand): Use insn method of final_sequence for type-safety. * config/bfin/bfin.c (bfin_hardware_loop): Strengthen param "insn" from rtx to rtx_insn *. * config/frv/frv.c (frv_print_operand_jump_hint): Likewise. * config/mn10300/mn10300.c (mn10300_scan_for_setlb_lcc): Likewise for locals "branch", "label". * config/h8300/h8300.c (same_cmp_preceding_p): Likewise for locals "i1", "i2". Use NULL rather than NULL_RTX in comparisons. (same_cmp_following_p): Likewise for locals "i2", "i3". * config/sh/sh_optimize_sett_clrt.cc (sh_optimize_sett_clrt::sh_cbranch_ccreg_value): Likewise for param "cbranch_insn". * function.c (convert_jumps_to_returns): Likewis for local "jump". * ifcvt.c (cond_exec_get_condition): Likewise for param "jump". * jump.c (simplejump_p): Strengthen param "insn" from const_rtx to const rtx_insn *. (condjump_p): Likewise. (condjump_in_parallel_p): Likewise. (pc_set): Likewise. (any_uncondjump_p): Likewise. (any_condjump_p): Likewise. (condjump_label): Likewise. (returnjump_p): Strengthen param "insn" from rtx to const rtx_insn *. (onlyjump_p): Strengthen param "insn" from const_rtx to const rtx_insn *. (jump_to_label_p): Likewise. (invert_jump_1): Strengthen param "jump" from rtx to rtx_insn *. (invert_jump): Likewise. * reorg.c (simplejump_or_return_p): Add checked cast when calling simplejump_p. (get_jump_flags): Strengthen param "insn" from rtx to const rtx_insn *. (get_branch_condition): Likewise. (condition_dominates_p): Likewise. (make_return_insns): Move declaration of local "pat" earlier, to after we've handled NONJUMP_INSN_P and non-sequences, using its methods to simplify the code and for type-safety. * rtl.h (find_constant_src): Strengthen param from const_rtx to const rtx_insn *. (jump_to_label_p): Strengthen param from rtx to const rtx_insn *. (condjump_p): Strengthen param from const_rtx to const rtx_insn *. (any_condjump_p): Likewise. (any_uncondjump_p): Likewise. (pc_set): Likewise. (condjump_label): Likewise. (simplejump_p): Likewise. (returnjump_p): Likewise. (onlyjump_p): Likewise. (invert_jump_1): Strengthen param 1 from rtx to rtx_insn *. (invert_jump): Likewise. (condjump_in_parallel_p): Strengthen param from const_rtx to const rtx_insn *. * rtlanal.c (find_constant_src): Strengthen param from const_rtx to const rtx_insn *. * sel-sched-ir.c (fallthru_bb_of_jump): Strengthen param from rtx to const rtx_insn *. * sel-sched-ir.h (fallthru_bb_of_jump): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reorg.c')
-rw-r--r--gcc/reorg.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 7bacc6dc9a3..400a20fd01c 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -217,10 +217,10 @@ static void note_delay_statistics (int, int);
#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
static rtx_insn_list *optimize_skip (rtx_insn *);
#endif
-static int get_jump_flags (rtx, rtx);
+static int get_jump_flags (const rtx_insn *, rtx);
static int mostly_true_jump (rtx);
-static rtx get_branch_condition (rtx, rtx);
-static int condition_dominates_p (rtx, rtx);
+static rtx get_branch_condition (const rtx_insn *, rtx);
+static int condition_dominates_p (rtx, const rtx_insn *);
static int redirect_with_delay_slots_safe_p (rtx_insn *, rtx, rtx);
static int redirect_with_delay_list_safe_p (rtx_insn *, rtx, rtx_insn_list *);
static int check_annul_list_true_false (int, rtx);
@@ -272,7 +272,8 @@ static bool
simplejump_or_return_p (rtx insn)
{
return (JUMP_P (insn)
- && (simplejump_p (insn) || ANY_RETURN_P (PATTERN (insn))));
+ && (simplejump_p (as_a <rtx_insn *> (insn))
+ || ANY_RETURN_P (PATTERN (insn))));
}
/* Return TRUE if this insn should stop the search for insn to fill delay
@@ -845,7 +846,7 @@ optimize_skip (rtx_insn *insn)
are predicted as very likely taken. */
static int
-get_jump_flags (rtx insn, rtx label)
+get_jump_flags (const rtx_insn *insn, rtx label)
{
int flags;
@@ -907,7 +908,7 @@ mostly_true_jump (rtx jump_insn)
type of jump, or it doesn't go to TARGET, return 0. */
static rtx
-get_branch_condition (rtx insn, rtx target)
+get_branch_condition (const rtx_insn *insn, rtx target)
{
rtx pat = PATTERN (insn);
rtx src;
@@ -953,7 +954,7 @@ get_branch_condition (rtx insn, rtx target)
INSN, i.e., if INSN will always branch if CONDITION is true. */
static int
-condition_dominates_p (rtx condition, rtx insn)
+condition_dominates_p (rtx condition, const rtx_insn *insn)
{
rtx other_condition = get_branch_condition (insn, JUMP_LABEL (insn));
enum rtx_code code = GET_CODE (condition);
@@ -3579,18 +3580,23 @@ make_return_insns (rtx_insn *first)
/* Only look at filled JUMP_INSNs that go to the end of function
label. */
- if (!NONJUMP_INSN_P (insn)
- || GET_CODE (PATTERN (insn)) != SEQUENCE
- || !jump_to_label_p (XVECEXP (PATTERN (insn), 0, 0)))
+ if (!NONJUMP_INSN_P (insn))
continue;
- if (JUMP_LABEL (XVECEXP (PATTERN (insn), 0, 0)) == function_return_label)
+ if (GET_CODE (PATTERN (insn)) != SEQUENCE)
+ continue;
+
+ rtx_sequence *pat = as_a <rtx_sequence *> (PATTERN (insn));
+
+ if (!jump_to_label_p (pat->insn (0)))
+ continue;
+
+ if (JUMP_LABEL (pat->insn (0)) == function_return_label)
{
kind = ret_rtx;
real_label = real_return_label;
}
- else if (JUMP_LABEL (XVECEXP (PATTERN (insn), 0, 0))
- == function_simple_return_label)
+ else if (JUMP_LABEL (pat->insn (0)) == function_simple_return_label)
{
kind = simple_return_rtx;
real_label = real_simple_return_label;
@@ -3598,7 +3604,6 @@ make_return_insns (rtx_insn *first)
else
continue;
- rtx_sequence *pat = as_a <rtx_sequence *> (PATTERN (insn));
jump_insn = pat->insn (0);
/* If we can't make the jump into a RETURN, try to redirect it to the best