aboutsummaryrefslogtreecommitdiff
path: root/gcc/resource.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-08-28 20:45:40 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2014-08-28 20:45:40 +0000
commitdc01c3d194afdf0ef85c46a97459badf1b149225 (patch)
treee248d452a91447eef690b32a97167db7834457e2 /gcc/resource.c
parent8ba24b7b5fc19c54d86000260cf697c1dd9ab303 (diff)
downloadgcc-dc01c3d194afdf0ef85c46a97459badf1b149225.zip
gcc-dc01c3d194afdf0ef85c46a97459badf1b149225.tar.gz
gcc-dc01c3d194afdf0ef85c46a97459badf1b149225.tar.bz2
Work towards NEXT_INSN/PREV_INSN requiring insns as their params
gcc/ 2014-08-28 David Malcolm <dmalcolm@redhat.com> * cfgexpand.c (pass_expand::execute): Strengthen local "after" from rtx to rtx_insn *. * cfgrtl.c (force_nonfallthru_and_redirect): Replace use of local rtx "note" with new local rtx_insn * "new_head" when calculating head insn of new basic block. * combine.c (combine_split_insns): Strengthen return type and local "ret" from rtx to rtx_insn *. (likely_spilled_retval_p): Likewise for locals "use" and "p". (try_combine): Eliminate local "m_split", splitting into new locals "m_split_insn" and "m_split_pat". (find_split_point): Strengthen local "seq" from rtx into rtx_insn *. * config/spu/spu.c (spu_machine_dependent_reorg): Likewise for locals "label", "branch". * config/spu/spu.md (define_expand "smulsi3_highpart"): Likewise for local "insn". (define_expand "umulsi3_highpart"): Likewise for local "insn". * dse.c (note_add_store_info): Likewise for fields "first", "current". (note_add_store): Likewise for local "insn". (emit_inc_dec_insn_before): Likewise for locals "insn", "new_insn", "cur". (find_shift_sequence): Likewise for locals "shift_seq", "insn". (replace_read): Likewise for locals "insns", "this_insn". * dwarf2cfi.c (dw_trace_info): Likewise for field "eh_head". (notice_eh_throw): Likewise for param "insn". (before_next_cfi_note): Likewise for return type, param, and local "prev". (connect_traces): Likewise for local "note". * emit-rtl.c (reset_all_used_flags): Likewise for local "p". (verify_rtl_sharing): Likewise. (unshare_all_rtl_in_chain): Likewise for param "insn". (get_first_nonnote_insn): Likewise for local "insn". (get_last_nonnote_insn): Likewise. Introduce local rtx_sequence * "seq" and use its methods to clarify things. (next_insn): Strengthen return type from rtx to rtx_insn *. Rename param "insn" to "uncast_insn" and reintroduce "insn" as a local rtx_insn * using a checked cast, dropping a checked cast made redundant by this change. Use a cast to and method of rtx_sequence to clarify the code. (previous_insn): Rename param "insn" to "uncast_insn" and reintroduce "insn" as a local rtx_insn * using a checked cast, dropping a checked cast made redundant by this change. Use a cast to and method of rtx_sequence to clarify the code. (next_nonnote_insn): Rename param "insn" to "uncast_insn" and reintroduce "insn" as a local rtx_insn * using a checked cast, dropping a checked cast made redundant by this change. (next_nonnote_insn_bb): Likewise. (prev_nonnote_insn): Likewise. (prev_nonnote_insn_bb): Likewise. (next_nondebug_insn): Likewise. (prev_nondebug_insn): Likewise. (next_nonnote_nondebug_insn): Likewise. (prev_nonnote_nondebug_insn): Likewise. (next_real_insn): Likewise. (prev_real_insn): Likewise. (next_active_insn): Likewise. (prev_active_insn): Likewise. (next_cc0_user): Likewise. Use rtx_sequence and a method for clarity. (prev_cc0_setter): Likewise. (try_split): Rename param "trial" to "uncast_trial" and reintroduce "insn" as a local rtx_insn * using a checked cast, dropping checked casts made redundant by this change. Strengthen locals "seq", "tem", "insn_last", "insn", "next" from rtx to rtx_insn *. (remove_insn): Rename param "insn" to "uncast_insn" and reintroduce "insn" as a local rtx_insn * using a checked cast. (emit_pattern_after_setloc): Likewise for param "after", as "uncast_after". (emit_pattern_after): Likewise. Strengthen local "prev" from rtx to rtx_insn *. (emit_pattern_before_setloc): Rename param "before" to "uncast_before" and reintroduce "before" as a local rtx_insn * using a checked cast. Strengthen locals "first", "last" from rtx to rtx_insn *. (emit_pattern_before): Likewise rename/cast param "before" to "uncast_before". Strengthen local "next" from rtx to rtx_insn *. * except.c (copy_reg_eh_region_note_forward): Strengthen param "first" and local "insn" from rtx to rtx_insn *. (copy_reg_eh_region_note_backward): Likewise for param "last" and local "insn". * expr.c (fixup_args_size_notes): Rename param "last" to "uncast_last" and reintroduce "last" as a local rtx_insn * using a checked cast. Strengthen local "insn" from rtx to rtx_insn *. * function.c (set_insn_locations): Strengthen param "insn" from rtx to rtx_insn *. (record_insns): Likewise for param "insns" and local "tmp". (active_insn_between): Rename param "tail" to "uncast_tail" and reintroduce "tail" as a local rtx_insn * using a checked cast. (thread_prologue_and_epilogue_insns): Split out top-level local rtx "seq" into three different rtx_insn * locals. Strengthen local "prologue_seq" from rtx to rtx_insn *. * gcse.c (insert_insn_end_basic_block): Strenghen local "insn" from rtx to rtx_insn *. * haifa-sched.c (initiate_bb_reg_pressure_info): Likewise. (priority): Likewise for locals "prev_first", "twin". (setup_insn_max_reg_pressure): Likewise for param "after". (sched_setup_bb_reg_pressure_info): Likewise. (no_real_insns_p): Strengthen params from const_rtx to const rtx_insn *. (schedule_block): Strengthen local "next_tail" from rtx to rtx_insn *. * ifcvt.c (find_active_insn_before): Strengthen return type and param "insn" from rtx to rtx_insn *. (find_active_insn_after): Likewise. (cond_exec_process_insns): Likewise for param "start" and local "insn". (cond_exec_process_if_block): Likewise for locals "then_start", "then_end", "else_start", "else_end", "insn", "start", "end", "from". (noce_process_if_block): Likewise for local "jump". (merge_if_block): Likewise for two locals named "end". (cond_exec_find_if_block): Likewise for local "last_insn". * jump.c (delete_related_insns): Rename param "insn" to "uncast_insn" and reintroduce "insn" as a local rtx_insn * using a checked cast. Strengthen local "p" from rtx to rtx_insn *. * lra-constraints.c (inherit_reload_reg): Replace NULL_RTX with NULL. (split_reg): Likewise. * lra.c (lra_process_new_insns): Likewise. * modulo-sched.c (permute_partial_schedule): Strengthen param "last" from rtx to rtx_insn *. * optabs.c (add_equal_note): Likewise for param "insns" and local "last_insn". (expand_binop_directly): Add checked casts to rtx_insn * within NEXT_INSN (pat) uses. (expand_unop_direct): Likewise. (maybe_emit_unop_insn): Likewise. * recog.c (peep2_attempt): Strengthen locals "last", "before_try", "x" from rtx to rtx_insn *. * reorg.c (optimize_skip): Strengthen return type and local "delay_list" from rtx to rtx_insn_list *. Strengthen param "insn" and locals "trial", "next_trial" from rtx to rtx_insn *. * resource.c (next_insn_no_annul): Strengthen return type and param "insn" from rtx to rtx_insn *. Use a cast to and method of rtx_sequence to clarify the code. (mark_referenced_resources): Add a checked cast to rtx_insn * within PREV_INSN (x). (find_dead_or_set_registers): Strengthen return type, param "target", locals "insn", "next", "jump_insn", "this_jump_insn" from rtx to rtx_insn *. Strengthen param "jump_target" from rtx * to rtx_insn **. (mark_target_live_regs): Strengthen params "insns" and "target", locals "insn", "jump_target", "start_insn", "stop_insn" from rtx to rtx_insn *. Use cast to and method of rtx_sequence to clarify the code. * resource.h (mark_target_live_regs): Strengthen params 1 and 2 from rtx to rtx_insn *. * rtl.h (copy_reg_eh_region_note_forward): Strengthen second param from rtx to rtx_insn *. (copy_reg_eh_region_note_backward): Likewise. (unshare_all_rtl_in_chain): Likewise for sole param. (dump_rtl_slim): Strengthen second and third params from const_rtx to const rtx_insn *. * sched-deps.c (sched_free_deps): Strengthen params "head" and "tail" and locals "insn", "next_tail" from rtx to rtx_insn *. * sched-ebb.c (init_ready_list): Strengthen locals "prev_head", "next_tail" from rtx to rtx_insn *. (begin_move_insn): Likewise for local "next". * sched-int.h (sched_free_deps): Likewise for first and second params. (no_real_insns_p): Strengthen both params from const_rtx to const rtx_insn *. (sched_setup_bb_reg_pressure_info): Strengthen second params from rtx to rtx_insn *. * sched-rgn.c (init_ready_list): Likewise for locals "prev_head", "next_tail". * sched-vis.c (dump_rtl_slim): Strengthen params "first", "last" and locals "insn", "tail" from const_rtx to const rtx_insn *. (rtl_dump_bb_for_graph): Strengthen local "insn" from rtx to rtx_insn *. (debug_rtl_slim): Strengthen params "first" and "last" from const_rtx to const rtx_insn *. * shrink-wrap.c (try_shrink_wrapping): Strengthen param "prologue_seq" and locals "seq", "p_insn" from rtx to rtx_insn *. (convert_to_simple_return): Likewise for param "returnjump". * shrink-wrap.h (try_shrink_wrapping): Likewise for param "prologue_seq". (convert_to_simple_return): Likewise for param "returnjump". * valtrack.c (propagate_for_debug): Likewise for params "insn", "last". * valtrack.h (propagate_for_debug): Likewise for second param. From-SVN: r214693
Diffstat (limited to 'gcc/resource.c')
-rw-r--r--gcc/resource.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/gcc/resource.c b/gcc/resource.c
index dfd10f6..eb5374e 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -79,10 +79,10 @@ static HARD_REG_SET pending_dead_regs;
static void update_live_status (rtx, const_rtx, void *);
static int find_basic_block (rtx, int);
-static rtx next_insn_no_annul (rtx);
-static rtx find_dead_or_set_registers (rtx, struct resources*,
- rtx*, int, struct resources,
- struct resources);
+static rtx_insn *next_insn_no_annul (rtx_insn *);
+static rtx_insn *find_dead_or_set_registers (rtx_insn *, struct resources*,
+ rtx_insn **, int, struct resources,
+ struct resources);
/* Utility function called from mark_target_live_regs via note_stores.
It deadens any CLOBBERed registers and livens any SET registers. */
@@ -163,8 +163,8 @@ find_basic_block (rtx insn, int search_limit)
/* Similar to next_insn, but ignores insns in the delay slots of
an annulled branch. */
-static rtx
-next_insn_no_annul (rtx insn)
+static rtx_insn *
+next_insn_no_annul (rtx_insn *insn)
{
if (insn)
{
@@ -187,7 +187,7 @@ next_insn_no_annul (rtx insn)
insn = NEXT_INSN (insn);
if (insn && NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
+ insn = as_a <rtx_sequence *> (PATTERN (insn))->insn (0);
}
return insn;
@@ -308,7 +308,7 @@ mark_referenced_resources (rtx x, struct resources *res,
However, we may have moved some of the parameter loading insns
into the delay slot of this CALL. If so, the USE's for them
don't count and should be skipped. */
- rtx_insn *insn = PREV_INSN (x);
+ rtx_insn *insn = PREV_INSN (as_a <rtx_insn *> (x));
rtx_sequence *sequence = 0;
int seq_size = 0;
int i;
@@ -420,19 +420,19 @@ mark_referenced_resources (rtx x, struct resources *res,
Stop after passing a few conditional jumps, and/or a small
number of unconditional branches. */
-static rtx
-find_dead_or_set_registers (rtx target, struct resources *res,
- rtx *jump_target, int jump_count,
+static rtx_insn *
+find_dead_or_set_registers (rtx_insn *target, struct resources *res,
+ rtx_insn **jump_target, int jump_count,
struct resources set, struct resources needed)
{
HARD_REG_SET scratch;
- rtx insn, next;
- rtx jump_insn = 0;
+ rtx_insn *insn, *next;
+ rtx_insn *jump_insn = 0;
int i;
for (insn = target; insn; insn = next)
{
- rtx this_jump_insn = insn;
+ rtx_insn *this_jump_insn = insn;
next = NEXT_INSN (insn);
@@ -480,7 +480,7 @@ find_dead_or_set_registers (rtx target, struct resources *res,
of a call, so search for a JUMP_INSN in any position. */
for (i = 0; i < seq->len (); i++)
{
- this_jump_insn = seq->element (i);
+ this_jump_insn = seq->insn (i);
if (JUMP_P (this_jump_insn))
break;
}
@@ -497,14 +497,14 @@ find_dead_or_set_registers (rtx target, struct resources *res,
if (any_uncondjump_p (this_jump_insn)
|| ANY_RETURN_P (PATTERN (this_jump_insn)))
{
- next = JUMP_LABEL (this_jump_insn);
+ next = JUMP_LABEL_AS_INSN (this_jump_insn);
if (ANY_RETURN_P (next))
- next = NULL_RTX;
+ next = NULL;
if (jump_insn == 0)
{
jump_insn = insn;
if (jump_target)
- *jump_target = JUMP_LABEL (this_jump_insn);
+ *jump_target = JUMP_LABEL_AS_INSN (this_jump_insn);
}
}
else if (any_condjump_p (this_jump_insn))
@@ -569,7 +569,7 @@ find_dead_or_set_registers (rtx target, struct resources *res,
AND_COMPL_HARD_REG_SET (fallthrough_res.regs, scratch);
if (!ANY_RETURN_P (JUMP_LABEL (this_jump_insn)))
- find_dead_or_set_registers (JUMP_LABEL (this_jump_insn),
+ find_dead_or_set_registers (JUMP_LABEL_AS_INSN (this_jump_insn),
&target_res, 0, jump_count,
target_set, needed);
find_dead_or_set_registers (next,
@@ -880,14 +880,14 @@ return_insn_p (const_rtx insn)
init_resource_info () was invoked before we are called. */
void
-mark_target_live_regs (rtx insns, rtx target, struct resources *res)
+mark_target_live_regs (rtx_insn *insns, rtx_insn *target, struct resources *res)
{
int b = -1;
unsigned int i;
struct target_info *tinfo = NULL;
- rtx insn;
+ rtx_insn *insn;
rtx jump_insn = 0;
- rtx jump_target;
+ rtx_insn *jump_target;
HARD_REG_SET scratch;
struct resources set, needed;
@@ -965,7 +965,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
if (b != -1)
{
regset regs_live = DF_LR_IN (BASIC_BLOCK_FOR_FN (cfun, b));
- rtx start_insn, stop_insn;
+ rtx_insn *start_insn, *stop_insn;
/* Compute hard regs live at start of block. */
REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
@@ -978,7 +978,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
if (NONJUMP_INSN_P (start_insn)
&& GET_CODE (PATTERN (start_insn)) == SEQUENCE)
- start_insn = XVECEXP (PATTERN (start_insn), 0, 0);
+ start_insn = as_a <rtx_sequence *> (PATTERN (start_insn))->insn (0);
if (NONJUMP_INSN_P (stop_insn)
&& GET_CODE (PATTERN (stop_insn)) == SEQUENCE)
@@ -1122,7 +1122,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
if (jump_insn)
{
struct resources new_resources;
- rtx stop_insn = next_active_insn (jump_insn);
+ rtx_insn *stop_insn = next_active_insn (jump_insn);
if (!ANY_RETURN_P (jump_target))
jump_target = next_active_insn (jump_target);