aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.h
diff options
context:
space:
mode:
authorMikhail Maltsev <maltsevm@gmail.com>2015-05-20 19:39:42 +0000
committerMikhail Maltsev <miyuki@gcc.gnu.org>2015-05-20 19:39:42 +0000
commit1476d1bd020588ee81d1384354cf533c88849a3a (patch)
tree710f2e790c32c989e13feab254c623d98b5f103d /gcc/rtl.h
parentfd2ef1171407340dbb09935ab535debf40f56376 (diff)
downloadgcc-1476d1bd020588ee81d1384354cf533c88849a3a.zip
gcc-1476d1bd020588ee81d1384354cf533c88849a3a.tar.gz
gcc-1476d1bd020588ee81d1384354cf533c88849a3a.tar.bz2
Promote types of RTL expressions to more derived ones.
* bb-reorder.c (set_edge_can_fallthru_flag): Use rtx_jump_insn where feasible. (fix_up_fall_thru_edges): Likewise. (fix_crossing_conditional_branches): Likewise. Promote jump targets from to rtx_insn to rtx_code_label where feasible. * bt-load.c (move_btr_def): Remove as-a cast of the value returned by gen_move_insn (returned type changed to rtx_insn). * builtins.c (expand_errno_check): Fix arguments of do_compare_rtx_and_jump (now expects rtx_code_label). (expand_builtin_acc_on_device): Likewise. * cfgcleanup.c (try_simplify_condjump): Add cast when calling invert_jump (now exprects rtx_jump_insn). * cfgexpand.c (label_rtx_for_bb): Promote return type to rtx_code_label. (construct_init_block): Use rtx_code_label. * cfgrtl.c (block_label): Promote return type to rtx_code_label. (try_redirect_by_replacing_jump): Use cast to rtx_jump_insn when calling redirect_jump. (patch_jump_insn): Likewise. (redirect_branch_edge): Likewise. (force_nonfallthru_and_redirect): Likewise. (fixup_reorder_chain): Explicitly use rtx_jump_insn instead of rtx_insn when suitable. (rtl_lv_add_condition_to_bb): Update call of do_compare_rtx_and_jump. * cfgrtl.h: Promote return type of block_label to rtx_code_label. * config/bfin/bfin.c (hwloop_optimize): Fix call of emit_label_before. * config/i386/i386.c (ix86_emit_cmove): Explicitly use rtx_code_label to store the value retured by gen_label_rtx. * config/mips/mips.c (mips16_split_long_branches): Promote rtx_insn to rtx_jump_insn. * config/sh/sh.c (gen_far_branch): Likewise. Fix call of invert_jump. (split_branches): Fix calls of redirect_jump. * dojump.c (jumpifnot): Promote argument type from rtx to rtx_code_label. (jumpifnot_1): Likewise. (jumpif): Likewise. (jumpif_1): Likewise. (do_jump_1): Likewise. (do_jump): Likewise. Use rtx_code_label when feasible. (do_jump_by_parts_greater_rtx): Likewise. (do_jump_by_parts_zero_rtx): Likewise. (do_jump_by_parts_equality_rtx): Likewise. (do_compare_rtx_and_jump): Likewise. * dojump.h: Update function prototypes. * dse.c (emit_inc_dec_insn_before): Remove case (gen_move_insn now returns rtx_insn). * emit-rtl.c (emit_jump_insn_before_noloc): Promote return type to rtx_jump_insn. (emit_label_before): Likewise. (emit_jump_insn_after_noloc): Likewise. (emit_jump_insn_after_setloc): Likewise. (emit_jump_insn_after): Likewise (emit_jump_insn_before_setloc): Likewise. (emit_jump_insn_before): Likewise. (emit_label_before): Promote return type to rtx_code_label. (emit_label): Likewise. * except.c (sjlj_emit_dispatch_table): Use jump_target_rtx. * explow.c (emit_stack_save): Use gen_move_insn_uncast instead of gen_move_insn. (emit_stack_restore): Likewise. * expmed.c (emit_store_flag_force): Fix calls of do_compare_rtx_and_jump. (do_cmp_and_jump): Likewise. * expr.c (expand_expr_real_2): Likewise. Promote some local variables from rtx to rtx_code_label. (gen_move_insn_uncast): New function. * expr.h: Update return type of gen_move_insn (promote to rtx_insn). * function.c (convert_jumps_to_returns): Fix call of redirect_jump. * gcse.c (pre_insert_copy_insn): Use rtx_insn instead of rtx. * ifcvt.c (dead_or_predicable): Use rtx_jump_insn when calling invert_jump_1 and redirect_jump_1. * internal-fn.c (expand_arith_overflow_result_store): Fix call of do_compare_rtx_and_jump. (expand_addsub_overflow): Likewise. (expand_neg_overflow): Likewise. (expand_mul_overflow): Likewise. * ira.c (split_live_ranges_for_shrink_wrap): Use rtx_insn for return value of gen_move_insn. * jump.c (redirect_jump): Promote argument from rtx to rtx_jump_insn. * loop-doloop.c (add_test): Use rtx_code_label. (doloop_modify): Likewise. (doloop_optimize): Likewise. * loop-unroll.c (compare_and_jump_seq): Promote rtx to rtx_code_label. * lra-constraints.c (emit_spill_move): Remove cast of value returned by gen_move_insn. (inherit_reload_reg): Add cast when calling dump_insn_slim. (split_reg): Likewise. * modulo-sched.c (schedule_reg_moves): Remove cast of value returned by gen_move_insn. * optabs.c (expand_binop_directly): Remove casts of values returned by maybe_gen_insn. (expand_unop_direct): Likewise. (expand_abs): Likewise. (maybe_emit_unop_insn): Likewise. (maybe_gen_insn): Promote return type to rtx_insn. * optabs.h: Update prototype of maybe_gen_insn. * postreload-gcse.c (eliminate_partially_redundant_load): Remove redundant cast. * recog.c (struct peep2_insn_data): Promote type of insn field to rtx_insn. (peep2_reinit_state): Use NULL instead of NULL_RTX. (peep2_attempt): Remove casts of insn in peep2_insn_data. (peep2_fill_buffer): Promote argument from rtx to rtx_insn * recog.h (struct insn_gen_fn): Promote return types of function pointers and operator ().from rtx to rtx_insn. * reorg.c (fill_simple_delay_slots): Promote rtx_insn to rtx_jump_insn. (fill_eager_delay_slots): Likewise. (relax_delay_slots): Likewise. (make_return_insns): Likewise. (dbr_schedule): Likewise. (optimize_skips): Likewise. (reorg_redirect_jump): Likewise. (fill_slots_from_thread): Likewise. * reorg.h: Update prototypes. * resource.c (find_dead_or_set_registers): Use dyn_cast to rtx_jump_insn instead of check. Use it's jump_target method. * rtl.h (rtx_jump_insn::jump_label): Define new method. (rtx_jump_insn::jump_target): Define new method. (rtx_jump_insn::set_jump_target): Define new method. * rtlanal.c (tablejump_p): Promote type of one local variable. * sched-deps.c (sched_analyze_2): Promote rtx to rtx_insn_list. (sched_analyze_insn): Likewise. * sched-vis.c (print_insn_with_notes): Promote rtx to rtx_insn. (print_insn): Likewise. * stmt.c (label_rtx): Promote return type to rtx_insn. (force_label_rtx): Likewise. (jump_target_rtx): Define new function. (expand_label): Use it, get rid of one cast. (expand_naked_return): Promote rtx to rtx_code_label. (do_jump_if_equal): Fix do_compare_rtx_and_jump call. (expand_case): Use rtx_code_label instread of rtx where feasible. (expand_sjlj_dispatch_table): Likewise. (emit_case_nodes): Likewise. * stmt.h: Declare jump_target_rtx. Update prototypes. Fix comments. * store-motion.c (insert_store): Make use of new return type of gen_move_insn and remove a cast. (replace_store_insn): Likewise. From-SVN: r223454
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r--gcc/rtl.h68
1 files changed, 55 insertions, 13 deletions
diff --git a/gcc/rtl.h b/gcc/rtl.h
index fb7b641..f9e1b27 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -559,6 +559,7 @@ class GTY(()) rtx_nonjump_insn : public rtx_insn
class GTY(()) rtx_jump_insn : public rtx_insn
{
+public:
/* No extra fields, but adds the invariant:
JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN)
i.e. an instruction that can possibly jump.
@@ -566,6 +567,21 @@ class GTY(()) rtx_jump_insn : public rtx_insn
This is an instance of:
DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeiie0", RTX_INSN)
from rtl.def. */
+
+ /* Returns jump target of this instruction. The returned value is not
+ necessarily a code label: it may also be a RETURN or SIMPLE_RETURN
+ expression. Also, when the code label is marked "deleted", it is
+ replaced by a NOTE. In some cases the value is NULL_RTX. */
+
+ inline rtx jump_label () const;
+
+ /* Returns jump target cast to rtx_code_label *. */
+
+ inline rtx_code_label *jump_target () const;
+
+ /* Set jump target. */
+
+ inline void set_jump_target (rtx_code_label *);
};
class GTY(()) rtx_call_insn : public rtx_insn
@@ -856,6 +872,14 @@ is_a_helper <rtx_jump_insn *>::test (rtx rt)
template <>
template <>
inline bool
+is_a_helper <rtx_jump_insn *>::test (rtx_insn *insn)
+{
+ return JUMP_P (insn);
+}
+
+template <>
+template <>
+inline bool
is_a_helper <rtx_call_insn *>::test (rtx rt)
{
return CALL_P (rt);
@@ -1701,6 +1725,23 @@ inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn)
return safe_as_a <rtx_insn *> (JUMP_LABEL (insn));
}
+/* Methods of rtx_jump_insn. */
+
+inline rtx rtx_jump_insn::jump_label () const
+{
+ return JUMP_LABEL (this);
+}
+
+inline rtx_code_label *rtx_jump_insn::jump_target () const
+{
+ return safe_as_a <rtx_code_label *> (JUMP_LABEL (this));
+}
+
+inline void rtx_jump_insn::set_jump_target (rtx_code_label *target)
+{
+ JUMP_LABEL (this) = target;
+}
+
/* Once basic blocks are found, each CODE_LABEL starts a chain that
goes through all the LABEL_REFs that jump to that label. The chain
eventually winds up at the CODE_LABEL: it is circular. */
@@ -2699,9 +2740,9 @@ extern void decide_function_section (tree);
extern rtx_insn *emit_insn_before (rtx, rtx);
extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block);
extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, int);
-extern rtx_insn *emit_jump_insn_before (rtx, rtx);
-extern rtx_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
-extern rtx_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *, int);
+extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx);
+extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *);
+extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *, int);
extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *);
extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *);
extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, int);
@@ -2709,14 +2750,14 @@ extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *);
extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx);
extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int);
extern rtx_barrier *emit_barrier_before (rtx);
-extern rtx_insn *emit_label_before (rtx, rtx_insn *);
+extern rtx_code_label *emit_label_before (rtx, rtx_insn *);
extern rtx_note *emit_note_before (enum insn_note, rtx_insn *);
extern rtx_insn *emit_insn_after (rtx, rtx);
extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block);
extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int);
-extern rtx_insn *emit_jump_insn_after (rtx, rtx);
-extern rtx_insn *emit_jump_insn_after_noloc (rtx, rtx);
-extern rtx_insn *emit_jump_insn_after_setloc (rtx, rtx, int);
+extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx);
+extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx);
+extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx, int);
extern rtx_insn *emit_call_insn_after (rtx, rtx);
extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx);
extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx, int);
@@ -2730,7 +2771,7 @@ extern rtx_insn *emit_insn (rtx);
extern rtx_insn *emit_debug_insn (rtx);
extern rtx_insn *emit_jump_insn (rtx);
extern rtx_insn *emit_call_insn (rtx);
-extern rtx_insn *emit_label (rtx);
+extern rtx_code_label *emit_label (rtx);
extern rtx_jump_table_data *emit_jump_table_data (rtx);
extern rtx_barrier *emit_barrier (void);
extern rtx_note *emit_note (enum insn_note);
@@ -3066,6 +3107,7 @@ extern GTY(()) rtx pc_rtx;
extern GTY(()) rtx cc0_rtx;
extern GTY(()) rtx ret_rtx;
extern GTY(()) rtx simple_return_rtx;
+extern GTY(()) rtx_insn *invalid_insn_rtx;
/* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg
is used to represent the frame pointer. This is because the
@@ -3397,14 +3439,14 @@ extern int eh_returnjump_p (rtx_insn *);
extern int onlyjump_p (const rtx_insn *);
extern int only_sets_cc0_p (const_rtx);
extern int sets_cc0_p (const_rtx);
-extern int invert_jump_1 (rtx_insn *, rtx);
-extern int invert_jump (rtx_insn *, rtx, int);
+extern int invert_jump_1 (rtx_jump_insn *, rtx);
+extern int invert_jump (rtx_jump_insn *, rtx, int);
extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
extern int true_regnum (const_rtx);
extern unsigned int reg_or_subregno (const_rtx);
extern int redirect_jump_1 (rtx_insn *, rtx);
-extern void redirect_jump_2 (rtx_insn *, rtx, rtx, int, int);
-extern int redirect_jump (rtx_insn *, rtx, int);
+extern void redirect_jump_2 (rtx_jump_insn *, rtx, rtx, int, int);
+extern int redirect_jump (rtx_jump_insn *, rtx, int);
extern void rebuild_jump_labels (rtx_insn *);
extern void rebuild_jump_labels_chain (rtx_insn *);
extern rtx reversed_comparison (const_rtx, machine_mode);
@@ -3487,7 +3529,7 @@ extern void print_inline_rtx (FILE *, const_rtx, int);
not be in sched-vis.c but in rtl.c, because they are not only used
by the scheduler anymore but for all "slim" RTL dumping. */
extern void dump_value_slim (FILE *, const_rtx, int);
-extern void dump_insn_slim (FILE *, const_rtx);
+extern void dump_insn_slim (FILE *, const rtx_insn *);
extern void dump_rtl_slim (FILE *, const rtx_insn *, const rtx_insn *,
int, int);
extern void print_value (pretty_printer *, const_rtx, int);