[PATCH 016/236] BND_TO scaffolding

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.h (BND_TO): insn_t will eventually be an
rtx_insn *.  To help with transition, for now, convert from an
access macro into a pair of functions: BND_TO, returning an
rtx_insn *, and...
(SET_BND_TO): New function, for use where BND_TO is used as an
lvalue.

* sel-sched-ir.c (blist_add): Update lvalue usage of BND_TO to
SET_BND_TO.
(BND_TO): New function, adding a checked cast.
(SET_BND_TO): New function.

* sel-sched.c (move_cond_jump): Update lvalue usage of BND_TO to
SET_BND_TO.
(compute_av_set_on_boundaries): Likewise.

/
* rtx-classes-status.txt: Add SET_BND_TO
---
 gcc/sel-sched-ir.c | 12 +++-
 gcc/sel-sched-ir.h |  3 ++-
 gcc/sel-sched.c|  4 ++--
 rtx-classes-status.txt |  1 +
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index cb4682f..01e1dd3 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -207,7 +207,7 @@ blist_add (blist_t *lp, insn_t to, ilist_t ptr, deps_t dc)
   _list_add (lp);
   bnd = BLIST_BND (*lp);
 
-  BND_TO (bnd) = to;
+  SET_BND_TO (bnd) = to;
   BND_PTR (bnd) = ptr;
   BND_AV (bnd) = NULL;
   BND_AV1 (bnd) = NULL;
@@ -6468,4 +6468,14 @@ rtx& SET_BB_NOTE_LIST (basic_block bb)
   return SEL_REGION_BB_INFO (bb)->note_list;
 }
 
+rtx_insn *BND_TO (bnd_t bnd)
+{
+  return as_a_nullable  (bnd->to);
+}
+
+insn_t& SET_BND_TO (bnd_t bnd)
+{
+  return bnd->to;
+}
+
 #endif
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 81accaf..ab1f42f 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -233,7 +233,8 @@ struct _bnd
   deps_t dc;
 };
 typedef struct _bnd *bnd_t;
-#define BND_TO(B) ((B)->to)
+extern rtx_insn *BND_TO (bnd_t bnd);
+extern insn_t& SET_BND_TO (bnd_t bnd);
 
 /* PTR stands not for pointer as you might think, but as a Path To Root of the
current instruction group from boundary B.  */
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index c3e0cca..8181ec2 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4961,7 +4961,7 @@ move_cond_jump (rtx insn, bnd_t bnd)
 
   /* Jump is moved to the boundary.  */
   next = PREV_INSN (insn);
-  BND_TO (bnd) = insn;
+  SET_BND_TO (bnd) = insn;
 
   ft_edge = find_fallthru_edge_from (block_from);
   block_next = ft_edge->dest;
@@ -5102,7 +5102,7 @@ compute_av_set_on_boundaries (fence_t fence, blist_t 
bnds, av_set_t *av_vliw_p)
{
  gcc_assert (FENCE_INSN (fence) == BND_TO (bnd));
  FENCE_INSN (fence) = bnd_to;
- BND_TO (bnd) = bnd_to;
+ SET_BND_TO (bnd) = bnd_to;
}
 
   av_set_clear (&BND_AV (bnd));
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index e77e847..52567e7 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -13,6 +13,7 @@ TODO: "Scaffolding" to be removed
 * DF_REF_INSN
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER, SET_BB_FOOTER
 * SET_BB_NOTE_LIST
+* SET_BND_TO
 * SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
 * SET_VINSN_INSN_RTX
-- 
1.8.5.3



[PATCH 074/236] expr.c: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* expr.c (convert_move): Strengthen local "insns" from rtx to
rtx_insn *.
(emit_block_move_via_loop): Strengthen locals "cmp_label" and
"top_label" from rtx to rtx_code_label *.
(move_block_to_reg): Strengthen local "insn", "last" from rtx to
rtx_insn *.
(emit_single_push_insn): Likewise for locals "prev", "last".
(store_expr): Strengthen locals "lab1", "lab2", "label" from rtx
to rtx_code_label *.
(store_constructor): Likewise for locals "loop_start", "loop_end".
(expand_cond_expr_using_cmove): Strengthen local "seq" from rtx to
rtx_insn *.
(expand_expr_real_2): Likewise.
(expand_expr_real_1): Strengthen local "label" from rtx to
rtx_code_label *.
---
 gcc/expr.c | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/expr.c b/gcc/expr.c
index ba1a36c..0290c4e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -362,7 +362,8 @@ convert_move (rtx to, rtx from, int unsignedp)
 
   if (to_real)
 {
-  rtx value, insns;
+  rtx value;
+  rtx_insn *insns;
   convert_optab tab;
 
   gcc_assert ((GET_MODE_PRECISION (from_mode)
@@ -470,7 +471,7 @@ convert_move (rtx to, rtx from, int unsignedp)
   if (GET_MODE_PRECISION (from_mode) < GET_MODE_PRECISION (to_mode)
   && GET_MODE_PRECISION (to_mode) > BITS_PER_WORD)
 {
-  rtx insns;
+  rtx_insn *insns;
   rtx lowpart;
   rtx fill_value;
   rtx lowfrom;
@@ -1451,7 +1452,8 @@ static void
 emit_block_move_via_loop (rtx x, rtx y, rtx size,
  unsigned int align ATTRIBUTE_UNUSED)
 {
-  rtx cmp_label, top_label, iter, x_addr, y_addr, tmp;
+  rtx_code_label *cmp_label, *top_label;
+  rtx iter, x_addr, y_addr, tmp;
   enum machine_mode x_addr_mode = get_address_mode (x);
   enum machine_mode y_addr_mode = get_address_mode (y);
   enum machine_mode iter_mode;
@@ -1505,7 +1507,7 @@ move_block_to_reg (int regno, rtx x, int nregs, enum 
machine_mode mode)
   int i;
 #ifdef HAVE_load_multiple
   rtx pat;
-  rtx last;
+  rtx_insn *last;
 #endif
 
   if (nregs == 0)
@@ -1551,7 +1553,7 @@ move_block_from_reg (int regno, rtx x, int nregs)
 #ifdef HAVE_store_multiple
   if (HAVE_store_multiple)
 {
-  rtx last = get_last_insn ();
+  rtx_insn *last = get_last_insn ();
   rtx pat = gen_store_multiple (x, gen_rtx_REG (word_mode, regno),
GEN_INT (nregs));
   if (pat)
@@ -4062,8 +4064,8 @@ static void
 emit_single_push_insn (enum machine_mode mode, rtx x, tree type)
 {
   int delta, old_delta = stack_pointer_delta;
-  rtx prev = get_last_insn ();
-  rtx last;
+  rtx_insn *prev = get_last_insn ();
+  rtx_insn *last;
 
   emit_single_push_insn_1 (mode, x, type);
 
@@ -5168,7 +5170,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool 
nontemporal)
 side.  This avoids the creation of unnecessary temporaries.
 For non-BLKmode, it is more efficient not to do this.  */
 
-  rtx lab1 = gen_label_rtx (), lab2 = gen_label_rtx ();
+  rtx_code_label *lab1 = gen_label_rtx (), *lab2 = gen_label_rtx ();
 
   do_pending_stack_adjust ();
   NO_DEFER_POP;
@@ -5403,7 +5405,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool 
nontemporal)
= expand_expr (copy_size, NULL_RTX, VOIDmode,
   (call_param_p
? EXPAND_STACK_PARM : EXPAND_NORMAL));
- rtx label = 0;
+ rtx_code_label *label = 0;
 
  /* Copy that much.  */
  copy_size_rtx = convert_to_mode (pointer_mode, copy_size_rtx,
@@ -6190,8 +6192,8 @@ store_constructor (tree exp, rtx target, int cleared, 
HOST_WIDE_INT size)
  }
else
  {
-   rtx loop_start = gen_label_rtx ();
-   rtx loop_end = gen_label_rtx ();
+   rtx_code_label *loop_start = gen_label_rtx ();
+   rtx_code_label *loop_end = gen_label_rtx ();
tree exit_cond;
 
expand_normal (hi_index);
@@ -8008,7 +8010,7 @@ expand_cond_expr_using_cmove (tree treeop0 
ATTRIBUTE_UNUSED,
  and return.  */
   if (insn)
 {
-  rtx seq = get_insns ();
+  rtx_insn *seq = get_insns ();
   end_sequence ();
   emit_insn (seq);
   return convert_modes (orig_mode, mode, temp, 0);
@@ -8812,7 +8814,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum 
machine_mode tmode,
   and return.  */
if (insn)
  {
-   rtx seq = get_insns ();
+   rtx_insn *seq = get_insns ();
end_sequence ();
emit_insn (seq);
return target;
@@ -10547,7 +10549,7 @@ expand_expr_real_1 (tree exp, rtx target, enum 
machine_mode tmode,
&& integer_onep (DECL_SIZE (TREE_OPERAND (lhs, 1)))
&& intege

[PATCH 178/236] Remove BB_HEAD, BB_END, BB_HEADER scaffolding

2014-08-06 Thread David Malcolm
gcc/
* basic-block.h (struct rtl_bb_info): Strengthen fields "end_"
and "header_" from rtx to rtx_insn *.
(struct basic_block_d): Likewise for field "head_" within "x"
field of union basic_block_il_dependent.
(BB_HEAD): Drop function...
(SET_BB_HEAD): ...and this function in favor of...
(BB_HEAD): ...reinstate macro.
(BB_END): Drop function...
(SET_BB_END): ...and this function in favor of...
(BB_END): ...reinstate macro.
(BB_HEADER): Drop function...
(SET_BB_HEADER): ...and this function in favor of...
(BB_HEADER): ...reinstate macro.

* bb-reorder.c (add_labels_and_missing_jumps): Drop use of BB_END.
(fix_crossing_unconditional_branches): Likewise.
* caller-save.c (save_call_clobbered_regs): Likewise.
(insert_one_insn): Drop use of SET_BB_HEAD and SET_BB_END.
* cfgbuild.c (find_bb_boundaries): Drop use of SET_BB_END.
* cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise.
(merge_blocks_move_successor_nojumps): Likewise.
(outgoing_edges_match): Update use of for_each_rtx to
for_each_rtx_in_insn.
* cfgexpand.c (expand_gimple_cond): Drop use of SET_BB_END.
(expand_gimple_cond): Likewise.
(expand_gimple_tailcall): Likewise.
(expand_gimple_basic_block): Drop use of SET_BB_HEAD and
SET_BB_END.
(construct_exit_block): Drop use of SET_BB_END.
* cfgrtl.c (cfg_layout_function_footer): Strengthen from rtx to
rtx_insn *.
(delete_insn): Rename param "insn" to "uncast_insn", introducing
a new local "insn" with a checked cast to rtx_insn *.  Drop use of
SET_BB_HEAD and SET_BB_END.
(create_basic_block_structure): Drop use of SET_BB_HEAD and
SET_BB_END.
(rtl_delete_block): Drop use of SET_BB_HEAD.
(rtl_split_block): Drop use of SET_BB_END.
(emit_nop_for_unique_locus_between): Likewise.
(rtl_merge_blocks): Drop use of SET_BB_END and SET_BB_HEAD.
(block_label): Drop use of SET_BB_HEAD.
(fixup_abnormal_edges): Drop use of SET_BB_END.
(record_effective_endpoints): Drop use of SET_BB_HEADER.
(relink_block_chain): Likewise.
(fixup_reorder_chain): Drop use of SET_BB_END.
(cfg_layout_duplicate_bb): Drop use of SET_BB_HEADER.
(cfg_layout_delete_block): Strengthen local "to" from rtx * to
rtx_insn **.  Drop use of SET_BB_HEADER.
(cfg_layout_merge_blocks): Drop use of SET_BB_HEADER, SET_BB_END,
SET_BB_HEAD.
(BB_HEAD): Delete this function.
(SET_BB_HEAD): Likewise.
(BB_END): Likewise.
(SET_BB_END): Likewise.
(BB_HEADER): Likewise.
(SET_BB_HEADER): Likewise.
* emit-rtl.c (add_insn_after):  Rename param "insn" to
"uncast_insn", adding a new local "insn" and a checked cast to
rtx_insn *.  Drop use of SET_BB_END.
(remove_insn): Strengthen locals "next" and "prev" from rtx to
rtx_insn *.  Drop use of SET_BB_HEAD and SET_BB_END.
(reorder_insns): Drop use of SET_BB_END.
(emit_insn_after_1): Strengthen param "first" and locals "last",
"after_after" from rtx to rtx_insn *.  Drop use of SET_BB_END.
(emit_pattern_after_noloc): Add checked cast.
* haifa-sched.c (get_ebb_head_tail): Drop use of SET_BB_END.
(restore_other_notes): Likewise.
(move_insn): Likewise.
(sched_extend_bb): Likewise.
(fix_jump_move): Likewise.
* ifcvt.c (noce_process_if_block): Likewise.
(dead_or_predicable): Likewise.
* ira.c (update_equiv_regs): Drop use of SET_BB_HEAD.
* reg-stack.c (change_stack): Drop use of SET_BB_END.
* sel-sched-ir.c (sel_move_insn): Likewise.
* sel-sched.c (move_nop_to_previous_block): Likewise.

* config/c6x/c6x.c (hwloop_optimize): Drop use of SET_BB_HEAD and
SET_BB_END.
* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
/
* rtx-classes-status.txt: SET_BB_HEAD, SET_BB_END, SET_BB_HEADER
are done.
---
 gcc/basic-block.h  | 18 --
 gcc/bb-reorder.c   |  4 +--
 gcc/caller-save.c  |  6 ++--
 gcc/cfgbuild.c |  4 +--
 gcc/cfgcleanup.c   |  8 ++---
 gcc/cfgexpand.c| 22 ++--
 gcc/cfgrtl.c   | 96 ++
 gcc/config/c6x/c6x.c   |  4 +--
 gcc/config/ia64/ia64.c |  6 ++--
 gcc/emit-rtl.c | 27 +++---
 gcc/haifa-sched.c  | 18 +-
 gcc/ifcvt.c|  4 +--
 gcc/ira.c  |  2 +-
 gcc/reg-stack.c|  2 +-
 gcc/sel-sched-ir.c |  2 +-
 gcc/sel-sched.c|  2 +-
 rtx-classes-status.txt |  1 -
 17 files changed, 88 insertions(+), 138 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 5b2af29..b96c28a 100644
--- a/gcc/basic-block.h
+++ b/gcc/bas

[PATCH 065/236] cse.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* cse.c (struct qty_table_elem): Strengthen field "const_insn"
from rtx to rtx_insn *.
(struct change_cc_mode_args): Likewise for field "insn".
(this_insn): Strengthen from rtx to rtx_insn *.
(make_new_qty): Replace use of NULL_RTX with NULL when dealing
with insn.
(validate_canon_reg): Strengthen param "insn" from rtx to
rtx_insn *.
(canon_reg): Likewise.
(fold_rtx): Likewise.  Replace use of NULL_RTX with NULL when
dealing with insn.
(record_jump_equiv): Strengthen param "insn" from rtx to
rtx_insn *.
(try_back_substitute_reg): Likewise, also for locals "prev",
"bb_head".
(find_sets_in_insn): Likewise for param "insn".
(canonicalize_insn): Likewise.
(cse_insn): Likewise.  Add a checked cast.
(invalidate_from_clobbers): Likewise for param "insn".
(invalidate_from_sets_and_clobbers): Likewise.
(cse_process_notes_1): Replace use of NULL_RTX with NULL when
dealing with insn.
(cse_prescan_path): Strengthen local "insn" from rtx to
rtx_insn *.
(cse_extended_basic_block): Likewise for locals "insn" and
"prev_insn".
(cse_main): Likewise for param "f".
(check_for_label_ref): Likewise for local "insn".
(set_live_p): Likewise for second param ("insn").
(insn_live_p): Likewise for first param ("insn") and for local
"next".
(cse_change_cc_mode_insn): Likewise for first param "insn".
(cse_change_cc_mode_insns): Likewise for first and second params
"start" and "end".
(cse_cc_succs): Likewise for locals "insns", "last_insns", "insn"
and "end".
(cse_condition_code_reg): Likewise for locals "last_insn", "insn",
"cc_src_insn".
---
 gcc/cse.c | 99 ---
 1 file changed, 50 insertions(+), 49 deletions(-)

diff --git a/gcc/cse.c b/gcc/cse.c
index 6473c3e..9c39fea 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -241,7 +241,7 @@ static int next_qty;
 struct qty_table_elem
 {
   rtx const_rtx;
-  rtx const_insn;
+  rtx_insn *const_insn;
   rtx comparison_const;
   int comparison_qty;
   unsigned int first_reg, last_reg;
@@ -258,7 +258,7 @@ static struct qty_table_elem *qty_table;
cse_change_cc_mode.  */
 struct change_cc_mode_args
 {
-  rtx insn;
+  rtx_insn *insn;
   rtx newreg;
 };
 
@@ -278,7 +278,7 @@ static enum machine_mode this_insn_cc0_mode, 
prev_insn_cc0_mode;
 
 /* Insn being scanned.  */
 
-static rtx this_insn;
+static rtx_insn *this_insn;
 static bool optimize_this_for_speed_p;
 
 /* Index by register number, gives the number of the next (or
@@ -582,19 +582,19 @@ static inline unsigned canon_hash (rtx, enum 
machine_mode);
 static inline unsigned safe_hash (rtx, enum machine_mode);
 static inline unsigned hash_rtx_string (const char *);
 
-static rtx canon_reg (rtx, rtx);
+static rtx canon_reg (rtx, rtx_insn *);
 static enum rtx_code find_comparison_args (enum rtx_code, rtx *, rtx *,
   enum machine_mode *,
   enum machine_mode *);
-static rtx fold_rtx (rtx, rtx);
+static rtx fold_rtx (rtx, rtx_insn *);
 static rtx equiv_constant (rtx);
-static void record_jump_equiv (rtx, bool);
+static void record_jump_equiv (rtx_insn *, bool);
 static void record_jump_cond (enum rtx_code, enum machine_mode, rtx, rtx,
  int);
-static void cse_insn (rtx);
+static void cse_insn (rtx_insn *);
 static void cse_prescan_path (struct cse_basic_block_data *);
-static void invalidate_from_clobbers (rtx);
-static void invalidate_from_sets_and_clobbers (rtx);
+static void invalidate_from_clobbers (rtx_insn *);
+static void invalidate_from_sets_and_clobbers (rtx_insn *);
 static rtx cse_process_notes (rtx, rtx, bool *);
 static void cse_extended_basic_block (struct cse_basic_block_data *);
 static int check_for_label_ref (rtx *, void *);
@@ -604,11 +604,11 @@ static struct cse_reg_info * get_cse_reg_info (unsigned 
int regno);
 static int check_dependence (rtx *, void *);
 
 static void flush_hash_table (void);
-static bool insn_live_p (rtx, int *);
-static bool set_live_p (rtx, rtx, int *);
+static bool insn_live_p (rtx_insn *, int *);
+static bool set_live_p (rtx, rtx_insn *, int *);
 static int cse_change_cc_mode (rtx *, void *);
-static void cse_change_cc_mode_insn (rtx, rtx);
-static void cse_change_cc_mode_insns (rtx, rtx, rtx);
+static void cse_change_cc_mode_insn (rtx_insn *, rtx);
+static void cse_change_cc_mode_insns (rtx_insn *, rtx_insn *, rtx);
 static enum machine_mode cse_cc_succs (basic_block, basic_block, rtx, rtx,
   bool);
 
@@ -904,7 +904,7 @@ make_new_qty (unsigned int reg, enum machine_mode mode)
   ent->first_reg = reg;
   ent->last_reg = reg;
   ent->mode = mode;
-  ent->const_rtx = ent->const_insn = NULL_RTX;
+  ent-

[PATCH 076/236] function.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* function.c (emit_initial_value_sets): Strengthen local "seq"
from rtx to rtx_insn *.
(instantiate_virtual_regs_in_insn): Likewise for param "insn" and
local "seq".
(instantiate_virtual_regs): Likewise for local "insn".
(assign_parm_setup_reg): Likewise for locals "linsn", "sinsn".
(reorder_blocks_1): Likewise for param "insns" and local "insn".
(expand_function_end): Likewise for locals "insn" and "seq".
(epilogue_done): Likewise for local "insn".
(thread_prologue_and_epilogue_insns): Likewise for locals "prev",
"last", "trial".
(reposition_prologue_and_epilogue_notes): Likewise for locals
"insn", "last", "note", "first".
(match_asm_constraints_1): Likewise for param "insn" and local "insns".
(pass_match_asm_constraints::execute): Likewise for local "insn".
---
 gcc/function.c | 39 ++-
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/gcc/function.c b/gcc/function.c
index 4d8d32d..b2c9d81 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -114,7 +114,7 @@ vec *types_used_by_cur_var_decl;
 static struct temp_slot *find_temp_slot_from_address (rtx);
 static void pad_to_arg_alignment (struct args_size *, int, struct args_size *);
 static void pad_below (struct args_size *, enum machine_mode, tree);
-static void reorder_blocks_1 (rtx, tree, vec *);
+static void reorder_blocks_1 (rtx_insn *, tree, vec *);
 static int all_blocks (tree, tree *);
 static tree *get_block_vector (tree, int *);
 extern tree debug_find_var_in_block_tree (tree, tree);
@@ -1299,7 +1299,7 @@ emit_initial_value_sets (void)
 {
   struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
   int i;
-  rtx seq;
+  rtx_insn *seq;
 
   if (ivs == 0)
 return 0;
@@ -1492,12 +1492,13 @@ safe_insn_predicate (int code, int operand, rtx x)
registers present inside of insn.  The result will be a valid insn.  */
 
 static void
-instantiate_virtual_regs_in_insn (rtx insn)
+instantiate_virtual_regs_in_insn (rtx_insn *insn)
 {
   HOST_WIDE_INT offset;
   int insn_code, i;
   bool any_change = false;
-  rtx set, new_rtx, x, seq;
+  rtx set, new_rtx, x;
+  rtx_insn *seq;
 
   /* There are some special cases to be handled first.  */
   set = single_set (insn);
@@ -1888,7 +1889,7 @@ instantiate_decls (tree fndecl)
 static unsigned int
 instantiate_virtual_regs (void)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   /* Compute the offsets to use for this function.  */
   in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
@@ -3161,8 +3162,9 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, 
tree parm,
   && reg_mentioned_p (virtual_incoming_args_rtx,
  XEXP (data->stack_parm, 0)))
 {
-  rtx linsn = get_last_insn ();
-  rtx sinsn, set;
+  rtx_insn *linsn = get_last_insn ();
+  rtx_insn *sinsn;
+  rtx set;
 
   /* Mark complex types separately.  */
   if (GET_CODE (parmreg) == CONCAT)
@@ -4145,9 +4147,10 @@ clear_block_marks (tree block)
 }
 
 static void
-reorder_blocks_1 (rtx insns, tree current_block, vec *p_block_stack)
+reorder_blocks_1 (rtx_insn *insns, tree current_block,
+ vec *p_block_stack)
 {
-  rtx insn;
+  rtx_insn *insn;
   tree prev_beg = NULL_TREE, prev_end = NULL_TREE;
 
   for (insn = insns; insn; insn = NEXT_INSN (insn))
@@ -4976,7 +4979,7 @@ expand_function_end (void)
  space for another stack frame.  */
   if (flag_stack_check == GENERIC_STACK_CHECK)
 {
-  rtx insn, seq;
+  rtx_insn *insn, *seq;
 
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
if (CALL_P (insn))
@@ -5735,7 +5738,7 @@ thread_prologue_and_epilogue_insns (void)
  EPILOGUE_BEG note and mark the insns as epilogue insns.  */
   FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
 {
-  rtx prev, last, trial;
+  rtx_insn *prev, *last, *trial;
 
   if (e->flags & EDGE_FALLTHRU)
continue;
@@ -5844,7 +5847,7 @@ epilogue_done:
 )
 {
   basic_block bb = e->src;
-  rtx insn = BB_END (bb);
+  rtx_insn *insn = BB_END (bb);
   rtx ep_seq;
 
   if (!CALL_P (insn)
@@ -5923,7 +5926,7 @@ reposition_prologue_and_epilogue_notes (void)
   if (prologue_insn_hash != NULL)
 {
   size_t len = htab_elements (prologue_insn_hash);
-  rtx insn, last = NULL, note = NULL;
+  rtx_insn *insn, *last = NULL, *note = NULL;
 
   /* Scan from the beginning until we reach the last prologue insn.  */
   /* ??? While we do have the CFG intact, there are two problems:
@@ -5974,7 +5977,7 @@ reposition_prologue_and_epilogue_notes (void)
 
   FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
{
- rtx insn, first = NULL, note = NULL;
+ rtx_insn *insn, *first = NULL, *note = NULL;
  basic_block bb = e->src;
 
  /* Scan f

[PATCH 122/236] var-tracking.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* var-tracking.c (struct micro_operation_def): Strengthen field
"insn" from rtx to rtx_insn *.
(struct emit_note_data_def): Likewise.
(insn_stack_adjust_offset_pre_post): Likewise for param "insn".
(vt_stack_adjustments): Likewise for local "insn".
(adjust_insn): Likewise for param "insn".
(val_store): Likewise.
(val_resolve): Likewise.
(struct count_use_info): Likewise for field "insn".
(log_op_type): Likewise for param "insn".
(reverse_op): Likewise.
(prepare_call_arguments): Likewise.
(add_with_sets):  The initial param takes an insn, but we can't
yet strengthen it from rtx to rtx_insn * since it's used as a
cselib_record_sets_hook callback.  For now rename initial param
from "insn" to "uncast_insn", and introduce a local "insn" of
the stronger rtx_insn * type, with a checked cast.
(compute_bb_dataflow): Strengthen local "insn" from rtx to
rtx_insn *.
(emit_note_insn_var_location): Likewise.
(emit_notes_for_changes): Likewise.
(emit_notes_for_differences): Likewise.
(next_non_note_insn_var_location): Likewise for return type and
for param "insn".
(emit_notes_in_bb): Likewise for locals "insn" and "next_insn".
(vt_initialize): Likewise for local "insn".
(delete_debug_insns): Likewise for locals "insn" and "next".
---
 gcc/var-tracking.c | 48 +---
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index ed8abdc..4d30650 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -179,7 +179,7 @@ typedef struct micro_operation_def
  instruction or note in the original flow (before any var-tracking
  notes are inserted, to simplify emission of notes), for MO_SET
  and MO_CLOBBER.  */
-  rtx insn;
+  rtx_insn *insn;
 
   union {
 /* Location.  For MO_SET and MO_COPY, this is the SET that
@@ -509,7 +509,7 @@ typedef variable_table_type::iterator 
variable_iterator_type;
 typedef struct emit_note_data_def
 {
   /* The instruction which the note will be emitted before/after.  */
-  rtx insn;
+  rtx_insn *insn;
 
   /* Where the note will be emitted (before/after insn)?  */
   enum emit_note_where where;
@@ -622,7 +622,7 @@ static bool cselib_hook_called;
 /* Local function prototypes.  */
 static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *,
  HOST_WIDE_INT *);
-static void insn_stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *,
+static void insn_stack_adjust_offset_pre_post (rtx_insn *, HOST_WIDE_INT *,
   HOST_WIDE_INT *);
 static bool vt_stack_adjustments (void);
 
@@ -793,7 +793,7 @@ stack_adjust_offset_pre_post (rtx pattern, HOST_WIDE_INT 
*pre,
PRE- and POST-modifying stack pointer.  */
 
 static void
-insn_stack_adjust_offset_pre_post (rtx insn, HOST_WIDE_INT *pre,
+insn_stack_adjust_offset_pre_post (rtx_insn *insn, HOST_WIDE_INT *pre,
   HOST_WIDE_INT *post)
 {
   rtx pattern;
@@ -862,7 +862,7 @@ vt_stack_adjustments (void)
   /* Check if the edge destination has been visited yet.  */
   if (!VTI (dest)->visited)
{
- rtx insn;
+ rtx_insn *insn;
  HOST_WIDE_INT pre, post, offset;
  VTI (dest)->visited = true;
  VTI (dest)->in.stack_adjust = offset = VTI (src)->out.stack_adjust;
@@ -1198,7 +1198,7 @@ adjust_mem_stores (rtx loc, const_rtx expr, void *data)
as other sets to the insn.  */
 
 static void
-adjust_insn (basic_block bb, rtx insn)
+adjust_insn (basic_block bb, rtx_insn *insn)
 {
   struct adjust_mem_data amd;
   rtx set;
@@ -2470,7 +2470,8 @@ val_bind (dataflow_set *set, rtx val, rtx loc, bool 
modified)
values bound to it.  */
 
 static void
-val_store (dataflow_set *set, rtx val, rtx loc, rtx insn, bool modified)
+val_store (dataflow_set *set, rtx val, rtx loc, rtx_insn *insn,
+  bool modified)
 {
   cselib_val *v = CSELIB_VAL_PTR (val);
 
@@ -2601,7 +2602,7 @@ val_reset (dataflow_set *set, decl_or_value dv)
value.  */
 
 static void
-val_resolve (dataflow_set *set, rtx val, rtx loc, rtx insn)
+val_resolve (dataflow_set *set, rtx val, rtx loc, rtx_insn *insn)
 {
   decl_or_value dv = dv_from_value (val);
 
@@ -5296,7 +5297,7 @@ var_lowpart (enum machine_mode mode, rtx loc)
 struct count_use_info
 {
   /* The insn where the RTX is.  */
-  rtx insn;
+  rtx_insn *insn;
 
   /* The basic block where insn is.  */
   basic_block bb;
@@ -5478,7 +5479,7 @@ use_type (rtx loc, struct count_use_info *cui, enum 
machine_mode *modep)
INSN of BB.  */
 
 static inline void
-log_op_type (rtx x, basic_block bb, rtx insn,
+log_op_type (rtx x, basic_block bb, rtx_insn *insn,
 enum micro_operation_type mopt, FILE *out)
 {
   fprintf (out, "bb %i op %i insn %i %s ",

[PATCH 114/236] sel-sched.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* sel-sched.c (substitute_reg_in_expr): Strengthen local
"new_insn" from rtx to rtx_insn *.
(create_insn_rtx_with_rhs): Likewise for return type and for local
"insn_rtx".
(create_insn_rtx_with_lhs): Likewise.
(create_speculation_check): Likewise for local "insn_rtx".
(implicit_clobber_conflict_p): Likewise for local "insn".
(get_expr_cost): Likewise.
(emit_bookkeeping_insn): Likewise for local "new_insn_rtx".
(move_cond_jump): Likewise for locals "next", "prev", "link",
"head", "from", "to".
---
 gcc/sel-sched.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index d697b95..d9ec878 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -753,7 +753,7 @@ substitute_reg_in_expr (expr_t expr, insn_t insn, bool undo)
   /* Substitute if INSN has a form of x:=y and LHS(INSN) occurs in *VI.  */
   if (rtx_ok_for_substitution_p (old, *where))
 {
-  rtx new_insn;
+  rtx_insn *new_insn;
   rtx *where_replace;
 
   /* We should copy these rtxes before substitution.  */
@@ -864,12 +864,12 @@ rtx_ok_for_substitution_p (rtx what, rtx where)
 
 /* Substitute VI's set source with REGNO.  Returns newly created pattern
that has REGNO as its source.  */
-static rtx
+static rtx_insn *
 create_insn_rtx_with_rhs (vinsn_t vi, rtx rhs_rtx)
 {
   rtx lhs_rtx;
   rtx pattern;
-  rtx insn_rtx;
+  rtx_insn *insn_rtx;
 
   lhs_rtx = copy_rtx (VINSN_LHS (vi));
 
@@ -945,12 +945,12 @@ replace_dest_with_reg_ok_p (insn_t insn, rtx new_reg)
 }
 
 /* Create a pattern with rhs of VI and lhs of LHS_RTX.  */
-static rtx
+static rtx_insn *
 create_insn_rtx_with_lhs (vinsn_t vi, rtx lhs_rtx)
 {
   rtx rhs_rtx;
   rtx pattern;
-  rtx insn_rtx;
+  rtx_insn *insn_rtx;
 
   rhs_rtx = copy_rtx (VINSN_RHS (vi));
 
@@ -1809,7 +1809,7 @@ static insn_t
 create_speculation_check (expr_t c_expr, ds_t check_ds, insn_t orig_insn)
 {
   rtx check_pattern;
-  rtx insn_rtx;
+  rtx_insn *insn_rtx;
   insn_t insn;
   basic_block recovery_block;
   rtx label;
@@ -2110,7 +2110,8 @@ static bool
 implicit_clobber_conflict_p (insn_t through_insn, expr_t expr)
 {
   HARD_REG_SET temp;
-  rtx insn, reg, rhs, pat;
+  rtx_insn *insn;
+  rtx reg, rhs, pat;
   hard_reg_set_iterator hrsi;
   unsigned regno;
   bool valid;
@@ -4334,7 +4335,7 @@ estimate_insn_cost (rtx insn, state_t state)
 static int
 get_expr_cost (expr_t expr, fence_t fence)
 {
-  rtx insn = EXPR_INSN_RTX (expr);
+  rtx_insn *insn = EXPR_INSN_RTX (expr);
 
   if (recog_memoized (insn) < 0)
 {
@@ -4804,7 +4805,7 @@ find_seqno_for_bookkeeping (insn_t place_to_insert, 
insn_t join_point)
 static insn_t
 emit_bookkeeping_insn (insn_t place_to_insert, expr_t c_expr, int new_seqno)
 {
-  rtx new_insn_rtx = create_copy_of_insn_rtx (EXPR_INSN_RTX (c_expr));
+  rtx_insn *new_insn_rtx = create_copy_of_insn_rtx (EXPR_INSN_RTX (c_expr));
 
   vinsn_t new_vinsn
 = create_vinsn_from_insn_rtx (new_insn_rtx,
@@ -4932,7 +4933,7 @@ move_cond_jump (rtx insn, bnd_t bnd)
 {
   edge ft_edge;
   basic_block block_from, block_next, block_new, block_bnd, bb;
-  rtx next, prev, link, head;
+  rtx_insn *next, *prev, *link, *head;
 
   block_from = BLOCK_FOR_INSN (insn);
   block_bnd = BLOCK_FOR_INSN (BND_TO (bnd));
@@ -4979,7 +4980,7 @@ move_cond_jump (rtx insn, bnd_t bnd)
   head = BB_HEAD (block_new);
   while (bb != block_from->next_bb)
 {
-  rtx from, to;
+  rtx_insn *from, *to;
   from = bb == block_bnd ? prev : sel_bb_head (bb);
   to = bb == block_from ? next : sel_bb_end (bb);
 
-- 
1.8.5.3



[PATCH 146/236] config/rx: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/rx/rx-protos.h (rx_adjust_insn_length): Strengthen first
param from rtx to rtx_insn *.
* config/rx/rx.c (rx_adjust_insn_length): Likewise for param "insn".
---
 gcc/config/rx/rx-protos.h | 2 +-
 gcc/config/rx/rx.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h
index 189afb0..6cfa8fc 100644
--- a/gcc/config/rx/rx-protos.h
+++ b/gcc/config/rx/rx-protos.h
@@ -27,7 +27,7 @@ extern void   rx_expand_prologue (void);
 extern int rx_initial_elimination_offset (int, int);
 
 #ifdef RTX_CODE
-extern int rx_adjust_insn_length (rtx, int);
+extern int rx_adjust_insn_length (rtx_insn *, int);
 extern int rx_align_for_label (rtx, int);
 extern void rx_emit_stack_popm (rtx *, bool);
 extern void rx_emit_stack_pushm (rtx *);
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index c81b2d4..694e42d 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -3231,7 +3231,7 @@ rx_max_skip_for_label (rtx lab)
 /* Compute the real length of the extending load-and-op instructions.  */
 
 int
-rx_adjust_insn_length (rtx insn, int current_length)
+rx_adjust_insn_length (rtx_insn *insn, int current_length)
 {
   rtx extend, mem, offset;
   bool zero;
-- 
1.8.5.3



[PATCH 136/236] config/ia64/ia64.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/ia64/ia64.c (ia64_expand_tls_address): Strengthen local
"insns" from rtx to rtx_insn *.
(ia64_emit_cond_move): Likewise for locals "insn", "first".
(struct spill_fill_data): Likewise for field "init_after" and for
elements of array field "prev_insn".
(spill_restore_mem): Likewise for locals "insn", "first".
(do_spill): Likewise for local "insn".
(do_restore): Likewise.
(ia64_expand_prologue): Likewise.
(ia64_expand_epilogue): Likewise.
(emit_insn_group_barriers): Likewise for locals "insn",
"last_label".
(emit_all_insn_group_barriers): Likewise for locals "insn",
"last".
(dfa_stop_insn): Likewise for this global.
(dfa_pre_cycle_insn): Likewise.
(ia64_nop): Likewise.
(final_emit_insn_group_barriers): Likewise for locals "insn",
"last".
(emit_predicate_relation_info): Likewise for locals "head", "n",
"insn", "b", "a".
(ia64_reorg): Likewise for local "insn".
(ia64_output_mi_thunk): Likewise.
(expand_vec_perm_interleave_2): Likewise for local "seq".
---
 gcc/config/ia64/ia64.c | 63 --
 1 file changed, 35 insertions(+), 28 deletions(-)

diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 3b25f2e..1abd4ee 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -1159,7 +1159,8 @@ static rtx
 ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
 rtx orig_op1, HOST_WIDE_INT addend)
 {
-  rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp, insns;
+  rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp;
+  rtx_insn *insns;
   rtx orig_op0 = op0;
   HOST_WIDE_INT addend_lo, addend_hi;
 
@@ -1340,7 +1341,7 @@ ia64_expand_move (rtx op0, rtx op1)
 void
 ia64_emit_cond_move (rtx op0, rtx op1, rtx cond)
 {
-  rtx insn, first = get_last_insn ();
+  rtx_insn *insn, *first = get_last_insn ();
 
   emit_move_insn (op0, op1);
 
@@ -2995,11 +2996,11 @@ ia64_initial_elimination_offset (int from, int to)
 
 struct spill_fill_data
 {
-  rtx init_after;  /* point at which to emit initializations */
+  rtx_insn *init_after;/* point at which to emit 
initializations */
   rtx init_reg[2]; /* initial base register */
   rtx iter_reg[2]; /* the iterator registers */
   rtx *prev_addr[2];   /* address of last memory use */
-  rtx prev_insn[2];/* the insn corresponding to prev_addr */
+  rtx_insn *prev_insn[2];  /* the insn corresponding to prev_addr */
   HOST_WIDE_INT prev_off[2];   /* last offset */
   int n_iter;  /* number of iterators in use */
   int next_iter;   /* next iterator to use */
@@ -3087,7 +3088,8 @@ spill_restore_mem (rtx reg, HOST_WIDE_INT cfa_off)
 }
   else
 {
-  rtx seq, insn;
+  rtx seq;
+  rtx_insn *insn;
 
   if (disp == 0)
seq = gen_movdi (spill_fill_data.iter_reg[iter],
@@ -3116,7 +3118,7 @@ spill_restore_mem (rtx reg, HOST_WIDE_INT cfa_off)
insn = emit_insn_after (seq, spill_fill_data.init_after);
   else
{
- rtx first = get_insns ();
+ rtx_insn *first = get_insns ();
  if (first)
insn = emit_insn_before (seq, first);
  else
@@ -3147,7 +3149,8 @@ do_spill (rtx (*move_fn) (rtx, rtx, rtx), rtx reg, 
HOST_WIDE_INT cfa_off,
  rtx frame_reg)
 {
   int iter = spill_fill_data.next_iter;
-  rtx mem, insn;
+  rtx mem;
+  rtx_insn *insn;
 
   mem = spill_restore_mem (reg, cfa_off);
   insn = emit_insn ((*move_fn) (mem, reg, GEN_INT (cfa_off)));
@@ -3188,7 +3191,7 @@ static void
 do_restore (rtx (*move_fn) (rtx, rtx, rtx), rtx reg, HOST_WIDE_INT cfa_off)
 {
   int iter = spill_fill_data.next_iter;
-  rtx insn;
+  rtx_insn *insn;
 
   insn = emit_insn ((*move_fn) (reg, spill_restore_mem (reg, cfa_off),
GEN_INT (cfa_off)));
@@ -3443,7 +3446,8 @@ output_probe_stack_range (rtx reg1, rtx reg2)
 void
 ia64_expand_prologue (void)
 {
-  rtx insn, ar_pfs_save_reg, ar_unat_save_reg;
+  rtx_insn *insn;
+  rtx ar_pfs_save_reg, ar_unat_save_reg;
   int i, epilogue_p, regno, alt_regno, cfa_off, n_varargs;
   rtx reg, alt_reg;
 
@@ -3854,7 +3858,8 @@ ia64_start_function (FILE *file, const char *fnname,
 void
 ia64_expand_epilogue (int sibcall_p)
 {
-  rtx insn, reg, alt_reg, ar_unat_save_reg;
+  rtx_insn *insn;
+  rtx reg, alt_reg, ar_unat_save_reg;
   int regno, alt_regno, cfa_off;
 
   ia64_compute_frame_size (get_frame_size ());
@@ -6949,8 +6954,8 @@ safe_group_barrier_needed (rtx insn)
 static void
 emit_insn_group_barriers (FILE *dump)
 {
-  rtx insn;
-  rtx last_label = 0;
+  rtx_insn *insn;
+  rtx_insn *last_label = 0;
   int insns_since_last_label = 0;
 
   init_insn_group_barriers ();
@@ -7005,7 +7010,7 @@ emit_insn_group_barriers (FILE *dump)
 static void
 emit_all_insn_group_barriers (FILE 

[PATCH 117/236] stack-ptr-mod.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* stack-ptr-mod.c (pass_stack_ptr_mod::execute): Strengthen local
"insn" from rtx to rtx_insn *.
---
 gcc/stack-ptr-mod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 75bec2f..a16369f 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -84,7 +84,7 @@ unsigned int
 pass_stack_ptr_mod::execute (function *fun)
 {
   basic_block bb;
-  rtx insn;
+  rtx_insn *insn;
 
   /* Assume that the stack pointer is unchanging if alloca hasn't
  been used.  */
-- 
1.8.5.3



[PATCH 204/236] final.c: Use rtx_sequence

2014-08-06 Thread David Malcolm
gcc/
* final.c (get_attr_length_1): Replace GET_CODE check with a
dyn_cast, introducing local "seq" and the use of methods of
rtx_sequence.
(shorten_branches): Likewise, introducing local "body_seq".
Strengthen local "inner_insn" from rtx to rtx_insn *.
(reemit_insn_block_notes): Replace GET_CODE check with a
dyn_cast, strengthening local "body" from rtx to rtx_sequence *.
Use methods of rtx_sequence.
(final_scan_insn): Likewise, introducing local "seq" for when
"body" is known to be a SEQUENCE, using its methods.
---
 gcc/final.c | 35 +--
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gcc/final.c b/gcc/final.c
index ea22464..b53367d 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -406,9 +406,9 @@ get_attr_length_1 (rtx uncast_insn, int (*fallback_fn) 
(rtx))
 
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
  length = asm_insn_count (body) * fallback_fn (insn);
-   else if (GET_CODE (body) == SEQUENCE)
- for (i = 0; i < XVECLEN (body, 0); i++)
-   length += get_attr_length_1 (XVECEXP (body, 0, i), fallback_fn);
+   else if (rtx_sequence *seq = dyn_cast  (body))
+ for (i = 0; i < seq->len (); i++)
+   length += get_attr_length_1 (seq->insn (i), fallback_fn);
else
  length = fallback_fn (insn);
break;
@@ -1149,12 +1149,12 @@ shorten_branches (rtx_insn *first)
}
   else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
-  else if (GET_CODE (body) == SEQUENCE)
+  else if (rtx_sequence *body_seq = dyn_cast  (body))
{
  int i;
  int const_delay_slots;
 #ifdef DELAY_SLOTS
- const_delay_slots = const_num_delay_slots (XVECEXP (body, 0, 0));
+ const_delay_slots = const_num_delay_slots (body_seq->insn (0));
 #else
  const_delay_slots = 0;
 #endif
@@ -1163,14 +1163,14 @@ shorten_branches (rtx_insn *first)
  /* Inside a delay slot sequence, we do not do any branch shortening
 if the shortening could change the number of delay slots
 of the branch.  */
- for (i = 0; i < XVECLEN (body, 0); i++)
+ for (i = 0; i < body_seq->len (); i++)
{
- rtx inner_insn = XVECEXP (body, 0, i);
+ rtx_insn *inner_insn = body_seq->insn (i);
  int inner_uid = INSN_UID (inner_insn);
  int inner_length;
 
  if (GET_CODE (body) == ASM_INPUT
- || asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0)
+ || asm_noperands (PATTERN (inner_insn)) >= 0)
inner_length = (asm_insn_count (PATTERN (inner_insn))
* insn_default_length (inner_insn));
  else
@@ -1685,15 +1685,14 @@ reemit_insn_block_notes (void)
   this_block = insn_scope (insn);
   /* For sequences compute scope resulting from merging all scopes
 of instructions nested inside.  */
-  if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+  if (rtx_sequence *body = dyn_cast  (PATTERN (insn)))
{
  int i;
- rtx body = PATTERN (insn);
 
  this_block = NULL;
- for (i = 0; i < XVECLEN (body, 0); i++)
+ for (i = 0; i < body->len (); i++)
this_block = choose_inner_scope (this_block,
-insn_scope (XVECEXP (body, 0, i)));
+insn_scope (body->insn (i)));
}
   if (! this_block)
{
@@ -2614,7 +2613,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
 
app_disable ();
 
-   if (GET_CODE (body) == SEQUENCE)
+   if (rtx_sequence *seq = dyn_cast  (body))
  {
/* A delayed-branch sequence */
int i;
@@ -2626,16 +2625,16 @@ final_scan_insn (rtx uncast_insn, FILE *file, int 
optimize_p ATTRIBUTE_UNUSED,
   thought unnecessary.  If that happens, cancel this sequence
   and cause that insn to be restored.  */
 
-   next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, 1, seen);
-   if (next != XVECEXP (body, 0, 1))
+   next = final_scan_insn (seq->insn (0), file, 0, 1, seen);
+   if (next != seq->insn (1))
  {
final_sequence = 0;
return next;
  }
 
-   for (i = 1; i < XVECLEN (body, 0); i++)
+   for (i = 1; i < seq->len (); i++)
  {
-   rtx insn = XVECEXP (body, 0, i);
+   rtx_insn *insn = seq->insn (i);
rtx_insn *next = NEXT_INSN (insn);
/* We loop in case any instruction in a delay slot gets
   split.  */
@@ -2653,7 +2652,7 @@ final_scan_insn (rtx uncast_insn, FI

[PATCH 036/236] get_last_bb_insn returns an rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* basic-block.h (get_last_bb_insn): Strengthen return type from
rtx to rtx_insn *.
* cfgrtl.c (get_last_bb_insn): Likewise, and for locals "tmp" and
end".
---
 gcc/basic-block.h | 2 +-
 gcc/cfgrtl.c  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 03dbdbc..2eb6553 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -828,7 +828,7 @@ extern bool delete_unreachable_blocks (void);
 extern void update_br_prob_note (basic_block);
 extern bool inside_basic_block_p (const_rtx);
 extern bool control_flow_insn_p (const_rtx);
-extern rtx get_last_bb_insn (basic_block);
+extern rtx_insn *get_last_bb_insn (basic_block);
 
 /* In dominance.c */
 
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5611ab8..e3bad95 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2238,12 +2238,12 @@ update_br_prob_note (basic_block bb)
 
 /* Get the last insn associated with block BB (that includes barriers and
tablejumps after BB).  */
-rtx
+rtx_insn *
 get_last_bb_insn (basic_block bb)
 {
   rtx_jump_table_data *table;
-  rtx tmp;
-  rtx end = BB_END (bb);
+  rtx_insn *tmp;
+  rtx_insn *end = BB_END (bb);
 
   /* Include any jump table following the basic block.  */
   if (tablejump_p (end, NULL, &table))
-- 
1.8.5.3



[PATCH 010/236] Split NEXT_INSN/PREV_INSN into lvalue and rvalue forms

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (PREV_INSN): Split macro in two: the existing one,
for rvalues, and...
(SET_PREV_INSN): New macro, for use as an lvalue.
(NEXT_INSN, SET_NEXT_INSN): Likewise.

* caller-save.c (save_call_clobbered_regs): Convert lvalue use of
PREV_INSN/NEXT_INSN into SET_PREV_INSN/SET_NEXT_INSN.
* cfgrtl.c (try_redirect_by_replacing_jump): Likewise.
(fixup_abnormal_edges): Likewise.
(unlink_insn_chain): Likewise.
(fixup_reorder_chain): Likewise.
(cfg_layout_delete_block): Likewise.
(cfg_layout_merge_blocks): Likewise.
* combine.c (update_cfg_for_uncondjump): Likewise.
* emit-rtl.c (link_insn_into_chain): Likewise.
(remove_insn): Likewise.
(delete_insns_since): Likewise.
(reorder_insns_nobb): Likewise.
(emit_insn_after_1): Likewise.
* final.c (rest_of_clean_state): Likewise.
(final_scan_insn): Likewise.
* gcse.c (can_assign_to_reg_without_clobbers_p): Likewise.
* haifa-sched.c (concat_note_lists): Likewise.
(remove_notes): Likewise.
(restore_other_notes): Likewise.
(move_insn): Likewise.
(unlink_bb_notes): Likewise.
(restore_bb_notes): Likewise.
* jump.c (delete_for_peephole): Likewise.
* optabs.c (emit_libcall_block_1): Likewise.
* reorg.c (emit_delay_sequence): Likewise.
(fill_simple_delay_slots): Likewise.
* sel-sched-ir.c (sel_move_insn): Likewise.
(sel_remove_insn): Likewise.
(get_bb_note_from_pool): Likewise.
* sel-sched.c (move_nop_to_previous_block): Likewise.

* config/bfin/bfin.c (reorder_var_tracking_notes): Likewise.
* config/c6x/c6x.c (gen_one_bundle): Likewise.
(c6x_gen_bundles): Likewise.
(hwloop_optimize): Likewise.
* config/frv/frv.c (frv_function_prologue): Likewise.
(frv_register_nop): Likewise.
* config/ia64/ia64.c (ia64_init_dfa_pre_cycle_insn): Likewise.
(ia64_reorg): Likewise.
* config/mep/mep.c (mep_reorg_addcombine): Likewise.
(mep_make_bundle): Likewise.
(mep_bundle_insns): Likewise.
* config/picochip/picochip.c (reorder_var_tracking_notes): Likewise.
* config/tilegx/tilegx.c (reorder_var_tracking_notes): Likewise.
* config/tilepro/tilepro.c (reorder_var_tracking_notes): Likewise.

/
* rtx-classes-status.txt: Add SET_NEXT_INSN, SET_PREV_INSN
---
 gcc/caller-save.c  | 12 +++
 gcc/cfgrtl.c   | 76 +-
 gcc/combine.c  |  4 +--
 gcc/config/bfin/bfin.c | 14 
 gcc/config/c6x/c6x.c   | 42 +++
 gcc/config/frv/frv.c   | 16 -
 gcc/config/ia64/ia64.c |  6 ++--
 gcc/config/mep/mep.c   | 36 ++--
 gcc/config/picochip/picochip.c | 22 ++--
 gcc/config/tilegx/tilegx.c | 14 
 gcc/config/tilepro/tilepro.c   | 14 
 gcc/emit-rtl.c | 48 +-
 gcc/final.c| 16 -
 gcc/gcse.c |  2 +-
 gcc/haifa-sched.c  | 40 +++---
 gcc/jump.c |  4 +--
 gcc/optabs.c   |  4 +--
 gcc/reorg.c|  8 ++---
 gcc/rtl.h  | 11 --
 gcc/sel-sched-ir.c | 16 -
 gcc/sel-sched.c| 12 +++
 rtx-classes-status.txt |  1 +
 22 files changed, 213 insertions(+), 205 deletions(-)

diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 41b3f01..b1ef3a9 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -913,13 +913,13 @@ save_call_clobbered_regs (void)
  prev = PREV_INSN (ins);
  if (NOTE_P (ins))
{
- NEXT_INSN (prev) = NEXT_INSN (ins);
- PREV_INSN (NEXT_INSN (ins)) = prev;
- PREV_INSN (ins) = insn;
- NEXT_INSN (ins) = NEXT_INSN (insn);
- NEXT_INSN (insn) = ins;
+ SET_NEXT_INSN (prev) = NEXT_INSN (ins);
+ SET_PREV_INSN (NEXT_INSN (ins)) = prev;
+ SET_PREV_INSN (ins) = insn;
+ SET_NEXT_INSN (ins) = NEXT_INSN (insn);
+ SET_NEXT_INSN (insn) = ins;
  if (NEXT_INSN (ins))
-   PREV_INSN (NEXT_INSN (ins)) = ins;
+   SET_PREV_INSN (NEXT_INSN (ins)) = ins;
   if (BB_END (bb) == insn)
SET_BB_END (bb) = ins;
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5f2879e..d386367 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1061,11 +1061,11 @@ try_redirect_by_replacing_jump (edge e, basic_block 
target, bool in_cfglayout)
  if (BARRIER_P (insn))
 

[PATCH 234/236] Strengthen params to active_insn_between

2014-08-06 Thread David Malcolm
gcc/
* shrink-wrap.h (active_insn_between): Strengthen both params from
rtx to rtx_insn *.
* function.c (active_insn_between): Likewise.
---
 gcc/function.c| 3 +--
 gcc/shrink-wrap.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/function.c b/gcc/function.c
index 782d5be..9eee7668 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5396,9 +5396,8 @@ set_return_jump_label (rtx returnjump)
 #if defined (HAVE_return) || defined (HAVE_simple_return)
 /* Return true if there are any active insns between HEAD and TAIL.  */
 bool
-active_insn_between (rtx head, rtx uncast_tail)
+active_insn_between (rtx_insn *head, rtx_insn *tail)
 {
-  rtx_insn *tail = as_a_nullable  (uncast_tail);
   while (tail)
 {
   if (active_insn_p (tail))
diff --git a/gcc/shrink-wrap.h b/gcc/shrink-wrap.h
index 647c076..29bdcfd 100644
--- a/gcc/shrink-wrap.h
+++ b/gcc/shrink-wrap.h
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifdef HAVE_simple_return
 /* In function.c.  */
 extern void emit_return_into_block (bool simple_p, basic_block bb);
-extern bool active_insn_between (rtx head, rtx tail);
+extern bool active_insn_between (rtx_insn *head, rtx_insn *tail);
 extern vec convert_jumps_to_returns (basic_block last_bb, bool simple_p,
   vec unconverted);
 extern basic_block emit_return_for_exit (edge exit_fallthru_edge,
-- 
1.8.5.3



[PATCH 124/236] PHASE 3: Per-config subdir commits

2014-08-06 Thread David Malcolm
/
* rtx-classes-status.txt: Update
---
 rtx-classes-status.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index e350eaf..b22cb1e 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -2,8 +2,8 @@
 exists to be modified by marker commits.
 
 Phase 1: initial "scaffolding" commits:DONE
-Phase 2: per-file commits in main source dir:  IN PROGRESS
-Phase 3: per-file commits within "config" subdirs: TODO
+Phase 2: per-file commits in main source dir:  DONE
+Phase 3: per-file commits within "config" subdirs: IN PROGRESS
 Phase 4: removal of "scaffolding": TODO
 Phase 5: additional rtx_def subclasses:TODO
 Phase 6: use extra rtx_def subclasses: TODO
-- 
1.8.5.3



[PATCH 207/236] reorg.c: Use rtx_sequence

2014-08-06 Thread David Malcolm
gcc/
* reorg.c (redundant_insn): In two places in the function, replace
a check of GET_CODE with a dyn_cast, introducing local "seq", and
usings methods of rtx_sequence to clarify the code.
---
 gcc/reorg.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/reorg.c b/gcc/reorg.c
index 75819bc..3894863 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1526,11 +1526,11 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
   if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
continue;
 
-  if (GET_CODE (pat) == SEQUENCE)
+  if (rtx_sequence *seq = dyn_cast  (pat))
{
  /* Stop for a CALL and its delay slots because it is difficult to
 track its resource needs correctly.  */
- if (CALL_P (XVECEXP (pat, 0, 0)))
+ if (CALL_P (seq->element (0)))
return 0;
 
  /* Stop for an INSN or JUMP_INSN with delayed effects and its delay
@@ -1538,21 +1538,21 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
 correctly.  */
 
 #ifdef INSN_SETS_ARE_DELAYED
- if (INSN_SETS_ARE_DELAYED (XVECEXP (pat, 0, 0)))
+ if (INSN_SETS_ARE_DELAYED (seq->element (0)))
return 0;
 #endif
 
 #ifdef INSN_REFERENCES_ARE_DELAYED
- if (INSN_REFERENCES_ARE_DELAYED (XVECEXP (pat, 0, 0)))
+ if (INSN_REFERENCES_ARE_DELAYED (seq->element (0)))
return 0;
 #endif
 
  /* See if any of the insns in the delay slot match, updating
 resource requirements as we go.  */
- for (i = XVECLEN (pat, 0) - 1; i > 0; i--)
-   if (GET_CODE (XVECEXP (pat, 0, i)) == GET_CODE (insn)
-   && rtx_equal_p (PATTERN (XVECEXP (pat, 0, i)), ipat)
-   && ! find_reg_note (XVECEXP (pat, 0, i), REG_UNUSED, NULL_RTX))
+ for (i = seq->len () - 1; i > 0; i--)
+   if (GET_CODE (seq->element (i)) == GET_CODE (insn)
+   && rtx_equal_p (PATTERN (seq->element (i)), ipat)
+   && ! find_reg_note (seq->element (i), REG_UNUSED, NULL_RTX))
  break;
 
  /* If found a match, exit this loop early.  */
@@ -1628,10 +1628,10 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
   if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
continue;
 
-  if (GET_CODE (pat) == SEQUENCE)
+  if (rtx_sequence *seq = dyn_cast  (pat))
{
  bool annul_p = false;
-  rtx control = XVECEXP (pat, 0, 0);
+  rtx control = seq->element (0);
 
  /* If this is a CALL_INSN and its delay slots, it is hard to track
 the resource needs properly, so give up.  */
@@ -1656,9 +1656,9 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
 
  /* See if any of the insns in the delay slot match, updating
 resource requirements as we go.  */
- for (i = XVECLEN (pat, 0) - 1; i > 0; i--)
+ for (i = seq->len () - 1; i > 0; i--)
{
- rtx candidate = XVECEXP (pat, 0, i);
+ rtx candidate = seq->element (i);
 
  /* If an insn will be annulled if the branch is false, it isn't
 considered as a possible duplicate insn.  */
-- 
1.8.5.3



[PATCH 023/236] delete_trivially_dead_insns works on insns

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (delete_trivially_dead_insns): Strengthen initial param
"insns" from rtx to rtx_insn *.
* cse.c (delete_trivially_dead_insns): Likewise, also do it for
locals "insn" and "prev".
---
 gcc/cse.c | 4 ++--
 gcc/rtl.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/cse.c b/gcc/cse.c
index 3ca8e17..6473c3e 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6940,10 +6940,10 @@ replace_dead_reg (rtx x, const_rtx old_rtx 
ATTRIBUTE_UNUSED, void *data)
remaining passes of the compilation are also sped up.  */
 
 int
-delete_trivially_dead_insns (rtx insns, int nreg)
+delete_trivially_dead_insns (rtx_insn *insns, int nreg)
 {
   int *counts;
-  rtx insn, prev;
+  rtx_insn *insn, *prev;
   rtx *replacements = NULL;
   int ndead = 0;
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 739a550..e29cda3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2992,7 +2992,7 @@ extern int cse_not_expected;
 extern int rtx_to_tree_code (enum rtx_code);
 
 /* In cse.c */
-extern int delete_trivially_dead_insns (rtx, int);
+extern int delete_trivially_dead_insns (rtx_insn *, int);
 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
 
-- 
1.8.5.3



[PATCH 195/236] Convert PATTERN from a macro to a pair of inline functions

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (PATTERN): Convert this macro into a pair of inline
functions, for now, requiring const_rtx and rtx.
---
 gcc/rtl.h | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 79cca1b..640616f 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1226,7 +1226,15 @@ inline rtx& SET_NEXT_INSN (rtx insn)
 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
 
 /* The body of an insn.  */
-#define PATTERN(INSN)  XEXP (INSN, 3)
+inline rtx PATTERN (const_rtx insn)
+{
+  return XEXP (insn, 3);
+}
+
+inline rtx& PATTERN (rtx insn)
+{
+  return XEXP (insn, 3);
+}
 
 #define INSN_LOCATION(INSN) XUINT (INSN, 4)
 
-- 
1.8.5.3



[PATCH 029/236] rtl_data.x_parm_birth_insn is an insn

2014-08-06 Thread David Malcolm
gcc/
* function.h (struct rtl_data): Strengthen field
"x_parm_birth_insn" from rtx to rtx_insn *.
* function.c (struct assign_parm_data_all): Strengthen fields
"first_conversion_insn" and "last_conversion_insn" from rtx to
rtx_insn *.
---
 gcc/function.c | 4 ++--
 gcc/function.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/function.c b/gcc/function.c
index ec2ea26..4d8d32d 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -2181,8 +2181,8 @@ struct assign_parm_data_all
   struct args_size stack_args_size;
   tree function_result_decl;
   tree orig_fnargs;
-  rtx first_conversion_insn;
-  rtx last_conversion_insn;
+  rtx_insn *first_conversion_insn;
+  rtx_insn *last_conversion_insn;
   HOST_WIDE_INT pretend_args_size;
   HOST_WIDE_INT extra_pretend_bytes;
   int reg_parm_stack_space;
diff --git a/gcc/function.h b/gcc/function.h
index a8294b2..0367225 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -303,7 +303,7 @@ struct GTY(()) rtl_data {
   HOST_WIDE_INT x_frame_offset;
 
   /* Insn after which register parms and SAVE_EXPRs are born, if nonopt.  */
-  rtx x_parm_birth_insn;
+  rtx_insn *x_parm_birth_insn;
 
   /* List of all used temporaries allocated, by level.  */
   vec *x_used_temp_slots;
-- 
1.8.5.3



[PATCH 045/236] define_bypass guard functions take a pair of rtx_insn

2014-08-06 Thread David Malcolm
(define_bypass) clauses in .md files can specify the name of a guard
function as their final operand.  Currently these functions are called
with a pair of rtx.  This patch strengthens insn-automata.c so that such
guard functions are passed a pair of rtx_insn *, allowing these guard
functions to be similarly strengthened in the per-target phase of this
patch kit.

gcc/
* genautomata.c (output_internal_insn_latency_func): When writing
the function "internal_insn_latency" to insn-automata.c,
strengthen params "insn" and "insn2" from rtx to rtx_insn *, thus
allowing the optional guard function of (define_bypass) clauses to
expect a pair of rtx_insn *, rather than a pair of rtx.
(output_insn_latency_func): When writing the function
"insn_latency", add an "uncast_" prefix to params "insn" and
"insn2", reintroducing "insn" and "insn2" as rtx_insn * locals
using checked casts from the params, thus enabling the above
change to the generated "internal_insn_latency" function.
---
 gcc/genautomata.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 0c61278..3017e20 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -8360,7 +8360,7 @@ output_internal_insn_latency_func (void)
   decl_t decl;
   struct bypass_decl *bypass;
 
-  fprintf (output_file, "static int\n%s (int %s ATTRIBUTE_UNUSED,\n\tint %s 
ATTRIBUTE_UNUSED,\n\trtx %s ATTRIBUTE_UNUSED,\n\trtx %s ATTRIBUTE_UNUSED)\n",
+  fprintf (output_file, "static int\n%s (int %s ATTRIBUTE_UNUSED,\n\tint %s 
ATTRIBUTE_UNUSED,\n\trtx_insn *%s ATTRIBUTE_UNUSED,\n\trtx_insn *%s 
ATTRIBUTE_UNUSED)\n",
   INTERNAL_INSN_LATENCY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
   INTERNAL_INSN2_CODE_NAME, INSN_PARAMETER_NAME,
   INSN2_PARAMETER_NAME);
@@ -8477,10 +8477,16 @@ output_internal_maximal_insn_latency_func (void)
 static void
 output_insn_latency_func (void)
 {
-  fprintf (output_file, "int\n%s (rtx %s, rtx %s)\n",
+  fprintf (output_file, "int\n%s (rtx uncast_%s, rtx uncast_%s)\n",
   INSN_LATENCY_FUNC_NAME, INSN_PARAMETER_NAME, INSN2_PARAMETER_NAME);
   fprintf (output_file, "{\n  int %s, %s;\n",
   INTERNAL_INSN_CODE_NAME, INTERNAL_INSN2_CODE_NAME);
+  fprintf (output_file,
+  "  rtx_insn *%s = as_a_nullable  (uncast_%s);\n",
+  INSN_PARAMETER_NAME, INSN_PARAMETER_NAME);
+  fprintf (output_file,
+  "  rtx_insn *%s = as_a_nullable  (uncast_%s);\n",
+  INSN2_PARAMETER_NAME, INSN2_PARAMETER_NAME);
   output_internal_insn_code_evaluation (INSN_PARAMETER_NAME,
INTERNAL_INSN_CODE_NAME, 0);
   output_internal_insn_code_evaluation (INSN2_PARAMETER_NAME,
-- 
1.8.5.3



[PATCH 211/236] Introduce rtx_expr_list subclass of rtx_def

2014-08-06 Thread David Malcolm
gcc/
* coretypes.h (class rtx_expr_list): Add forward declaration.
* emit-rtl.c (gen_rtx_EXPR_LIST): New.
* gengenrtl.c (special_rtx): Add EXPR_LIST.
* rtl.h (class rtx_expr_list): New subclass of rtx_def, adding
invariant: GET_CODE (X) == EXPR_LIST.
(is_a_helper ::test): New.
(rtx_expr_list::next): New.
(rtx_expr_list::element): New.
(gen_rtx_EXPR_LIST): New.
---
 gcc/coretypes.h |  1 +
 gcc/emit-rtl.c  |  7 +++
 gcc/gengenrtl.c |  3 ++-
 gcc/rtl.h   | 36 
 4 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 02cac5a..5ba83b1 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -60,6 +60,7 @@ typedef const struct rtx_def *const_rtx;
hierarchy, along with the relevant invariant.
Where possible, keep this list in the same order as in rtl.def.  */
 class rtx_def;
+  class rtx_expr_list;   /* GET_CODE (X) == EXPR_LIST */
   class rtx_insn_list;   /* GET_CODE (X) == INSN_LIST */
   class rtx_sequence;/* GET_CODE (X) == SEQUENCE */
   class rtx_insn;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index fef4faa..5d946b8 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -404,6 +404,13 @@ gen_raw_REG (enum machine_mode mode, int regno)
functions do the raw handling.  If you add to this list, modify
special_rtx in gengenrtl.c as well.  */
 
+rtx_expr_list *
+gen_rtx_EXPR_LIST (enum machine_mode mode, rtx expr, rtx expr_list)
+{
+  return as_a  (gen_rtx_fmt_ee (EXPR_LIST, mode, expr,
+expr_list));
+}
+
 rtx_insn_list *
 gen_rtx_INSN_LIST (enum machine_mode mode, rtx insn, rtx insn_list)
 {
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index cd29341..885dd20 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -123,7 +123,8 @@ special_format (const char *fmt)
 static int
 special_rtx (int idx)
 {
-  return (strcmp (defs[idx].enumname, "INSN_LIST") == 0
+  return (strcmp (defs[idx].enumname, "EXPR_LIST") == 0
+ || strcmp (defs[idx].enumname, "INSN_LIST") == 0
  || strcmp (defs[idx].enumname, "CONST_INT") == 0
  || strcmp (defs[idx].enumname, "REG") == 0
  || strcmp (defs[idx].enumname, "SUBREG") == 0
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ed736cc..6fe89ec 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -402,6 +402,28 @@ struct GTY((desc("0"), tag("0"),
   } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
 };
 
+/* A node for constructing singly-linked lists of rtx.  */
+
+class GTY(()) rtx_expr_list : public rtx_def
+{
+  /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST).  */
+
+public:
+  /* Get next in list.  */
+  rtx_expr_list *next () const;
+
+  /* Get at the underlying rtx.  */
+  rtx element () const;
+};
+
+template <>
+template <>
+inline bool
+is_a_helper ::test (rtx rt)
+{
+  return rt->code == EXPR_LIST;
+}
+
 class GTY(()) rtx_insn_list : public rtx_def
 {
   /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST).
@@ -1252,6 +1274,19 @@ extern void rtl_check_failed_flag (const char *, 
const_rtx, const char *,
 #define XC2EXP(RTX, N, C1, C2)  (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx)
 
 
+/* Methods of rtx_expr_list.  */
+
+inline rtx_expr_list *rtx_expr_list::next () const
+{
+  rtx tmp = XEXP (this, 1);
+  return as_a_nullable  (tmp);
+}
+
+inline rtx rtx_expr_list::element () const
+{
+  return XEXP (this, 0);
+}
+
 /* Methods of rtx_insn_list.  */
 
 inline rtx_insn_list *rtx_insn_list::next () const
@@ -3021,6 +3056,7 @@ get_mem_attrs (const_rtx x)
generation functions included above do the raw handling.  If you
add to this list, modify special_rtx in gengenrtl.c as well.  */
 
+extern rtx_expr_list *gen_rtx_EXPR_LIST (enum machine_mode, rtx, rtx);
 extern rtx_insn_list *gen_rtx_INSN_LIST (enum machine_mode, rtx, rtx);
 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
-- 
1.8.5.3



[PATCH 088/236] loop-invariant.c: Use rtx_insn in various places

2014-08-06 Thread David Malcolm
gcc/
* loop-invariant.c (struct use): Strengthen field "insn" from rtx
to rtx_insn *.
(struct invariant): Likewise.
(hash_invariant_expr_1): Likewise for param "insn".
(invariant_expr_equal_p): Likewise for param "insn1", "insn2".
(find_exits): Likewise for local "insn".
(create_new_invariant): Likewise for param "insn".
(check_dependencies): Likewise.
(find_invariant_insn): Likewise.
(record_uses): Likewise.
(find_invariants_insn): Likewise.
(find_invariants_bb): Likewise for local "insn".
(get_pressure_class_and_nregs): Likewise for param "insn".
(calculate_loop_reg_pressure): Likewise for local "insn".
---
 gcc/loop-invariant.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 100a2c1..5592cd4 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -78,7 +78,7 @@ struct loop_data
 struct use
 {
   rtx *pos;/* Position of the use.  */
-  rtx insn;/* The insn in that the use occurs.  */
+  rtx_insn *insn;  /* The insn in that the use occurs.  */
   unsigned addr_use_p; /* Whether the use occurs in an address.  */
   struct use *next;/* Next use in the list.  */
 };
@@ -116,7 +116,7 @@ struct invariant
   struct def *def;
 
   /* The insn in that it is defined.  */
-  rtx insn;
+  rtx_insn *insn;
 
   /* Whether it is always executed.  */
   bool always_executed;
@@ -286,7 +286,7 @@ invariant_for_use (df_ref use)
 /* Computes hash value for invariant expression X in INSN.  */
 
 static hashval_t
-hash_invariant_expr_1 (rtx insn, rtx x)
+hash_invariant_expr_1 (rtx_insn *insn, rtx x)
 {
   enum rtx_code code = GET_CODE (x);
   int i, j;
@@ -340,7 +340,7 @@ hash_invariant_expr_1 (rtx insn, rtx x)
and INSN2 have always the same value.  */
 
 static bool
-invariant_expr_equal_p (rtx insn1, rtx e1, rtx insn2, rtx e2)
+invariant_expr_equal_p (rtx_insn *insn1, rtx e1, rtx_insn *insn2, rtx e2)
 {
   enum rtx_code code = GET_CODE (e1);
   int i, j;
@@ -572,7 +572,7 @@ find_exits (struct loop *loop, basic_block *body,
   edge e;
   struct loop *outermost_exit = loop, *aexit;
   bool has_call = false;
-  rtx insn;
+  rtx_insn *insn;
 
   for (i = 0; i < loop->num_nodes; i++)
 {
@@ -683,7 +683,7 @@ find_defs (struct loop *loop)
is returned.  */
 
 static struct invariant *
-create_new_invariant (struct def *def, rtx insn, bitmap depends_on,
+create_new_invariant (struct def *def, rtx_insn *insn, bitmap depends_on,
  bool always_executed)
 {
   struct invariant *inv = XNEW (struct invariant);
@@ -823,7 +823,7 @@ check_dependency (basic_block bb, df_ref use, bitmap 
depends_on)
loop invariants, false otherwise.  */
 
 static bool
-check_dependencies (rtx insn, bitmap depends_on)
+check_dependencies (rtx_insn *insn, bitmap depends_on)
 {
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
   df_ref *use_rec;
@@ -844,7 +844,7 @@ check_dependencies (rtx insn, bitmap depends_on)
unless the program ends due to a function call.  */
 
 static void
-find_invariant_insn (rtx insn, bool always_reached, bool always_executed)
+find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed)
 {
   df_ref ref;
   struct def *def;
@@ -906,7 +906,7 @@ find_invariant_insn (rtx insn, bool always_reached, bool 
always_executed)
 /* Record registers used in INSN that have a unique invariant definition.  */
 
 static void
-record_uses (rtx insn)
+record_uses (rtx_insn *insn)
 {
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
   df_ref *use_rec;
@@ -933,7 +933,7 @@ record_uses (rtx insn)
unless the program ends due to a function call.  */
 
 static void
-find_invariants_insn (rtx insn, bool always_reached, bool always_executed)
+find_invariants_insn (rtx_insn *insn, bool always_reached, bool 
always_executed)
 {
   find_invariant_insn (insn, always_reached, always_executed);
   record_uses (insn);
@@ -947,7 +947,7 @@ find_invariants_insn (rtx insn, bool always_reached, bool 
always_executed)
 static void
 find_invariants_bb (basic_block bb, bool always_reached, bool always_executed)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   FOR_BB_INSNS (bb, insn)
 {
@@ -1024,7 +1024,7 @@ free_use_list (struct use *use)
 /* Return pressure class and number of hard registers (through *NREGS)
for destination of INSN. */
 static enum reg_class
-get_pressure_class_and_nregs (rtx insn, int *nregs)
+get_pressure_class_and_nregs (rtx_insn *insn, int *nregs)
 {
   rtx reg;
   enum reg_class pressure_class;
@@ -1804,7 +1804,8 @@ calculate_loop_reg_pressure (void)
   unsigned int j;
   bitmap_iterator bi;
   basic_block bb;
-  rtx insn, link;
+  rtx_insn *insn;
+  rtx link;
   struct loop *loop, *parent;
 
   FOR_EACH_LOOP (loop, 0)
-- 
1.8.5.3



[PATCH 179/236] cselib_record_sets_hook takes an rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* cselib.h (cselib_record_sets_hook):  Strengthen initial param
"insn" from rtx to rtx_insn *.

* cselib.c (cselib_record_sets_hook): Likewise.

* var-tracking.c (add_with_sets): Likewise, renaming back from
"uncast_insn" to "insn" and eliminating the checked cast from rtx
to rtx_insn *.
---
 gcc/cselib.c   | 2 +-
 gcc/cselib.h   | 2 +-
 gcc/var-tracking.c | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/cselib.c b/gcc/cselib.c
index c453904..f500d8a 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -258,7 +258,7 @@ void (*cselib_discard_hook) (cselib_val *);
represented in the array sets[n_sets].  new_val_min can be used to
tell whether values present in sets are introduced by this
instruction.  */
-void (*cselib_record_sets_hook) (rtx insn, struct cselib_set *sets,
+void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets,
 int n_sets);
 
 #define PRESERVED_VALUE_P(RTX) \
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 62374c0..67ce6da 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -65,7 +65,7 @@ enum cselib_record_what
 };
 
 extern void (*cselib_discard_hook) (cselib_val *);
-extern void (*cselib_record_sets_hook) (rtx insn, struct cselib_set *sets,
+extern void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set 
*sets,
int n_sets);
 
 extern cselib_val *cselib_lookup (rtx, enum machine_mode,
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 4d30650..8f04110 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -6464,9 +6464,8 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn)
first place, in which case sets and n_sets will be 0).  */
 
 static void
-add_with_sets (rtx uncast_insn, struct cselib_set *sets, int n_sets)
+add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets)
 {
-  rtx_insn *insn = as_a  (uncast_insn);
   basic_block bb = BLOCK_FOR_INSN (insn);
   int n1, n2;
   struct count_use_info cui;
-- 
1.8.5.3



[PATCH 128/236] config/arm: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* config/arm/arm-protos.h (arm_final_prescan_insn): Likewise for param.
(thumb1_final_prescan_insn): Likewise.
(thumb2_final_prescan_insn): Likewise.

* config/arm/arm.c (emit_set_insn): Strengthen return type from
rtx to rtx_insn *.
(struct minipool_node): Likewise for field "insn".
(dump_minipool): Likewise for param "scan".
(create_fix_barrier): Likewise for local "from".  Strengthen local
"label" from rtx to rtx_code_label *.
(push_minipool_barrier): Strengthen param "insn" from rtx to
rtx_insn *.
(push_minipool_fix): Likewise.
(note_invalid_constants): Likewise.
(thumb2_reorg): Likewise for local "insn".
(arm_reorg): Likewise.
(thumb2_final_prescan_insn): Likewise for param
"insn" and local "first_insn".
(arm_final_prescan_insn): Likewise for param "insn" and locals
"start_insn", "this_insn".
(arm_debugger_arg_offset): Likewise for param "insn".
(thumb1_emit_multi_reg_push): Likewise for return type and local
"insn".
(thumb1_final_prescan_insn): Likewise for param "insn".
(thumb_far_jump_used_p): Likewise for local "insn".
(thumb1_expand_prologue): Likewise.
(arm_expand_epilogue_apcs_frame): Likewise.
(arm_expand_epilogue): Likewise for locals "insn", "tmp".
(arm_split_compare_and_swap): Strengthen locals "label1", "label2"
from rtx to rtx_code_label *.
(arm_split_atomic_op): Likewise for local "label".
(arm_emit_coreregs_64bit_shift): Likewise for local "done_label".
---
 gcc/config/arm/arm-protos.h |  6 +--
 gcc/config/arm/arm.c| 91 -
 2 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 74645ee..a5a16fe 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -143,7 +143,7 @@ extern const char *arithmetic_instr (rtx, int);
 extern void output_ascii_pseudo_op (FILE *, const unsigned char *, int);
 extern const char *output_return_instruction (rtx, bool, bool, bool);
 extern void arm_poke_function_name (FILE *, const char *);
-extern void arm_final_prescan_insn (rtx);
+extern void arm_final_prescan_insn (rtx_insn *);
 extern int arm_debugger_arg_offset (int, rtx);
 extern bool arm_is_long_call_p (tree);
 extern intarm_emit_vector_const (FILE *, rtx);
@@ -184,8 +184,8 @@ extern int is_called_in_ARM_mode (tree);
 extern int thumb_shiftable_const (unsigned HOST_WIDE_INT);
 #ifdef RTX_CODE
 extern enum arm_cond_code maybe_get_arm_condition_code (rtx);
-extern void thumb1_final_prescan_insn (rtx);
-extern void thumb2_final_prescan_insn (rtx);
+extern void thumb1_final_prescan_insn (rtx_insn *);
+extern void thumb2_final_prescan_insn (rtx_insn *);
 extern const char *thumb_load_double_from_address (rtx *);
 extern const char *thumb_output_move_mem_multiple (int, rtx *);
 extern const char *thumb_call_via_reg (rtx);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6535d21..646c479 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -113,14 +113,14 @@ static Mnode *move_minipool_fix_backward_ref (Mnode *, 
Mnode *, HOST_WIDE_INT);
 static Mnode *add_minipool_backward_ref (Mfix *);
 static void assign_minipool_offsets (Mfix *);
 static void arm_print_value (FILE *, rtx);
-static void dump_minipool (rtx);
+static void dump_minipool (rtx_insn *);
 static int arm_barrier_cost (rtx);
 static Mfix *create_fix_barrier (Mfix *, HOST_WIDE_INT);
-static void push_minipool_barrier (rtx, HOST_WIDE_INT);
-static void push_minipool_fix (rtx, HOST_WIDE_INT, rtx *, enum machine_mode,
-  rtx);
+static void push_minipool_barrier (rtx_insn *, HOST_WIDE_INT);
+static void push_minipool_fix (rtx_insn *, HOST_WIDE_INT, rtx *,
+  enum machine_mode, rtx);
 static void arm_reorg (void);
-static void note_invalid_constants (rtx, HOST_WIDE_INT, int);
+static void note_invalid_constants (rtx_insn *, HOST_WIDE_INT, int);
 static unsigned long arm_compute_save_reg0_reg12_mask (void);
 static unsigned long arm_compute_save_reg_mask (void);
 static unsigned long arm_isr_value (tree);
@@ -178,7 +178,7 @@ static rtx arm_expand_unop_builtin (enum insn_code, tree, 
rtx, int);
 static rtx arm_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 static tree arm_builtin_decl (unsigned, bool);
 static void emit_constant_insn (rtx cond, rtx pattern);
-static rtx emit_set_insn (rtx, rtx);
+static rtx_insn *emit_set_insn (rtx, rtx);
 static rtx emit_multi_reg_push (unsigned long, unsigned long);
 static int arm_arg_partial_bytes (cumulative_args_t, enum machine_mode,
  tree, bool);
@@ -1966,7 +1966,7 @@ arm_constant_limit (bool size_p)
 
 /* Emit an insn that's a simple single-set.  Both the operands must be known
to be valid.  */

[PATCH 015/236] BB_NOTE_LIST scaffolding

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.h (BB_NOTE_LIST): struct sel_region_bb_info_def's
"note_list" field will eventually be an rtx_insn *.  To help with
transition, for now, convert from an access macro into a pair of
functions: BB_NOTE_LIST, returning an rtx_insn *, and...
(SET_BB_NOTE_LIST): New function, for use where BB_NOTE_LIST is
used as an lvalue.

* sel-sched.c (create_block_for_bookkeeping): Update lvalue usage
of BB_NOTE_LIST to SET_BB_NOTE_LIST.

* sel-sched-ir.c (init_bb): Likewise.
(sel_restore_notes): Likewise.
(move_bb_info): Likewise.
(BB_NOTE_LIST): New function, adding a checked cast to rtx_insn *.
(SET_BB_NOTE_LIST): New function.

/
* rtx-classes-status.txt: Add SET_BB_NOTE_LIST.
---
 gcc/sel-sched-ir.c | 19 +++
 gcc/sel-sched-ir.h |  3 ++-
 gcc/sel-sched.c|  4 ++--
 rtx-classes-status.txt |  1 +
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 18ffa6c..cb4682f 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4625,7 +4625,7 @@ static void
 init_bb (basic_block bb)
 {
   remove_notes (bb_note (bb), BB_END (bb));
-  BB_NOTE_LIST (bb) = note_list;
+  SET_BB_NOTE_LIST (bb) = note_list;
 }
 
 void
@@ -4660,7 +4660,7 @@ sel_restore_notes (void)
{
  note_list = BB_NOTE_LIST (first);
  restore_other_notes (NULL, first);
- BB_NOTE_LIST (first) = NULL_RTX;
+ SET_BB_NOTE_LIST (first) = NULL_RTX;
 
  FOR_BB_INSNS (first, insn)
if (NONDEBUG_INSN_P (insn))
@@ -5268,8 +5268,8 @@ move_bb_info (basic_block merge_bb, basic_block empty_bb)
 {
   if (in_current_region_p (merge_bb))
 concat_note_lists (BB_NOTE_LIST (empty_bb),
-  &BB_NOTE_LIST (merge_bb));
-  BB_NOTE_LIST (empty_bb) = NULL_RTX;
+  &SET_BB_NOTE_LIST (merge_bb));
+  SET_BB_NOTE_LIST (empty_bb) = NULL_RTX;
 
 }
 
@@ -6457,4 +6457,15 @@ rtx& SET_VINSN_INSN_RTX (vinsn_t vi)
   return vi->insn_rtx;
 }
 
+rtx_insn *BB_NOTE_LIST (basic_block bb)
+{
+  rtx note_list = SEL_REGION_BB_INFO (bb)->note_list;
+  return as_a_nullable  (note_list);
+}
+
+rtx& SET_BB_NOTE_LIST (basic_block bb)
+{
+  return SEL_REGION_BB_INFO (bb)->note_list;
+}
+
 #endif
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 7aef287..81accaf 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -920,7 +920,8 @@ extern vec sel_region_bb_info;
A note_list is a list of various notes that was scattered across BB
before scheduling, and will be appended at the beginning of BB after
scheduling is finished.  */
-#define BB_NOTE_LIST(BB) (SEL_REGION_BB_INFO (BB)->note_list)
+extern rtx_insn *BB_NOTE_LIST (basic_block);
+extern rtx& SET_BB_NOTE_LIST (basic_block);
 
 #define BB_AV_SET(BB) (SEL_REGION_BB_INFO (BB)->av_set)
 #define BB_AV_LEVEL(BB) (SEL_REGION_BB_INFO (BB)->av_level)
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 1df2da0..c3e0cca 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4592,8 +4592,8 @@ create_block_for_bookkeeping (edge e1, edge e2)
 
   /* Move note_list from the upper bb.  */
   gcc_assert (BB_NOTE_LIST (new_bb) == NULL_RTX);
-  BB_NOTE_LIST (new_bb) = BB_NOTE_LIST (bb);
-  BB_NOTE_LIST (bb) = NULL_RTX;
+  SET_BB_NOTE_LIST (new_bb) = BB_NOTE_LIST (bb);
+  SET_BB_NOTE_LIST (bb) = NULL_RTX;
 
   gcc_assert (e2->dest == bb);
 
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index fe04611..e77e847 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -12,6 +12,7 @@ TODO: "Scaffolding" to be removed
 =
 * DF_REF_INSN
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER, SET_BB_FOOTER
+* SET_BB_NOTE_LIST
 * SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
 * SET_VINSN_INSN_RTX
-- 
1.8.5.3



[PATCH 044/236] Pass "insn" as an rtx_insn within generated get_attr_ fns in insn-attrtab.c

2014-08-06 Thread David Malcolm
Strengthen "insn" from rtx to rtx_insn * within the generated get_attr_
functions in insn-attrtab.c, without imposing a strengthening from rtx
to rtx_insn * on the param itself and thus the callers.

gcc/
* genattrtab.c (write_attr_get): Within the generated get_attr_
functions, rename param "insn" to "uncast_insn" and reintroduce
"insn" as an local rtx_insn * using a checked cast, so that "insn"
is an rtx_insn * within insn-attrtab.c
---
 gcc/genattrtab.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index c5ce51c..68d05d07 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -4027,9 +4027,9 @@ write_attr_get (FILE *outf, struct attr_desc *attr)
   /* If the attribute name starts with a star, the remainder is the name of
  the subroutine to use, instead of `get_attr_...'.  */
   if (attr->name[0] == '*')
-fprintf (outf, "%s (rtx insn ATTRIBUTE_UNUSED)\n", &attr->name[1]);
+fprintf (outf, "%s (rtx uncast_insn ATTRIBUTE_UNUSED)\n", &attr->name[1]);
   else if (attr->is_const == 0)
-fprintf (outf, "get_attr_%s (rtx insn ATTRIBUTE_UNUSED)\n", attr->name);
+fprintf (outf, "get_attr_%s (rtx uncast_insn ATTRIBUTE_UNUSED)\n", 
attr->name);
   else
 {
   fprintf (outf, "get_attr_%s (void)\n", attr->name);
@@ -4050,6 +4050,9 @@ write_attr_get (FILE *outf, struct attr_desc *attr)
 
   fprintf (outf, "{\n");
 
+  if (attr->name[0] == '*' || attr->is_const == 0)
+fprintf (outf, "  rtx_insn *insn = as_a  (uncast_insn);\n");
+
   /* Find attributes that are worth caching in the conditions.  */
   cached_attr_count = 0;
   attrs_seen_more_than_once = 0;
-- 
1.8.5.3



[PATCH 133/236] config/h8300: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/h8300/h8300-protos.h (final_prescan_insn): Strengthen
first param from rtx to rtx_insn *.
(h8300_insn_length_from_table): Likewise.
* config/h8300/h8300.c (F): Likewise for return type and param
 "x".
(Fpa): Add a checked cast to rtx_insn *.
(h8300_emit_stack_adjustment): Strengthen local "x" from rtx to
rtx_insn *.
(final_prescan_insn): Likewise for param "insn".
(h8300_binary_length): Likewise.
(h8300_insn_length_from_table): Likewise.
---
 gcc/config/h8300/h8300-protos.h |  4 ++--
 gcc/config/h8300/h8300.c| 19 ++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h
index 1af2cc6..ae14125 100644
--- a/gcc/config/h8300/h8300-protos.h
+++ b/gcc/config/h8300/h8300-protos.h
@@ -33,7 +33,7 @@ extern unsigned int compute_a_shift_length (rtx, rtx *);
 extern const char *output_a_rotate (enum rtx_code, rtx *);
 extern unsigned int compute_a_rotate_length (rtx *);
 extern const char *output_simode_bld (int, rtx[]);
-extern void final_prescan_insn (rtx, rtx *, int);
+extern void final_prescan_insn (rtx_insn *, rtx *, int);
 extern int h8300_expand_movsi (rtx[]);
 extern void notice_update_cc (rtx, rtx);
 extern const char *output_logical_op (enum machine_mode, rtx *);
@@ -107,7 +107,7 @@ struct cpp_reader;
 extern void h8300_pr_interrupt (struct cpp_reader *);
 extern void h8300_pr_saveall (struct cpp_reader *);
 extern enum reg_class  h8300_reg_class_from_letter (int);
-extern unsigned inth8300_insn_length_from_table (rtx, rtx *);
+extern unsigned inth8300_insn_length_from_table (rtx_insn *, rtx *);
 extern const char *output_h8sx_shift (rtx *, int, int);
 extern boolh8300_operands_match_p (rtx *);
 extern boolh8sx_mergeable_memrefs_p (rtx, rtx);
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index e7ed03a..e904802 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -114,7 +114,7 @@ static unsigned int  h8300_length_from_table  (rtx, 
rtx, const h8300_length_
 static unsigned int  h8300_unary_length   (rtx);
 static unsigned int  h8300_short_immediate_length (rtx);
 static unsigned int  h8300_bitfield_length(rtx, rtx);
-static unsigned int  h8300_binary_length  (rtx, const 
h8300_length_table *);
+static unsigned int  h8300_binary_length  (rtx_insn *, const 
h8300_length_table *);
 static bool  h8300_short_move_mem_p   (rtx, enum rtx_code);
 static unsigned int  h8300_move_length(rtx *, const 
h8300_length_table *);
 static bool h8300_hard_regno_scratch_ok  (unsigned int);
@@ -485,8 +485,8 @@ byte_reg (rtx x, int b)
   && !crtl->is_leaf)))
 
 /* We use this to wrap all emitted insns in the prologue.  */
-static rtx
-F (rtx x, bool set_it)
+static rtx_insn *
+F (rtx_insn *x, bool set_it)
 {
   if (set_it)
 RTX_FRAME_RELATED_P (x) = 1;
@@ -506,7 +506,7 @@ Fpa (rtx par)
   int i;
 
   for (i = 0; i < len; i++)
-F (XVECEXP (par, 0, i), true);
+F (as_a  (XVECEXP (par, 0, i)), true);
 
   return par;
 }
@@ -543,8 +543,9 @@ h8300_emit_stack_adjustment (int sign, HOST_WIDE_INT size, 
bool in_prologue)
 the splitter will do.  */
   if (Pmode == HImode)
{
- rtx x = emit_insn (gen_addhi3 (stack_pointer_rtx,
-stack_pointer_rtx, GEN_INT (sign * 
size)));
+ rtx_insn *x = emit_insn (gen_addhi3 (stack_pointer_rtx,
+  stack_pointer_rtx,
+  GEN_INT (sign * size)));
  if (size < 4)
F (x, in_prologue);
}
@@ -1874,7 +1875,7 @@ h8300_print_operand_address (FILE *file, rtx addr)
option.  */
 
 void
-final_prescan_insn (rtx insn, rtx *operand ATTRIBUTE_UNUSED,
+final_prescan_insn (rtx_insn *insn, rtx *operand ATTRIBUTE_UNUSED,
int num_operands ATTRIBUTE_UNUSED)
 {
   /* This holds the last insn address.  */
@@ -2438,7 +2439,7 @@ h8300_bitfield_length (rtx op, rtx op2)
 /* Calculate the length of general binary instruction INSN using TABLE.  */
 
 static unsigned int
-h8300_binary_length (rtx insn, const h8300_length_table *table)
+h8300_binary_length (rtx_insn *insn, const h8300_length_table *table)
 {
   rtx set;
 
@@ -2527,7 +2528,7 @@ h8300_mova_length (rtx dest, rtx src, rtx offset)
OPERANDS is the array of its operands.  */
 
 unsigned int
-h8300_insn_length_from_table (rtx insn, rtx * operands)
+h8300_insn_length_from_table (rtx_insn *insn, rtx * operands)
 {
   switch (get_attr_length_table (insn))
 {
-- 
1.8.5.3



[PATCH 081/236] hw-doloop: Use rtx_insn (touches config/bfin/bfin.c)

2014-08-06 Thread David Malcolm
gcc/
* hw-doloop.h (struct hwloop_info_d): Strengthen fields
"last_insn", "loop_end" from rtx to rtx_insn *.

* hw-doloop.c (scan_loop): Likewise for local "insn".
(discover_loop): Likewise for param "tail_insn".
(discover_loops): Likewise for local "tail".

* config/bfin/bfin.c (hwloop_optimize): For now, add a checked
cast to rtx_insn * when assigning from an rtx local to a
hwloop_info's "last_insn" field.
---
 gcc/config/bfin/bfin.c | 2 +-
 gcc/hw-doloop.c| 6 +++---
 gcc/hw-doloop.h| 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index b037a46..02bd4bd 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3654,7 +3654,7 @@ hwloop_optimize (hwloop_info loop)
   last_insn = emit_insn_after (gen_forced_nop (), last_insn);
 }
 
-  loop->last_insn = last_insn;
+  loop->last_insn = as_a_nullable  (last_insn);
 
   /* The loop is good for replacement.  */
   start_label = loop->start_label;
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index d182761..bb66982 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -94,7 +94,7 @@ scan_loop (hwloop_info loop)
 
   for (ix = 0; loop->blocks.iterate (ix, &bb); ix++)
 {
-  rtx insn;
+  rtx_insn *insn;
   edge e;
   edge_iterator ei;
 
@@ -232,7 +232,7 @@ add_forwarder_blocks (hwloop_info loop)
the expected use; targets that call into this code usually replace the
loop counter with a different special register.  */
 static void
-discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
+discover_loop (hwloop_info loop, basic_block tail_bb, rtx_insn *tail_insn, rtx 
reg)
 {
   bool found_tail;
   unsigned dwork = 0;
@@ -359,7 +359,7 @@ discover_loops (bitmap_obstack *loop_stack, struct 
hw_doloop_hooks *hooks)
  structure and add the head block to the work list. */
   FOR_EACH_BB_FN (bb, cfun)
 {
-  rtx tail = BB_END (bb);
+  rtx_insn *tail = BB_END (bb);
   rtx insn, reg;
 
   while (tail && NOTE_P (tail) && tail != BB_HEAD (bb))
diff --git a/gcc/hw-doloop.h b/gcc/hw-doloop.h
index 9fc3c15..a98f213 100644
--- a/gcc/hw-doloop.h
+++ b/gcc/hw-doloop.h
@@ -66,10 +66,10 @@ struct GTY (()) hwloop_info_d
   basic_block successor;
 
   /* The last instruction in the tail.  */
-  rtx last_insn;
+  rtx_insn *last_insn;
 
   /* The loop_end insn.  */
-  rtx loop_end;
+  rtx_insn *loop_end;
 
   /* The iteration register.  */
   rtx iter_reg;
-- 
1.8.5.3



[PATCH 069/236] dwarf2cfi.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* dwarf2cfi.c (add_cfis_to_fde): Strengthen locals "insn", "next"
from rtx to rtx_insn *.
create_pseudo_cfg): Likewise for local "insn".
---
 gcc/dwarf2cfi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 1f56fed..7abe48c 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -2132,7 +2132,7 @@ static void
 add_cfis_to_fde (void)
 {
   dw_fde_ref fde = cfun->fde;
-  rtx insn, next;
+  rtx_insn *insn, *next;
   /* We always start with a function_begin label.  */
   bool first = false;
 
@@ -2727,7 +2727,7 @@ create_pseudo_cfg (void)
 {
   bool saw_barrier, switch_sections;
   dw_trace_info ti;
-  rtx insn;
+  rtx_insn *insn;
   unsigned i;
 
   /* The first trace begins at the start of the function,
-- 
1.8.5.3



[PATCH 214/236] rtl_data.x_stack_slot_list becomes an rtx_expr_list

2014-08-06 Thread David Malcolm
gcc/
* function.h (struct rtl_data): Strengthen field
"x_stack_slot_list" from rtx to rtx_expr_list *.

* emit-rtl.c (unshare_all_rtl_1): Add a checked cast
when assigning to stack_slot_list.
---
 gcc/emit-rtl.c | 3 ++-
 gcc/function.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 5d946b8..5a2d549 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2550,7 +2550,8 @@ unshare_all_rtl_1 (rtx_insn *insn)
  This special care is necessary when the stack slot MEM does not
  actually appear in the insn chain.  If it does appear, its address
  is unshared from all else at that point.  */
-  stack_slot_list = copy_rtx_if_shared (stack_slot_list);
+  stack_slot_list = as_a_nullable  (
+ copy_rtx_if_shared (stack_slot_list));
 }
 
 /* Go through all the RTL insn bodies and copy any invalid shared
diff --git a/gcc/function.h b/gcc/function.h
index a176e0a..1f8da7a 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -280,7 +280,7 @@ struct GTY(()) rtl_data {
 
   /* List (chain of EXPR_LISTs) of all stack slots in this function.
  Made for the sake of unshare_all_rtl.  */
-  rtx x_stack_slot_list;
+  rtx_expr_list *x_stack_slot_list;
 
   /* List of empty areas in the stack frame.  */
   struct frame_space *frame_space_list;
-- 
1.8.5.3



[PATCH 035/236] Return types of unlink_insn_chain and duplicate_insn_chain

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (unlink_insn_chain): Strengthen return type from rtx to
rtx_insn *.
(duplicate_insn_chain): Likewise.
* cfgrtl.c (unlink_insn_chain): Strengthen return type from rtx to
rtx_insn *, also for locals "prevfirst" and "nextlast".  Add a
checked cast for now (until we can strengthen the params in the
same way).
(duplicate_insn_chain): Likewise.
---
 gcc/cfgrtl.c | 12 ++--
 gcc/rtl.h|  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 9f15a7d..5611ab8 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -3304,11 +3304,11 @@ fixup_abnormal_edges (void)
 
 /* Cut the insns from FIRST to LAST out of the insns stream.  */
 
-rtx
+rtx_insn *
 unlink_insn_chain (rtx first, rtx last)
 {
-  rtx prevfirst = PREV_INSN (first);
-  rtx nextlast = NEXT_INSN (last);
+  rtx_insn *prevfirst = PREV_INSN (first);
+  rtx_insn *nextlast = NEXT_INSN (last);
 
   SET_PREV_INSN (first) = NULL;
   SET_NEXT_INSN (last) = NULL;
@@ -3320,7 +3320,7 @@ unlink_insn_chain (rtx first, rtx last)
 set_last_insn (prevfirst);
   if (!prevfirst)
 set_first_insn (nextlast);
-  return first;
+  return as_a  (first);
 }
 
 /* Skip over inter-block insns occurring after BB which are typically
@@ -4083,7 +4083,7 @@ cfg_layout_can_duplicate_bb_p (const_basic_block bb)
   return true;
 }
 
-rtx
+rtx_insn *
 duplicate_insn_chain (rtx from, rtx to)
 {
   rtx insn, next, copy;
@@ -4169,7 +4169,7 @@ duplicate_insn_chain (rtx from, rtx to)
 }
   insn = NEXT_INSN (last);
   delete_insn (last);
-  return insn;
+  return as_a  (insn);
 }
 
 /* Create a duplicate of the basic block BB.  */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index b4027aa..2cce7d4 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3072,7 +3072,7 @@ extern void delete_insn (rtx);
 extern rtx_insn *entry_of_function (void);
 extern void emit_insn_at_entry (rtx);
 extern void delete_insn_chain (rtx, rtx, bool);
-extern rtx unlink_insn_chain (rtx, rtx);
+extern rtx_insn *unlink_insn_chain (rtx, rtx);
 extern void delete_insn_and_edges (rtx);
 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
 extern rtx gen_const_mem (enum machine_mode, rtx);
@@ -3148,7 +3148,7 @@ extern int fixup_args_size_notes (rtx, rtx, int);
 
 /* In cfgrtl.c */
 extern void print_rtl_with_bb (FILE *, const_rtx, int);
-extern rtx duplicate_insn_chain (rtx, rtx);
+extern rtx_insn *duplicate_insn_chain (rtx, rtx);
 
 /* In expmed.c */
 extern void init_expmed (void);
-- 
1.8.5.3



[PATCH 041/236] Debug hooks: use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* debug.h (struct gcc_debug_hooks): Strengthen param 1 of hook
"label" from rtx to rtx_code_label *.  Strengthen param 1 o
"var_location" hook from rtx to rtx_insn *.
(debug_nothing_rtx): Delete in favor of...
(debug_nothing_rtx_code_label): New prototype.
(debug_nothing_rtx_rtx): Delete unused prototype.
(debug_nothing_rtx_insn): New prototype.

* final.c (final_scan_insn): Add checked cast to rtx_insn * when
invoking debug_hooks->var_location (in two places, one in a NOTE
case of a switch statement, the other guarded by a CALL_P
conditional.  Add checked cast to rtx_code_label * when invoking
debug_hooks->label (within CODE_LABEL case of switch statement).

* dbxout.c (dbx_debug_hooks): Update "label" hook from
debug_nothing_rtx to debug_nothing_rtx_code_label.  Update
"var_location" from debug_nothing_rtx to debug_nothing_rtx_insn.
(xcoff_debug_hooks): Likewise.
* debug.c (do_nothing_debug_hooks): Likewise.
(debug_nothing_rtx): Delete in favor of...
(debug_nothing_rtx_insn): New function.
(debug_nothing_rtx_rtx): Delete unused function.
(debug_nothing_rtx_code_label): New function.
* dwarf2out.c (dwarf2_debug_hooks): Update "label" hook from
debug_nothing_rtx to debug_nothing_rtx_code_label.
(dwarf2out_var_location): Strengthen param "loc_note" from rtx
to rtx_insn *.
* sdbout.c (sdb_debug_hooks): Update "var_location" hook from
debug_nothing_rtx to debug_nothing_rtx_insn.
(sdbout_label): Strengthen param "insn" from rtx to
rtx_code_label *.
* vmsdbgout.c (vmsdbg_debug_hooks): Update "label" hook from
debug_nothing_rtx to debug_nothing_rtx_code_label.  Update
"var_location" hook from debug_nothing_rtx to
debug_nothing_rtx_insn.
---
 gcc/dbxout.c| 8 
 gcc/debug.c | 9 -
 gcc/debug.h | 8 
 gcc/dwarf2out.c | 6 +++---
 gcc/final.c | 6 +++---
 gcc/sdbout.c| 6 +++---
 gcc/vmsdbgout.c | 4 ++--
 7 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 6cb4341..a41db37 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -371,9 +371,9 @@ const struct gcc_debug_hooks dbx_debug_hooks =
   debug_nothing_tree_tree_tree_bool,/* imported_module_or_decl */
   debug_nothing_tree,   /* deferred_inline_function */
   debug_nothing_tree,   /* outlining_inline_function */
-  debug_nothing_rtx,/* label */
+  debug_nothing_rtx_code_label, /* label */
   dbxout_handle_pch,/* handle_pch */
-  debug_nothing_rtx,/* var_location */
+  debug_nothing_rtx_insn,   /* var_location */
   debug_nothing_void,/* switch_text_section */
   debug_nothing_tree_tree,  /* set_name */
   0, /* start_end_main_source_file */
@@ -407,9 +407,9 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
   debug_nothing_tree_tree_tree_bool,/* imported_module_or_decl */
   debug_nothing_tree,   /* deferred_inline_function */
   debug_nothing_tree,   /* outlining_inline_function */
-  debug_nothing_rtx,/* label */
+  debug_nothing_rtx_code_label, /* label */
   dbxout_handle_pch,/* handle_pch */
-  debug_nothing_rtx,/* var_location */
+  debug_nothing_rtx_insn,   /* var_location */
   debug_nothing_void,/* switch_text_section */
   debug_nothing_tree_tree,  /* set_name */
   0, /* start_end_main_source_file */
diff --git a/gcc/debug.c b/gcc/debug.c
index 1734540..dba068c 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -48,9 +48,9 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
   debug_nothing_tree_tree_tree_bool,/* imported_module_or_decl */
   debug_nothing_tree,   /* deferred_inline_function */
   debug_nothing_tree,   /* outlining_inline_function */
-  debug_nothing_rtx,/* label */
+  debug_nothing_rtx_code_label, /* label */
   debug_nothing_int,/* handle_pch */
-  debug_nothing_rtx,/* var_location */
+  debug_nothing_rtx_insn,   /* var_location */
   debug_nothing_void,/* switch_text_section */
   debug_nothing_tree_tree,  /* set_name */
   0, /* start_end_main_source_file */
@@ -91,13 +91,12 @@ debug_true_const_tree (const_tree block ATTRIBUTE_UNUSED)
 }
 
 void
-debug_nothing_rtx (rtx insn ATTRIBUTE_UNUSED)
+debug_nothing_rtx_insn (rtx_insn *insn ATTRIBUTE_UNUSED)
 {
 }
 
 void
-debug_nothing_rtx_rtx (rtx insn ATTRIBUTE_UNUSED,
-  

[PATCH 070/236] dwarf2out.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* dwarf2out.c (last_var_location_insn): Strengthen this variable
from rtx to rtx_insn *.
(cached_next_real_insn): Likewise.
(dwarf2out_end_epilogue): Replace use of NULL_RTX with NULL when
working with insns.
(dwarf2out_var_location): Strengthen locals "next_real",
"next_note", "expected_next_loc_note", "last_start", "insn" from
rtx to rtx_insn *.
---
 gcc/dwarf2out.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 320d367..92f5c83 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -99,8 +99,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "gdb/gdb-index.h"
 
 static void dwarf2out_source_line (unsigned int, const char *, int, bool);
-static rtx last_var_location_insn;
-static rtx cached_next_real_insn;
+static rtx_insn *last_var_location_insn;
+static rtx_insn *cached_next_real_insn;
 
 #ifdef VMS_DEBUGGING_INFO
 int vms_file_stats_name (const char *, long long *, long *, char *, int *);
@@ -1137,8 +1137,8 @@ dwarf2out_end_epilogue (unsigned int line 
ATTRIBUTE_UNUSED,
   dw_fde_ref fde;
   char label[MAX_ARTIFICIAL_LABEL_BYTES];
 
-  last_var_location_insn = NULL_RTX;
-  cached_next_real_insn = NULL_RTX;
+  last_var_location_insn = NULL;
+  cached_next_real_insn = NULL;
 
   if (dwarf2out_do_cfi_asm ())
 fprintf (asm_out_file, "\t.cfi_endproc\n");
@@ -21309,11 +21309,11 @@ dwarf2out_var_location (rtx_insn *loc_note)
 {
   char loclabel[MAX_ARTIFICIAL_LABEL_BYTES + 2];
   struct var_loc_node *newloc;
-  rtx next_real, next_note;
+  rtx_insn *next_real, *next_note;
   static const char *last_label;
   static const char *last_postcall_label;
   static bool last_in_cold_section_p;
-  static rtx expected_next_loc_note;
+  static rtx_insn *expected_next_loc_note;
   tree decl;
   bool var_loc_p;
 
@@ -21340,7 +21340,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
   if (next_real)
 {
   if (expected_next_loc_note != loc_note)
-   next_real = NULL_RTX;
+   next_real = NULL;
 }
 
   next_note = NEXT_INSN (loc_note);
@@ -21349,7 +21349,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
   || ! NOTE_P (next_note)
   || (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
  && NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
-next_note = NULL_RTX;
+next_note = NULL;
 
   if (! next_real)
 next_real = next_real_insn (loc_note);
@@ -21360,7 +21360,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
   cached_next_real_insn = next_real;
 }
   else
-cached_next_real_insn = NULL_RTX;
+cached_next_real_insn = NULL;
 
   /* If there are no instructions which would be affected by this note,
  don't do anything.  */
@@ -21413,8 +21413,8 @@ dwarf2out_var_location (rtx_insn *loc_note)
  && in_first_function_p
  && maybe_at_text_label_p)
{
- static rtx last_start;
- rtx insn;
+ static rtx_insn *last_start;
+ rtx_insn *insn;
  for (insn = loc_note; insn; insn = previous_insn (insn))
if (insn == last_start)
  break;
-- 
1.8.5.3



[PATCH 131/236] config/c6x: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/c6x/c6x-protos.h (c6x_get_unit_specifier): Strengthen
param from rtx to rtx_insn *.
(c6x_final_prescan_insn): Likewise for first param.

* config/c6x/c6x.c (c6x_current_insn): Likewise for this variable.
(c6x_output_mi_thunk): Replace use of NULL_RTX with NULL.
(c6x_expand_compare): Strengthen local "insns" from rtx to
rtx_insn *.
(c6x_get_unit_specifier): Likewise for param "insn".
(c6x_print_unit_specifier_field): Likewise.
(c6x_final_prescan_insn): Likewise.
(emit_add_sp_const): Likewise for local "insn".
(c6x_expand_prologue): Likewise.
---
 gcc/config/c6x/c6x-protos.h |  4 ++--
 gcc/config/c6x/c6x.c| 17 +
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/config/c6x/c6x-protos.h b/gcc/config/c6x/c6x-protos.h
index e360ebf..78080da 100644
--- a/gcc/config/c6x/c6x-protos.h
+++ b/gcc/config/c6x/c6x-protos.h
@@ -41,9 +41,9 @@ extern rtx c6x_subword (rtx, bool);
 extern void split_di (rtx *, int, rtx *, rtx *);
 extern bool c6x_valid_mask_p (HOST_WIDE_INT);
 
-extern char c6x_get_unit_specifier (rtx);
+extern char c6x_get_unit_specifier (rtx_insn *);
 
-extern void c6x_final_prescan_insn(rtx insn, rtx *opvec, int noperands);
+extern void c6x_final_prescan_insn(rtx_insn *insn, rtx *opvec, int noperands);
 
 extern int c6x_nsaved_regs (void);
 extern HOST_WIDE_INT c6x_initial_elimination_offset (int, int);
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index ba628d0..38070c0 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -86,7 +86,7 @@ unsigned long c6x_insn_mask = C6X_DEFAULT_INSN_MASK;
 
 /* The instruction that is being output (as obtained from FINAL_PRESCAN_INSN).
  */
-static rtx c6x_current_insn = NULL_RTX;
+static rtx_insn *c6x_current_insn = NULL;
 
 /* A decl we build to access __c6xabi_DSBT_base.  */
 static GTY(()) tree dsbt_decl;
@@ -769,7 +769,7 @@ c6x_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
   /* The this parameter is passed as the first argument.  */
   rtx this_rtx = gen_rtx_REG (Pmode, REG_A4);
 
-  c6x_current_insn = NULL_RTX;
+  c6x_current_insn = NULL;
 
   xops[4] = XEXP (DECL_RTL (function), 0);
   if (!vcall_offset)
@@ -1565,7 +1565,7 @@ c6x_expand_compare (rtx comparison, enum machine_mode 
mode)
 
   if (is_fp_libfunc)
{
- rtx insns;
+ rtx_insn *insns;
  rtx libfunc;
  switch (code)
{
@@ -1970,7 +1970,7 @@ c6x_print_address_operand (FILE *file, rtx x, enum 
machine_mode mem_mode)
specifies the functional unit used by INSN.  */
 
 char
-c6x_get_unit_specifier (rtx insn)
+c6x_get_unit_specifier (rtx_insn *insn)
 {
   enum attr_units units;
 
@@ -2007,7 +2007,7 @@ c6x_get_unit_specifier (rtx insn)
 
 /* Prints the unit specifier field.  */
 static void
-c6x_print_unit_specifier_field (FILE *file, rtx insn)
+c6x_print_unit_specifier_field (FILE *file, rtx_insn *insn)
 {
   enum attr_units units = get_attr_units (insn);
   enum attr_cross cross = get_attr_cross (insn);
@@ -2487,7 +2487,7 @@ c6x_preferred_rename_class (reg_class_t cl)
 
 /* Implements FINAL_PRESCAN_INSN.  */
 void
-c6x_final_prescan_insn (rtx insn, rtx *opvec ATTRIBUTE_UNUSED,
+c6x_final_prescan_insn (rtx_insn *insn, rtx *opvec ATTRIBUTE_UNUSED,
int noperands ATTRIBUTE_UNUSED)
 {
   c6x_current_insn = insn;
@@ -2715,7 +2715,7 @@ emit_add_sp_const (HOST_WIDE_INT offset, bool 
frame_related_p)
 {
   rtx to_add = GEN_INT (offset);
   rtx orig_to_add = to_add;
-  rtx insn;
+  rtx_insn *insn;
 
   if (offset == 0)
 return;
@@ -2752,7 +2752,8 @@ void
 c6x_expand_prologue (void)
 {
   struct c6x_frame frame;
-  rtx insn, mem;
+  rtx_insn *insn;
+  rtx mem;
   int nsaved = 0;
   HOST_WIDE_INT initial_offset, off, added_already;
 
-- 
1.8.5.3



[PATCH 071/236] except.*: Use rtx_insn (also touches function.h)

2014-08-06 Thread David Malcolm
gcc/
* except.h (sjlj_emit_function_exit_after): Strengthen param
"after" from rtx to rtx_insn *.  This is only called with
result of get_last_insn (in function.c) so type-change should be
self-contained.

* function.h (struct rtl_eh): Strengthen field "ehr_label" from
rtx to rtx_code_label *, and field "sjlj_exit_after" from rtx
to rtx_insn *.  These fields are only used from except.c so this
type-change should be self-contained to this patch.

* except.c (emit_to_new_bb_before): Strengthen param "seq" and
local "last" from rtx to rtx_insn *.
(dw2_build_landing_pads): Likewise for local "seq".
(sjlj_mark_call_sites): Likewise for locals "insn", "before", p".
(sjlj_emit_function_enter): Strengthen param "dispatch_label" from
rtx to rtx_code_label *.  Strengthen locals "fn_begin", "seq" from
rtx to rtx_insn *.
(sjlj_emit_function_exit_after): Strengthen param "after" from rtx
to rtx_insn *.
(sjlj_emit_function_exit): Likewise for locals "seq", "insn".
(sjlj_emit_dispatch_table): Likewise for locals "seq", "seq2".
(sjlj_build_landing_pads): Replace NULL_RTX with NULL when
referring to an insn.  Strengthen local "dispatch_label" from
rtx to rtx_code_label *.
(set_nothrow_function_flags): Strengthen local "insn" from rtx to
rtx_insn *.
(expand_eh_return): Strengthen local "around_label" from
rtx to rtx_code_label *.
(convert_to_eh_region_ranges): Strengthen locals "iter",
"last_action_insn", "first_no_action_insn",
"first_no_action_insn_before_switch",
"last_no_action_insn_before_switch", from rtx to rtx_insn *.
---
 gcc/except.c   | 53 +
 gcc/except.h   |  2 +-
 gcc/function.h |  4 ++--
 3 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/gcc/except.c b/gcc/except.c
index ec712a9..1a26b08 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -959,9 +959,9 @@ assign_filter_values (void)
first instruction of some existing BB and return the newly
produced block.  */
 static basic_block
-emit_to_new_bb_before (rtx seq, rtx insn)
+emit_to_new_bb_before (rtx_insn *seq, rtx insn)
 {
-  rtx last;
+  rtx_insn *last;
   basic_block bb;
   edge e;
   edge_iterator ei;
@@ -1030,7 +1030,7 @@ dw2_build_landing_pads (void)
   for (i = 1; vec_safe_iterate (cfun->eh->lp_array, i, &lp); ++i)
 {
   basic_block bb;
-  rtx seq;
+  rtx_insn *seq;
   edge e;
 
   if (lp == NULL || lp->post_landing_pad == NULL)
@@ -1119,7 +1119,8 @@ static void
 sjlj_mark_call_sites (void)
 {
   int last_call_site = -2;
-  rtx insn, mem;
+  rtx_insn *insn;
+  rtx mem;
 
   for (insn = get_insns (); insn ; insn = NEXT_INSN (insn))
 {
@@ -1127,7 +1128,7 @@ sjlj_mark_call_sites (void)
   eh_region r;
   bool nothrow;
   int this_call_site;
-  rtx before, p;
+  rtx_insn *before, *p;
 
   /* Reset value tracking at extended basic block boundaries.  */
   if (LABEL_P (insn))
@@ -1180,9 +1181,10 @@ sjlj_mark_call_sites (void)
 /* Construct the SjLj_Function_Context.  */
 
 static void
-sjlj_emit_function_enter (rtx dispatch_label)
+sjlj_emit_function_enter (rtx_code_label *dispatch_label)
 {
-  rtx fn_begin, fc, mem, seq;
+  rtx_insn *fn_begin, *seq;
+  rtx fc, mem;
   bool fn_begin_outside_block;
   rtx personality = get_personality_function (current_function_decl);
 
@@ -1260,7 +1262,7 @@ sjlj_emit_function_enter (rtx dispatch_label)
the call to unwind_sjlj_unregister_libfunc if needed.  */
 
 void
-sjlj_emit_function_exit_after (rtx after)
+sjlj_emit_function_exit_after (rtx_insn *after)
 {
   crtl->eh.sjlj_exit_after = after;
 }
@@ -1268,7 +1270,7 @@ sjlj_emit_function_exit_after (rtx after)
 static void
 sjlj_emit_function_exit (void)
 {
-  rtx seq, insn;
+  rtx_insn *seq, *insn;
 
   start_sequence ();
 
@@ -1295,7 +1297,8 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int 
num_dispatch)
   enum machine_mode unwind_word_mode = targetm.unwind_word_mode ();
   enum machine_mode filter_mode = targetm.eh_return_filter_mode ();
   eh_landing_pad lp;
-  rtx mem, seq, fc, before, exc_ptr_reg, filter_reg;
+  rtx mem, fc, before, exc_ptr_reg, filter_reg;
+  rtx_insn *seq;
   rtx first_reachable_label;
   basic_block bb;
   eh_region r;
@@ -1353,7 +1356,8 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int 
num_dispatch)
   for (i = 1; vec_safe_iterate (cfun->eh->lp_array, i, &lp); ++i)
 if (lp && lp->post_landing_pad)
   {
-   rtx seq2, label;
+   rtx_insn *seq2;
+   rtx label;
 
start_sequence ();
 
@@ -1467,7 +1471,7 @@ sjlj_build_landing_pads (void)
   num_dispatch = sjlj_assign_call_site_values ();
   if (num_dispatch > 0)
 {
-  rtx dispatch_label = gen_label_rtx ();
+  rtx_code_label *dispatch_label = gen_label_rtx ();
   int align = STACK_SLOT_ALI

[PATCH 221/236] Add insn method to rtx_expr_list

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (rtx_expr_list::insn): New method.
---
 gcc/rtl.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index d028be1..d5811c2 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -414,6 +414,10 @@ public:
 
   /* Get at the underlying rtx.  */
   rtx element () const;
+
+  /* Get at the rtx, casting to rtx_insn *.  */
+  rtx_insn *insn () const;
+
 };
 
 template <>
@@ -1287,6 +1291,11 @@ inline rtx rtx_expr_list::element () const
   return XEXP (this, 0);
 }
 
+inline rtx_insn *rtx_expr_list::insn () const
+{
+  return as_a  (XEXP (this, 0));
+}
+
 /* Methods of rtx_insn_list.  */
 
 inline rtx_insn_list *rtx_insn_list::next () const
-- 
1.8.5.3



[PATCH 024/236] last_call_insn returns an rtx_call_insn *

2014-08-06 Thread David Malcolm
gcc/
* emit-rtl.c (last_call_insn): Strengthen return type from rtx to
rtx_call_insn *.
* rtl.h (is_a_helper ::test): New overload, accepting
an rtx_insn *.
(last_call_insn): Strengthen return type from rtx to
rtx_call_insn *.
---
 gcc/emit-rtl.c |  6 +++---
 gcc/rtl.h  | 10 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 5175284..39e73a2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3369,17 +3369,17 @@ prev_real_insn (rtx insn)
 /* Return the last CALL_INSN in the current list, or 0 if there is none.
This routine does not look inside SEQUENCEs.  */
 
-rtx
+rtx_call_insn *
 last_call_insn (void)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   for (insn = get_last_insn ();
insn && !CALL_P (insn);
insn = PREV_INSN (insn))
 ;
 
-  return insn;
+  return as_a_nullable  (insn);
 }
 
 /* Find the next insn after INSN that really does something.  This routine
diff --git a/gcc/rtl.h b/gcc/rtl.h
index e29cda3..85b725a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -753,6 +753,14 @@ is_a_helper ::test (rtx rt)
 template <>
 template <>
 inline bool
+is_a_helper ::test (rtx_insn *insn)
+{
+  return CALL_P (insn);
+}
+
+template <>
+template <>
+inline bool
 is_a_helper ::test (rtx rt)
 {
   return JUMP_TABLE_DATA_P (rt);
@@ -2394,7 +2402,7 @@ extern rtx gen_use (rtx);
 extern rtx emit_use (rtx);
 extern rtx make_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
-extern rtx last_call_insn (void);
+extern rtx_call_insn *last_call_insn (void);
 extern rtx_insn *previous_insn (rtx);
 extern rtx_insn *next_insn (rtx);
 extern rtx_insn *prev_nonnote_insn (rtx);
-- 
1.8.5.3



[PATCH 235/236] Make next_insn and previous_insn require an rtx_insn *

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (previous_insn): Strengthen param from rtx to rtx_insn *.
(next_insn): Likewise.
* emit-rtl.c (next_insn): Likewise.
(previous_insn): Likewise.
* config/pa/pa.c (remove_useless_addtr_insns): Strenghten locals
"insn" and "next" from rtx to rtx_insn *.
* config/picochip/picochip.c (picochip_reorg): Likewise for locals
"insn", "insn1", "vliw_start",  "prologue_end_note",
"last_insn_in_packet".
---
 gcc/config/pa/pa.c | 5 +++--
 gcc/config/picochip/picochip.c | 6 +++---
 gcc/emit-rtl.c | 6 ++
 gcc/rtl.h  | 4 ++--
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 9579db0..5b3688c 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -3314,7 +3314,7 @@ pa_output_ascii (FILE *file, const char *p, int size)
 static void
 remove_useless_addtr_insns (int check_notes)
 {
-  rtx insn;
+  rtx_insn *insn;
   static int pass = 0;
 
   /* This is fairly cheap, so always run it when optimizing.  */
@@ -3366,7 +3366,8 @@ remove_useless_addtr_insns (int check_notes)
 reverse the comparison & the branch to avoid add,tr insns.  */
   for (insn = get_insns (); insn; insn = next_insn (insn))
{
- rtx tmp, next;
+ rtx tmp;
+ rtx_insn *next;
 
  /* Ignore anything that isn't an INSN.  */
  if (! NONJUMP_INSN_P (insn))
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 3131d28..c59bf76 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -3248,7 +3248,7 @@ reorder_var_tracking_notes (void)
 void
 picochip_reorg (void)
 {
-  rtx insn, insn1, vliw_start = NULL_RTX;
+  rtx_insn *insn, *insn1, *vliw_start = NULL;
   int vliw_insn_location = 0;
 
   /* We are freeing block_for_insn in the toplev to keep compatibility
@@ -3325,8 +3325,8 @@ picochip_reorg (void)
  of VLIW packets. */
   if (picochip_schedule_type == DFA_TYPE_SPEED)
 {
-  rtx prologue_end_note = NULL;
-  rtx last_insn_in_packet = NULL;
+  rtx_insn *prologue_end_note = NULL;
+  rtx_insn *last_insn_in_packet = NULL;
 
   for (insn = get_insns (); insn; insn = next_insn (insn))
{
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2fc07d6..f6b9356 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3201,9 +3201,8 @@ get_max_insn_count (void)
of the sequence.  */
 
 rtx_insn *
-next_insn (rtx uncast_insn)
+next_insn (rtx_insn *insn)
 {
-  rtx_insn *insn = as_a_nullable  (uncast_insn);
   if (insn)
 {
   insn = NEXT_INSN (insn);
@@ -3219,9 +3218,8 @@ next_insn (rtx uncast_insn)
of the sequence.  */
 
 rtx_insn *
-previous_insn (rtx uncast_insn)
+previous_insn (rtx_insn *insn)
 {
-  rtx_insn *insn = as_a_nullable  (uncast_insn);
   if (insn)
 {
   insn = PREV_INSN (insn);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 49ad08b..71aefc3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2607,8 +2607,8 @@ extern rtx_insn *emit_use (rtx);
 extern rtx_insn *make_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx_call_insn *last_call_insn (void);
-extern rtx_insn *previous_insn (rtx);
-extern rtx_insn *next_insn (rtx);
+extern rtx_insn *previous_insn (rtx_insn *);
+extern rtx_insn *next_insn (rtx_insn *);
 extern rtx_insn *prev_nonnote_insn (rtx);
 extern rtx_insn *prev_nonnote_insn_bb (rtx);
 extern rtx_insn *next_nonnote_insn (rtx);
-- 
1.8.5.3



[PATCH 216/236] PHASE 6: Use extra rtx_def subclasses

2014-08-06 Thread David Malcolm
/
rtx-classes-status.txt: Update
---
 rtx-classes-status.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index e51b0f3..abd5c7f 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -5,8 +5,8 @@ Phase 1: initial "scaffolding" commits:DONE
 Phase 2: per-file commits in main source dir:  DONE
 Phase 3: per-file commits within "config" subdirs: DONE
 Phase 4: removal of "scaffolding": DONE
-Phase 5: additional rtx_def subclasses:IN PROGRESS
-Phase 6: use extra rtx_def subclasses: TODO
+Phase 5: additional rtx_def subclasses:DONE
+Phase 6: use extra rtx_def subclasses: IN PROGRESS
 
 TODO: "Scaffolding" to be removed
 =
-- 
1.8.5.3



[PATCH 115/236] sel-sched-ir.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.c (vinsn_copy): Strengthen local "copy" from rtx to
rtx_insn *.
(speculate_expr): Likewise for locals "orig_insn_rtx",
"spec_insn_rtx".
(eq_transformed_insns): Likewise for locals "i1", "i2".
(check_for_new_jump): Likewise for return type and local "end".
(find_new_jump): Likewise for return type and local "jump".
(sel_split_edge): Likewise for local "jump".
(sel_create_recovery_block): Likewise.
(sel_redirect_edge_and_branch_force): Likewise.
(sel_redirect_edge_and_branch): Likewise.
---
 gcc/sel-sched-ir.c | 29 -
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index f51f4f3..9e9abad 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1246,7 +1246,7 @@ vinsn_create (insn_t insn, bool force_unique_p)
 vinsn_t
 vinsn_copy (vinsn_t vi, bool reattach_p)
 {
-  rtx copy;
+  rtx_insn *copy;
   bool unique = VINSN_UNIQUE_P (vi);
   vinsn_t new_vi;
 
@@ -1962,7 +1962,7 @@ int
 speculate_expr (expr_t expr, ds_t ds)
 {
   int res;
-  rtx orig_insn_rtx;
+  rtx_insn *orig_insn_rtx;
   rtx spec_pat;
   ds_t target_ds, current_ds;
 
@@ -1983,7 +1983,8 @@ speculate_expr (expr_t expr, ds_t ds)
 
 case 1:
   {
-   rtx spec_insn_rtx = create_insn_rtx_from_pattern (spec_pat, NULL_RTX);
+   rtx_insn *spec_insn_rtx =
+ create_insn_rtx_from_pattern (spec_pat, NULL_RTX);
vinsn_t spec_vinsn = create_vinsn_from_insn_rtx (spec_insn_rtx, false);
 
change_vinsn_in_expr (expr, spec_vinsn);
@@ -2830,8 +2831,10 @@ hash_transformed_insns (const void *p)
 static int
 eq_transformed_insns (const void *p, const void *q)
 {
-  rtx i1 = VINSN_INSN_RTX (((const struct transformed_insns *) p)->vinsn_old);
-  rtx i2 = VINSN_INSN_RTX (((const struct transformed_insns *) q)->vinsn_old);
+  rtx_insn *i1 =
+VINSN_INSN_RTX (((const struct transformed_insns *) p)->vinsn_old);
+  rtx_insn *i2 =
+VINSN_INSN_RTX (((const struct transformed_insns *) q)->vinsn_old);
 
   if (INSN_UID (i1) == INSN_UID (i2))
 return 1;
@@ -5439,10 +5442,10 @@ sel_split_block (basic_block bb, rtx after)
 
 /* If BB ends with a jump insn whose ID is bigger then PREV_MAX_UID, return it.
Otherwise returns NULL.  */
-static rtx
+static rtx_insn *
 check_for_new_jump (basic_block bb, int prev_max_uid)
 {
-  rtx end;
+  rtx_insn *end;
 
   end = sel_bb_end (bb);
   if (end && INSN_UID (end) >= prev_max_uid)
@@ -5452,10 +5455,10 @@ check_for_new_jump (basic_block bb, int prev_max_uid)
 
 /* Look for a new jump either in FROM_BB block or in newly created JUMP_BB 
block.
New means having UID at least equal to PREV_MAX_UID.  */
-static rtx
+static rtx_insn *
 find_new_jump (basic_block from, basic_block jump_bb, int prev_max_uid)
 {
-  rtx jump;
+  rtx_insn *jump;
 
   /* Return immediately if no new insns were emitted.  */
   if (get_max_uid () == prev_max_uid)
@@ -5478,7 +5481,7 @@ sel_split_edge (edge e)
 {
   basic_block new_bb, src, other_bb = NULL;
   int prev_max_uid;
-  rtx jump;
+  rtx_insn *jump;
 
   src = e->src;
   prev_max_uid = get_max_uid ();
@@ -5541,7 +5544,7 @@ sel_create_recovery_block (insn_t orig_insn)
 {
   basic_block first_bb, second_bb, recovery_block;
   basic_block before_recovery = NULL;
-  rtx jump;
+  rtx_insn *jump;
 
   first_bb = BLOCK_FOR_INSN (orig_insn);
   if (sel_bb_end_p (orig_insn))
@@ -5592,7 +5595,7 @@ sel_redirect_edge_and_branch_force (edge e, basic_block 
to)
 {
   basic_block jump_bb, src, orig_dest = e->dest;
   int prev_max_uid;
-  rtx jump;
+  rtx_insn *jump;
   int old_seqno = -1;
 
   /* This function is now used only for bookkeeping code creation, where
@@ -5636,7 +5639,7 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
   bool latch_edge_p;
   basic_block src, orig_dest = e->dest;
   int prev_max_uid;
-  rtx jump;
+  rtx_insn *jump;
   edge redirected;
   bool recompute_toporder_p = false;
   bool maybe_unreachable = single_pred_p (orig_dest);
-- 
1.8.5.3



[PATCH 184/236] Use rtx_insn in more places in sel-sched.c

2014-08-06 Thread David Malcolm
gcc/
* sel-sched.c (find_place_for_bookkeeping): Strengthen local "insn"
from rtx to rtx_insn *.
(need_nop_to_preserve_insn_bb): Likewise for param "insn".
(code_motion_path_driver): Likewise for local "last_insn".
(simplify_changed_insns): Likewise for local "insn".
---
 gcc/sel-sched.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index bead27a..fdaad36 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4723,7 +4723,7 @@ find_place_for_bookkeeping (edge e1, edge e2, fence_t 
*fence_to_rewind)
 removed already.  */
   if (DEBUG_INSN_P (place_to_insert))
{
- rtx insn = sel_bb_head (book_block);
+ rtx_insn *insn = sel_bb_head (book_block);
 
  while (insn != place_to_insert &&
 (DEBUG_INSN_P (insn) || NOTE_P (insn)))
@@ -5967,7 +5967,7 @@ handle_emitting_transformations (rtx_insn *insn, expr_t 
expr,
leave a NOP there till the return to fill_insns.  */
 
 static bool
-need_nop_to_preserve_insn_bb (rtx insn)
+need_nop_to_preserve_insn_bb (rtx_insn *insn)
 {
   insn_t bb_head, bb_end, bb_next, in_next;
   basic_block bb = BLOCK_FOR_INSN (insn);
@@ -6645,7 +6645,7 @@ code_motion_path_driver (insn_t insn, av_set_t orig_ops, 
ilist_t path,
   if (!expr)
 {
   int res;
-  rtx last_insn = PREV_INSN (insn);
+  rtx_insn *last_insn = PREV_INSN (insn);
   bool added_to_path;
 
   gcc_assert (insn == sel_bb_end (bb));
@@ -7013,7 +7013,7 @@ simplify_changed_insns (void)
   for (i = 0; i < current_nr_blocks; i++)
 {
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i));
-  rtx insn;
+  rtx_insn *insn;
 
   FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
-- 
1.8.5.3



[PATCH 110/236] rtlanal.c: Use rtx_insn

2014-08-06 Thread David Malcolm
* rtlanal.c (reg_used_between_p): Strengthen local "insn" from rtx
to rtx_insn *.
(reg_set_between_p): Strengthen local "insn" from const_rtx to
const rtx_insn *.
(modified_between_p): Strengthen local "insn" from rtx to
rtx_insn *.
(remove_reg_equal_equiv_notes_for_regno): Likewise.
(keep_with_call_p): Strengthen local "i2" from const_rtx to
const rtx_insn *.
---
 gcc/rtlanal.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 493c812..13f9b78 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -762,7 +762,7 @@ no_labels_between_p (const_rtx beg, const_rtx end)
 int
 reg_used_between_p (const_rtx reg, const_rtx from_insn, const_rtx to_insn)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   if (from_insn == to_insn)
 return 0;
@@ -858,7 +858,7 @@ reg_referenced_p (const_rtx x, const_rtx body)
 int
 reg_set_between_p (const_rtx reg, const_rtx from_insn, const_rtx to_insn)
 {
-  const_rtx insn;
+  const rtx_insn *insn;
 
   if (from_insn == to_insn)
 return 0;
@@ -899,7 +899,7 @@ modified_between_p (const_rtx x, const_rtx start, const_rtx 
end)
   const enum rtx_code code = GET_CODE (x);
   const char *fmt;
   int i, j;
-  rtx insn;
+  rtx_insn *insn;
 
   if (start == end)
 return 0;
@@ -2100,7 +2100,7 @@ remove_reg_equal_equiv_notes_for_regno (unsigned int 
regno)
  over the head.  We plan to drain the list anyway.  */
   while ((eq_use = DF_REG_EQ_USE_CHAIN (regno)) != NULL)
 {
-  rtx insn = DF_REF_INSN (eq_use);
+  rtx_insn *insn = DF_REF_INSN (eq_use);
   rtx note = find_reg_equal_equiv_note (insn);
 
   /* This assert is generally triggered when someone deletes a REG_EQUAL
@@ -3777,7 +3777,7 @@ keep_with_call_p (const_rtx insn)
  /* This CONST_CAST is okay because next_nonnote_insn just
 returns its argument and we assign it to a const_rtx
 variable.  */
- const_rtx i2 = next_nonnote_insn (CONST_CAST_RTX (insn));
+ const rtx_insn *i2 = next_nonnote_insn (CONST_CAST_RTX (insn));
  if (i2 && keep_with_call_p (i2))
return true;
}
-- 
1.8.5.3



[PATCH 098/236] postreload.c: Use rtx_insn (also touches rtl.h and cprop.c)

2014-08-06 Thread David Malcolm
Also, update fis_get_condition

gcc/
* rtl.h (fis_get_condition): Strengthen param "jump" from rtx to
rtx_insn *.

* cprop.c (fis_get_condition): Likewise.

* postreload.c (reload_cse_regs): Likewise for param "first".
(reload_cse_simplify): Likewise for param "insn".
(reload_cse_regs_1): Likewise for local "insn".
(reload_cse_simplify_set): Likewise for param "insn".
(reload_cse_simplify_operands): Likewise.
(struct reg_use): Likewise for field "insn".
(reload_combine_purge_insn_uses): Likewise for param "insn".
(fixup_debug_insns): Likewise for params "from", "to" and local
"insn".
(try_replace_in_use): Likewise for local "use_insn".
(reload_combine_recognize_const_pattern): Likewise for param
"insn" and locals "add_moved_after_insn", "use_insn".
(reload_combine_recognize_pattern): Likewise for param "insn" and
local "prev".
(reload_combine): Likewise for locals "insn", "prev".
(reload_combine_note_use): Likewise for param "insn".
(move2add_use_add2_insn): Likewise.
(move2add_use_add3_insn): Likewise.
(reload_cse_move2add): Likewise, also for local "next".
(move2add_note_store): Likewise for local "insn".
---
 gcc/cprop.c  |  2 +-
 gcc/postreload.c | 56 
 gcc/rtl.h|  2 +-
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/gcc/cprop.c b/gcc/cprop.c
index 1378161..3826b74 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1287,7 +1287,7 @@ local_cprop_pass (void)
but this would require some code reorganization.  */
 
 rtx
-fis_get_condition (rtx jump)
+fis_get_condition (rtx_insn *jump)
 {
   return get_condition (jump, NULL, false, true);
 }
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 29ba81b..a598ae5 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -46,23 +46,23 @@ along with GCC; see the file COPYING3.  If not see
 #include "dbgcnt.h"
 
 static int reload_cse_noop_set_p (rtx);
-static bool reload_cse_simplify (rtx, rtx);
+static bool reload_cse_simplify (rtx_insn *, rtx);
 static void reload_cse_regs_1 (void);
-static int reload_cse_simplify_set (rtx, rtx);
-static int reload_cse_simplify_operands (rtx, rtx);
+static int reload_cse_simplify_set (rtx, rtx_insn *);
+static int reload_cse_simplify_operands (rtx_insn *, rtx);
 
 static void reload_combine (void);
-static void reload_combine_note_use (rtx *, rtx, int, rtx);
+static void reload_combine_note_use (rtx *, rtx_insn *, int, rtx);
 static void reload_combine_note_store (rtx, const_rtx, void *);
 
-static bool reload_cse_move2add (rtx);
+static bool reload_cse_move2add (rtx_insn *);
 static void move2add_note_store (rtx, const_rtx, void *);
 
 /* Call cse / combine like post-reload optimization phases.
FIRST is the first instruction.  */
 
 static void
-reload_cse_regs (rtx first ATTRIBUTE_UNUSED)
+reload_cse_regs (rtx_insn *first ATTRIBUTE_UNUSED)
 {
   bool moves_converted;
   reload_cse_regs_1 ();
@@ -88,7 +88,7 @@ reload_cse_noop_set_p (rtx set)
 
 /* Try to simplify INSN.  Return true if the CFG may have changed.  */
 static bool
-reload_cse_simplify (rtx insn, rtx testreg)
+reload_cse_simplify (rtx_insn *insn, rtx testreg)
 {
   rtx body = PATTERN (insn);
   basic_block insn_bb = BLOCK_FOR_INSN (insn);
@@ -207,7 +207,7 @@ reload_cse_regs_1 (void)
 {
   bool cfg_changed = false;
   basic_block bb;
-  rtx insn;
+  rtx_insn *insn;
   rtx testreg = gen_rtx_REG (VOIDmode, -1);
 
   cselib_init (CSELIB_RECORD_MEMORY);
@@ -236,7 +236,7 @@ reload_cse_regs_1 (void)
and change the set into a register copy.  */
 
 static int
-reload_cse_simplify_set (rtx set, rtx insn)
+reload_cse_simplify_set (rtx set, rtx_insn *insn)
 {
   int did_change = 0;
   int dreg;
@@ -380,7 +380,7 @@ reload_cse_simplify_set (rtx set, rtx insn)
hard registers.  */
 
 static int
-reload_cse_simplify_operands (rtx insn, rtx testreg)
+reload_cse_simplify_operands (rtx_insn *insn, rtx testreg)
 {
   int i, j;
 
@@ -686,7 +686,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
 struct reg_use
 {
   /* The insn where a register has been used.  */
-  rtx insn;
+  rtx_insn *insn;
   /* Points to the memory reference enclosing the use, if any, NULL_RTX
  otherwise.  */
   rtx containing_mem;
@@ -784,7 +784,7 @@ reload_combine_split_ruids (int split_ruid)
information about uses in that particular insn.  */
 
 static void
-reload_combine_purge_insn_uses (rtx insn)
+reload_combine_purge_insn_uses (rtx_insn *insn)
 {
   unsigned i;
 
@@ -869,9 +869,9 @@ reload_combine_closest_single_use (unsigned regno, int 
ruid_limit)
should make this change on debug insns.  */
 
 static void
-fixup_debug_insns (rtx reg, rtx replacement, rtx from, rtx to)
+fixup_debug_insns (rtx reg, rtx replacement, rtx_insn *from, rtx_insn *to)
 {
-  rtx insn;
+  rtx_insn *insn;
   for (insn = from; insn != to;

[PATCH 078/236] genpeep.c: peephole requires an rtx_insn

2014-08-06 Thread David Malcolm
Given an alphabetical ordering of this phase of the patches we can do this
now, since the argument of peephole in final.c is by now an rtx_insn *.

gcc/
* genpeep.c (main): Rename param back from "uncast_ins1" to
"ins1", strengthening from rtx to rtx_insn *.  Drop now-redundant
checked cast.

* output.h (peephole): Strengthen param from rtx to rtx_insn *.
---
 gcc/genpeep.c | 3 +--
 gcc/output.h  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index bc2785e..440f444 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -378,8 +378,7 @@ from the machine description file `md'.  */\n\n");
   printf ("extern rtx peep_operand[];\n\n");
   printf ("#define operands peep_operand\n\n");
 
-  printf ("rtx_insn *\npeephole (rtx uncast_ins1)\n{\n");
-  printf ("  rtx_insn *ins1 = as_a  (uncast_ins1);\n");
+  printf ("rtx_insn *\npeephole (rtx_insn *ins1)\n{\n");
   printf ("  rtx_insn *insn ATTRIBUTE_UNUSED;\n");
   printf ("  rtx x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
 
diff --git a/gcc/output.h b/gcc/output.h
index e4799cf..0b63737 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -281,7 +281,7 @@ extern void assemble_addr_to_section (rtx, section *);
 extern int get_pool_size (void);
 
 #ifdef HAVE_peephole
-extern rtx_insn *peephole (rtx);
+extern rtx_insn *peephole (rtx_insn *);
 #endif
 
 extern void output_shared_constant_pool (void);
-- 
1.8.5.3



[PATCH 094/236] get_ebb_head_tail works with rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* sched-int.h (get_ebb_head_tail): Strengthen params "headp" and
"tailp" from rtx * to rtx_insn **.

* ddg.c (build_intra_loop_deps): Strengthen locals head", "tail"
from rtx to rtx_insn *.
* haifa-sched.c (get_ebb_head_tail): Strengthen params "headp" and
"tailp" from rtx * to rtx_insn **.  Strengthen locals "beg_head",
"beg_tail", "end_head", "end_tail", "note", "next", "prev" from
rtx to rtx_insn *.
* modulo-sched.c (const_iteration_count): Strengthen return type
and locals "insn", "head", "tail" from rtx to rtx_insn *.  Replace
use of NULL_RTX with NULL when working with insns.
(loop_single_full_bb_p): Strengthen locals "head", "tail" from rtx
to rtx_insn *.
(sms_schedule): Likewise.
* sched-rgn.c (init_ready_list): Likewise, also for locals
"src_head" and "src_next_tail".
(compute_block_dependences): Likewise.
(free_block_dependencies): Likewise.
(debug_rgn_dependencies): Likewise.
(free_rgn_deps): Likewise.
(compute_priorities): Likewise.
(schedule_region): Likewise.
* sel-sched.c (find_ebb_boundaries): Likewise.

* config/sh/sh.c (find_insn_regmode_weight): Strengthen locals
"insn", "next_tail", "head", "tail" from rtx to rtx_insn *.
---
 gcc/config/sh/sh.c |  2 +-
 gcc/ddg.c  |  2 +-
 gcc/haifa-sched.c  | 15 ---
 gcc/modulo-sched.c | 20 ++--
 gcc/sched-int.h|  3 ++-
 gcc/sched-rgn.c| 22 +++---
 gcc/sel-sched.c|  2 +-
 7 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index df6a5bb..a1374e0 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -11067,7 +11067,7 @@ find_insn_regmode_weight (rtx insn, enum machine_mode 
mode)
 static void
 find_regmode_weight (basic_block b, enum machine_mode mode)
 {
-  rtx insn, next_tail, head, tail;
+  rtx_insn *insn, *next_tail, *head, *tail;
 
   get_ebb_head_tail (b, b, &head, &tail);
   next_tail = NEXT_INSN (tail);
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 1da2836..6baca86 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -507,7 +507,7 @@ build_intra_loop_deps (ddg_ptr g)
   int i;
   /* Hold the dependency analysis state during dependency calculations.  */
   struct deps_desc tmp_deps;
-  rtx head, tail;
+  rtx_insn *head, *tail;
 
   /* Build the dependence information, using the sched_analyze function.  */
   init_deps_global ();
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index fd46977..4e8a772 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -4686,12 +4686,13 @@ resolve_dependencies (rtx insn)
 /* Return the head and tail pointers of ebb starting at BEG and ending
at END.  */
 void
-get_ebb_head_tail (basic_block beg, basic_block end, rtx *headp, rtx *tailp)
+get_ebb_head_tail (basic_block beg, basic_block end,
+  rtx_insn **headp, rtx_insn **tailp)
 {
-  rtx beg_head = BB_HEAD (beg);
-  rtx beg_tail = BB_END (beg);
-  rtx end_head = BB_HEAD (end);
-  rtx end_tail = BB_END (end);
+  rtx_insn *beg_head = BB_HEAD (beg);
+  rtx_insn * beg_tail = BB_END (beg);
+  rtx_insn * end_head = BB_HEAD (end);
+  rtx_insn * end_tail = BB_END (end);
 
   /* Don't include any notes or labels at the beginning of the BEG
  basic block, or notes at the end of the END basic blocks.  */
@@ -4704,7 +4705,7 @@ get_ebb_head_tail (basic_block beg, basic_block end, rtx 
*headp, rtx *tailp)
   beg_head = NEXT_INSN (beg_head);
 else if (DEBUG_INSN_P (beg_head))
   {
-   rtx note, next;
+   rtx_insn * note, *next;
 
for (note = NEXT_INSN (beg_head);
 note != beg_tail;
@@ -4742,7 +4743,7 @@ get_ebb_head_tail (basic_block beg, basic_block end, rtx 
*headp, rtx *tailp)
   end_tail = PREV_INSN (end_tail);
 else if (DEBUG_INSN_P (end_tail))
   {
-   rtx note, prev;
+   rtx_insn * note, *prev;
 
for (note = PREV_INSN (end_tail);
 note != end_head;
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 16caa8f..328026a 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -392,17 +392,17 @@ doloop_register_get (rtx head ATTRIBUTE_UNUSED, rtx tail 
ATTRIBUTE_UNUSED)
 
 /* Check if COUNT_REG is set to a constant in the PRE_HEADER block, so
that the number of iterations is a compile-time constant.  If so,
-   return the rtx that sets COUNT_REG to a constant, and set COUNT to
+   return the rtx_insn that sets COUNT_REG to a constant, and set COUNT to
this constant.  Otherwise return 0.  */
-static rtx
+static rtx_insn *
 const_iteration_count (rtx count_reg, basic_block pre_header,
   int64_t * count)
 {
-  rtx insn;
-  rtx head, tail;
+  rtx_insn *insn;
+  rtx_insn *head, *tail;
 
   if (! pre_header)
-return NULL_RTX;
+return NULL;
 
   get_ebb_head_tail (pre_header, pre_header, &head, &tail);
 
@@ -418,10 +418,10 

[PATCH 072/236] explow.c: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* explow.c (force_reg): Strengthen local "insn" from rtx to
rtx_insn *.
(adjust_stack_1): Likewise.
(allocate_dynamic_stack_space): Likewise.  Strengthen locals
"final_label", "available_label", "space_available" from rtx to
rtx_code_label *.
(probe_stack_range): Likewise for locals "loop_lab", "end_lab".
(anti_adjust_stack_and_probe): Likewise.
---
 gcc/explow.c | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/gcc/explow.c b/gcc/explow.c
index e39db05..88beb3b 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -649,7 +649,8 @@ copy_to_mode_reg (enum machine_mode mode, rtx x)
 rtx
 force_reg (enum machine_mode mode, rtx x)
 {
-  rtx temp, insn, set;
+  rtx temp, set;
+  rtx_insn *insn;
 
   if (REG_P (x))
 return x;
@@ -880,7 +881,8 @@ static bool suppress_reg_args_size;
 static void
 adjust_stack_1 (rtx adjust, bool anti_p)
 {
-  rtx temp, insn;
+  rtx temp;
+  rtx_insn *insn;
 
 #ifndef STACK_GROWS_DOWNWARD
   /* Hereafter anti_p means subtract_p.  */
@@ -1160,7 +1162,8 @@ allocate_dynamic_stack_space (rtx size, unsigned 
size_align,
  unsigned required_align, bool cannot_accumulate)
 {
   HOST_WIDE_INT stack_usage_size = -1;
-  rtx final_label, final_target, target;
+  rtx_code_label *final_label;
+  rtx final_target, target;
   unsigned extra_align = 0;
   bool must_align;
 
@@ -1184,7 +1187,8 @@ allocate_dynamic_stack_space (rtx size, unsigned 
size_align,
 {
  /* Look into the last emitted insn and see if we can deduce
 something for the register.  */
- rtx insn, set, note;
+ rtx_insn *insn;
+ rtx set, note;
  insn = get_last_insn ();
  if ((set = single_set (insn)) && rtx_equal_p (SET_DEST (set), size))
{
@@ -1313,7 +1317,7 @@ allocate_dynamic_stack_space (rtx size, unsigned 
size_align,
current_function_has_unbounded_dynamic_stack_size = 1;
 }
 
-  final_label = NULL_RTX;
+  final_label = NULL;
   final_target = NULL_RTX;
 
   /* If we are splitting the stack, we need to ask the backend whether
@@ -1325,9 +1329,10 @@ allocate_dynamic_stack_space (rtx size, unsigned 
size_align,
  least it doesn't cause a stack overflow.  */
   if (flag_split_stack)
 {
-  rtx available_label, ask, space, func;
+  rtx_code_label *available_label;
+  rtx ask, space, func;
 
-  available_label = NULL_RTX;
+  available_label = NULL;
 
 #ifdef HAVE_split_stack_space_check
   if (HAVE_split_stack_space_check)
@@ -1420,7 +1425,7 @@ allocate_dynamic_stack_space (rtx size, unsigned 
size_align,
   if (crtl->limit_stack)
{
  rtx available;
- rtx space_available = gen_label_rtx ();
+ rtx_code_label *space_available = gen_label_rtx ();
 #ifdef STACK_GROWS_DOWNWARD
  available = expand_binop (Pmode, sub_optab,
stack_pointer_rtx, stack_limit_rtx,
@@ -1622,9 +1627,8 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
   else
 {
   rtx rounded_size, rounded_size_op, test_addr, last_addr, temp;
-  rtx loop_lab = gen_label_rtx ();
-  rtx end_lab = gen_label_rtx ();
-
+  rtx_code_label *loop_lab = gen_label_rtx ();
+  rtx_code_label *end_lab = gen_label_rtx ();
 
   /* Step 1: round SIZE to the previous multiple of the interval.  */
 
@@ -1770,8 +1774,8 @@ anti_adjust_stack_and_probe (rtx size, bool adjust_back)
   else
 {
   rtx rounded_size, rounded_size_op, last_addr, temp;
-  rtx loop_lab = gen_label_rtx ();
-  rtx end_lab = gen_label_rtx ();
+  rtx_code_label *loop_lab = gen_label_rtx ();
+  rtx_code_label *end_lab = gen_label_rtx ();
 
 
   /* Step 1: round SIZE to the previous multiple of the interval.  */
-- 
1.8.5.3



[PATCH 180/236] Params of add_insn and unlink_insn_chain

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (add_insn): Strengthen param from rtx to rtx_insn *.
(unlink_insn_chain): Strengthen both params from rtx to
rtx_insn *.

* cfgrtl.c (cfg_layout_function_header): Likewise for this
variable.
(unlink_insn_chain): Likewise for params "first" and "last".
Remove now-redundant checked cast.
(record_effective_endpoints): Replace use of NULL_RTX with NULL.
(fixup_reorder_chain): Strengthen local "insn" from rtx to
rtx_insn *.
* emit-rtl.c (link_insn_into_chain): Likewise for all three
params.
(add_insn): Likewise for param "insn" and local "prev".
(add_insn_after_nobb): Likewise for both params and local "next".
(add_insn_before_nobb): Likewise for both params and local "prev".
(add_insn_after): Rename param "after" to "uncast_after",
introducing local "after" with another checked cast.
(add_insn_before): Rename params "insn" and "before", giving them
"uncast_" prefixes, adding the old names back using checked casts.
(emit_note_after): Likewise for param "after".
(emit_note_before): Likewise for param "before".
(emit_label): Add a checked cast.
---
 gcc/cfgrtl.c   | 10 +-
 gcc/emit-rtl.c | 29 +
 gcc/rtl.h  |  4 ++--
 3 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 965517b..b20e871 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -65,7 +65,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Holds the interesting leading and trailing notes for the function.
Only applicable if the CFG is in cfglayout mode.  */
 static GTY(()) rtx_insn *cfg_layout_function_footer;
-static GTY(()) rtx cfg_layout_function_header;
+static GTY(()) rtx_insn *cfg_layout_function_header;
 
 static rtx_insn *skip_insns_after_block (basic_block);
 static void record_effective_endpoints (void);
@@ -3306,7 +3306,7 @@ fixup_abnormal_edges (void)
 /* Cut the insns from FIRST to LAST out of the insns stream.  */
 
 rtx_insn *
-unlink_insn_chain (rtx first, rtx last)
+unlink_insn_chain (rtx_insn *first, rtx_insn *last)
 {
   rtx_insn *prevfirst = PREV_INSN (first);
   rtx_insn *nextlast = NEXT_INSN (last);
@@ -3321,7 +3321,7 @@ unlink_insn_chain (rtx first, rtx last)
 set_last_insn (prevfirst);
   if (!prevfirst)
 set_first_insn (nextlast);
-  return as_a  (first);
+  return first;
 }
 
 /* Skip over inter-block insns occurring after BB which are typically
@@ -3449,7 +3449,7 @@ record_effective_endpoints (void)
 cfg_layout_function_header =
unlink_insn_chain (get_insns (), PREV_INSN (insn));
   else
-cfg_layout_function_header = NULL_RTX;
+cfg_layout_function_header = NULL;
 
   next_insn = get_insns ();
   FOR_EACH_BB_FN (bb, cfun)
@@ -3642,7 +3642,7 @@ static void
 fixup_reorder_chain (void)
 {
   basic_block bb;
-  rtx insn = NULL;
+  rtx_insn *insn = NULL;
 
   if (cfg_layout_function_header)
 {
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 7a6a069..2d0f506 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3860,7 +3860,7 @@ make_note_raw (enum insn_note subtype)
but also BARRIERs and JUMP_TABLE_DATAs.  PREV and NEXT may be NULL.  */
 
 static inline void
-link_insn_into_chain (rtx insn, rtx prev, rtx next)
+link_insn_into_chain (rtx_insn *insn, rtx_insn *prev, rtx_insn *next)
 {
   SET_PREV_INSN (insn) = prev;
   SET_NEXT_INSN (insn) = next;
@@ -3892,9 +3892,9 @@ link_insn_into_chain (rtx insn, rtx prev, rtx next)
INSN may be an INSN, JUMP_INSN, CALL_INSN, CODE_LABEL, BARRIER or NOTE.  */
 
 void
-add_insn (rtx insn)
+add_insn (rtx_insn *insn)
 {
-  rtx prev = get_last_insn ();
+  rtx_insn *prev = get_last_insn ();
   link_insn_into_chain (insn, prev, NULL);
   if (NULL == get_insns ())
 set_first_insn (insn);
@@ -3904,9 +3904,9 @@ add_insn (rtx insn)
 /* Add INSN into the doubly-linked list after insn AFTER.  */
 
 static void
-add_insn_after_nobb (rtx insn, rtx after)
+add_insn_after_nobb (rtx_insn *insn, rtx_insn *after)
 {
-  rtx next = NEXT_INSN (after);
+  rtx_insn *next = NEXT_INSN (after);
 
   gcc_assert (!optimize || !INSN_DELETED_P (after));
 
@@ -3933,9 +3933,9 @@ add_insn_after_nobb (rtx insn, rtx after)
 /* Add INSN into the doubly-linked list before insn BEFORE.  */
 
 static void
-add_insn_before_nobb (rtx insn, rtx before)
+add_insn_before_nobb (rtx_insn *insn, rtx_insn *before)
 {
-  rtx prev = PREV_INSN (before);
+  rtx_insn *prev = PREV_INSN (before);
 
   gcc_assert (!optimize || !INSN_DELETED_P (before));
 
@@ -3969,9 +3969,10 @@ add_insn_before_nobb (rtx insn, rtx before)
they know how to update a SEQUENCE. */
 
 void
-add_insn_after (rtx uncast_insn, rtx after, basic_block bb)
+add_insn_after (rtx uncast_insn, rtx uncast_after, basic_block bb)
 {
   rtx_insn *insn = as_a  (uncast_insn);
+  rtx_insn *after = as_a  (uncast_after);
   add_insn_after_nobb (insn, after);
   if (!B

[PATCH 161/236] reorder_insns requires rtx_insn *

2014-08-06 Thread David Malcolm
All in-tree users of reorder_insns should now use rtx_insn * for each
param.

gcc/
* rtl.h (reorder_insns): Strengthen params "from", "to", "after"
from rtx to rtx_insn *.

* emit-rtl.c (reorder_insns): Likewise, also for local "insn".
---
 gcc/emit-rtl.c | 4 ++--
 gcc/rtl.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 05b787b..74d6f80 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4200,9 +4200,9 @@ reorder_insns_nobb (rtx from, rtx to, rtx after)
 
 /* Same as function above, but take care to update BB boundaries.  */
 void
-reorder_insns (rtx from, rtx to, rtx after)
+reorder_insns (rtx_insn *from, rtx_insn *to, rtx_insn *after)
 {
-  rtx prev = PREV_INSN (from);
+  rtx_insn *prev = PREV_INSN (from);
   basic_block bb, bb2;
 
   reorder_insns_nobb (from, to, after);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 4c1d20b..0a245cc 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3048,7 +3048,7 @@ extern void mark_reg_pointer (rtx, int);
 extern void mark_user_reg (rtx);
 extern void reset_used_flags (rtx);
 extern void set_used_flags (rtx);
-extern void reorder_insns (rtx, rtx, rtx);
+extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *);
 extern void reorder_insns_nobb (rtx, rtx, rtx);
 extern int get_max_insn_count (void);
 extern int in_sequence_p (void);
-- 
1.8.5.3



[PATCH 174/236] Remove VINSN_INSN_RTX scaffolding

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.h (struct vinsn_def): Strengthen field "insn_rtx"
from rtx to rtx_insn *.
(VINSN_INSN_RTX): Eliminate rvalue function and...
(SET_VINSN_INSN): ...lvalue function in favor of...
(VINSN_INSN_RTX): reinstate this old macro.

* sel-sched-ir.c (vinsn_init): Eliminate use of SET_VINSN_INSN_RTX
in favor of VINSN_INSN_RTX.
(VINSN_INSN_RTX): Delete this function.
(SET_VINSN_INSN_RTX): Likewise.

/
* rtx-classes-status.txt: Delete SET_VINSN_INSN_RTX.
---
 gcc/sel-sched-ir.c | 12 +---
 gcc/sel-sched-ir.h |  5 ++---
 rtx-classes-status.txt |  1 -
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index a15bfc0..a996cc8 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1182,7 +1182,7 @@ vinsn_init (vinsn_t vi, insn_t insn, bool force_unique_p)
   hash_rtx_callback_function hrcf;
   int insn_class;
 
-  SET_VINSN_INSN_RTX (vi) = insn;
+  VINSN_INSN_RTX (vi) = insn;
   VINSN_COUNT (vi) = 0;
   vi->cost = -1;
 
@@ -6454,14 +6454,4 @@ sel_remove_loop_preheader (void)
   preheader_blocks);
 }
 
-rtx_insn *VINSN_INSN_RTX (vinsn_t vi)
-{
-  return as_a_nullable  (vi->insn_rtx);
-}
-
-rtx& SET_VINSN_INSN_RTX (vinsn_t vi)
-{
-  return vi->insn_rtx;
-}
-
 #endif
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 118e001..9f1fb6b 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -655,7 +655,7 @@ struct idata_def
 struct vinsn_def
 {
   /* Associated insn.  */
-  rtx insn_rtx;
+  rtx_insn *insn_rtx;
 
   /* Its description.  */
   struct idata_def id;
@@ -677,8 +677,7 @@ struct vinsn_def
   bool may_trap_p;
 };
 
-extern rtx_insn *VINSN_INSN_RTX (vinsn_t);
-extern rtx& SET_VINSN_INSN_RTX (vinsn_t);
+#define VINSN_INSN_RTX(VI) ((VI)->insn_rtx)
 #define VINSN_PATTERN(VI) (PATTERN (VINSN_INSN_RTX (VI)))
 
 #define VINSN_ID(VI) (&((VI)->id))
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 29d445f..347114b 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -14,4 +14,3 @@ TODO: "Scaffolding" to be removed
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER
 * SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
-* SET_VINSN_INSN_RTX
-- 
1.8.5.3



[PATCH 039/236] create_insn_rtx_from_pattern and create_copy_of_insn_rtx return rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.h (create_insn_rtx_from_pattern): Strengthen return
type from rtx to rtx_insn *.
* sel-sched-ir.h (create_copy_of_insn_rtx): Likewise.
* sel-sched-ir.c (create_insn_rtx_from_pattern): Likewise.
* sel-sched-ir.c (create_copy_of_insn_rtx): Likewise, also for
local "res".
---
 gcc/sel-sched-ir.c | 9 +
 gcc/sel-sched-ir.h | 4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 43569ee..f51f4f3 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -5724,10 +5724,10 @@ sel_unregister_cfg_hooks (void)
 
 /* Emit an insn rtx based on PATTERN.  If a jump insn is wanted,
LABEL is where this jump should be directed.  */
-rtx
+rtx_insn *
 create_insn_rtx_from_pattern (rtx pattern, rtx label)
 {
-  rtx insn_rtx;
+  rtx_insn *insn_rtx;
 
   gcc_assert (!INSN_P (pattern));
 
@@ -5767,10 +5767,11 @@ create_vinsn_from_insn_rtx (rtx insn_rtx, bool 
force_unique_p)
 }
 
 /* Create a copy of INSN_RTX.  */
-rtx
+rtx_insn *
 create_copy_of_insn_rtx (rtx insn_rtx)
 {
-  rtx res, link;
+  rtx_insn *res;
+  rtx link;
 
   if (DEBUG_INSN_P (insn_rtx))
 return create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)),
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 16e7806..d2bf7e2 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1629,9 +1629,9 @@ extern void sel_register_cfg_hooks (void);
 extern void sel_unregister_cfg_hooks (void);
 
 /* Expression transformation routines.  */
-extern rtx create_insn_rtx_from_pattern (rtx, rtx);
+extern rtx_insn *create_insn_rtx_from_pattern (rtx, rtx);
 extern vinsn_t create_vinsn_from_insn_rtx (rtx, bool);
-extern rtx create_copy_of_insn_rtx (rtx);
+extern rtx_insn *create_copy_of_insn_rtx (rtx);
 extern void change_vinsn_in_expr (expr_t, vinsn_t);
 
 /* Various initialization functions.  */
-- 
1.8.5.3



[PATCH 196/236] Convert various INSN accessors in rtl.h to inline functions

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (INSN_UID): Convert from a macro to a pair of inline
functions.  Require merely an rtx for now, not an rtx_insn *,
or rtx_real_insn *.
(BLOCK_FOR_INSN): Likewise.
(INSN_LOCATION): Likewise.
(INSN_HAS_LOCATION): Convert from a macro to an inline function.
---
 gcc/rtl.h | 38 --
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 640616f..9069ea7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1191,8 +1191,16 @@ extern void rtl_check_failed_flag (const char *, 
const_rtx, const char *,
 
 /* Holds a unique number for each insn.
These are not necessarily sequentially increasing.  */
-#define INSN_UID(INSN) \
-  (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
+inline int INSN_UID (const_rtx insn)
+{
+  return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
+   (insn))->u2.insn_uid;
+}
+inline int& INSN_UID (rtx insn)
+{
+  return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID",
+   (insn))->u2.insn_uid;
+}
 
 /* Chain insns together in sequence.  */
 
@@ -1223,7 +1231,15 @@ inline rtx& SET_NEXT_INSN (rtx insn)
   return XEXP (insn, 1);
 }
 
-#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
+inline basic_block BLOCK_FOR_INSN (const_rtx insn)
+{
+  return XBBDEF (insn, 2);
+}
+
+inline basic_block& BLOCK_FOR_INSN (rtx insn)
+{
+  return XBBDEF (insn, 2);
+}
 
 /* The body of an insn.  */
 inline rtx PATTERN (const_rtx insn)
@@ -1236,10 +1252,20 @@ inline rtx& PATTERN (rtx insn)
   return XEXP (insn, 3);
 }
 
-#define INSN_LOCATION(INSN) XUINT (INSN, 4)
+inline unsigned int INSN_LOCATION (const_rtx insn)
+{
+  return XUINT (insn, 4);
+}
+
+inline unsigned int& INSN_LOCATION (rtx insn)
+{
+  return XUINT (insn, 4);
+}
 
-#define INSN_HAS_LOCATION(INSN) ((LOCATION_LOCUS (INSN_LOCATION (INSN)))\
-  != UNKNOWN_LOCATION)
+inline bool INSN_HAS_LOCATION (const_rtx insn)
+{
+  return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION;
+}
 
 /* LOCATION of an RTX if relevant.  */
 #define RTL_LOCATION(X) (INSN_P (X) ? \
-- 
1.8.5.3



[PATCH 022/236] Make tablejump_p accept a rtx_jump_table_data **

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (tablejump_p): Strengthen third param from rtx * to
rtx_jump_table_data **.

* cfgbuild.c (make_edges): Introduce local "table", using it in
place of "tmp" for jump table data.
(find_bb_boundaries): Strengthen local "table" from rtx to
rtx_jump_table_data *.
* cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise.
(outgoing_edges_match): Likewise for locals "table1" and "table2".
(try_crossjump_to_edge): Likewise.
* cfgrtl.c (try_redirect_by_replacing_jump): Likewise for local
"table".
(patch_jump_insn): Introduce local "table", using it in place of
"tmp" for jump table data.
(force_nonfallthru_and_redirect): Introduce local "table", so that
call to tablejump_p can receive an rtx_jump_table_data **.  Update
logic around the call to overwrite "note" appropriately if
tablejump_p returns non-zero.
(get_last_bb_insn): Introduce local "table", using it in place of
"tmp" for jump table data.
* dwarf2cfi.c (create_trace_edges): Likewise.

* config/arm/arm.c (get_jump_table_size): Strengthen param "insn"
from rtx to rtx_jump_table_data *.
(create_fix_barrier): Strengthen local "tmp" from rtx to
rtx_jump_table_data *.
(arm_reorg): Likewise for local "table".

* config/s390/s390.c (s390_chunkify_start): Likewise.

* config/spu/spu.c (spu_emit_branch_hint): Likewise.

* jump.c (delete_related_insns): Strengthen local "lab_next" from
rtx to rtx_jump_table_data *.

* rtlanal.c (tablejump_p): Strengthen param "tablep" from rtx * to
rtx_jump_table_data **.  Add a checked cast when writing through
the pointer: we know there that local "table" is non-NULL and that
JUMP_TABLE_DATA_P (table) holds.
(label_is_jump_target_p): Introduce local "table", using it in
place of "tmp" for jump table data.
---
 gcc/cfgbuild.c | 11 ++-
 gcc/cfgcleanup.c   |  7 ---
 gcc/cfgrtl.c   | 22 ++
 gcc/config/arm/arm.c   |  8 
 gcc/config/s390/s390.c |  2 +-
 gcc/config/spu/spu.c   |  2 +-
 gcc/dwarf2cfi.c|  6 --
 gcc/jump.c |  3 ++-
 gcc/rtl.h  |  2 +-
 gcc/rtlanal.c  | 11 ++-
 10 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 76d3a99..848e13f 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -252,6 +252,7 @@ make_edges (basic_block min, basic_block max, int update_p)
   if (code == JUMP_INSN)
{
  rtx tmp;
+ rtx_jump_table_data *table;
 
  /* Recognize a non-local goto as a branch outside the
 current function.  */
@@ -259,15 +260,15 @@ make_edges (basic_block min, basic_block max, int 
update_p)
;
 
  /* Recognize a tablejump and do the right thing.  */
- else if (tablejump_p (insn, NULL, &tmp))
+ else if (tablejump_p (insn, NULL, &table))
{
  rtvec vec;
  int j;
 
- if (GET_CODE (PATTERN (tmp)) == ADDR_VEC)
-   vec = XVEC (PATTERN (tmp), 0);
+ if (GET_CODE (PATTERN (table)) == ADDR_VEC)
+   vec = XVEC (PATTERN (table), 0);
  else
-   vec = XVEC (PATTERN (tmp), 1);
+   vec = XVEC (PATTERN (table), 1);
 
  for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
make_label_edge (edge_cache, bb,
@@ -444,7 +445,7 @@ find_bb_boundaries (basic_block bb)
   basic_block orig_bb = bb;
   rtx insn = BB_HEAD (bb);
   rtx end = BB_END (bb), x;
-  rtx table;
+  rtx_jump_table_data *table;
   rtx flow_transfer_insn = NULL_RTX;
   edge fallthru = NULL;
 
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index b6cb77b..e6a8084 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -704,7 +704,8 @@ static void
 merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
 {
   rtx barrier, real_b_end;
-  rtx label, table;
+  rtx label;
+  rtx_jump_table_data *table;
 
   /* If we are partitioning hot/cold basic blocks, we don't want to
  mess up unconditional or indirect jumps that cross between hot
@@ -1675,7 +1676,7 @@ outgoing_edges_match (int mode, basic_block bb1, 
basic_block bb2)
  Return true if they are identical.  */
 {
   rtx label1, label2;
-  rtx table1, table2;
+  rtx_jump_table_data *table1, *table2;
 
   if (tablejump_p (BB_END (bb1), &label1, &table1)
  && tablejump_p (BB_END (bb2), &label2, &table2)
@@ -1978,7 +1979,7 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
  so replace the references to TABLE1 by references to TABLE2.  */
 {
   rtx label1, label2;
-  rtx table1, table2;
+  rtx_jump_table_data *table1, *table2;
 
   if (tablejump_p (BB_END (osrc1), &label1, &table1)
  && tablejump

[PATCH 153/236] config/tilepro: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/tilepro/tilepro-protos.h (tilepro_output_cbranch_with_opcode):
Strengthen param 1 from rtx to rtx_insn *.
(tilepro_output_cbranch): Likewise.
(tilepro_adjust_insn_length): Likewise.
(tilepro_final_prescan_insn): Likewise for sole param.

* config/tilepro/tilepro.c (tilepro_legitimize_tls_address):
Likewise for local "last".
(cbranch_predicted_p): Likewise for param "insn".
(tilepro_output_simple_cbranch_with_opcode): Likewise.
(tilepro_output_cbranch_with_opcode): Likewise.
(tilepro_output_cbranch): Likewise.
(frame_emit_load): Likewise for return type and locals "seq",
"insn".
(emit_sp_adjust): Likewise for return type and local "insn".
(tilepro_expand_epilogue): Likewise for locals "last_insn",
"insn".
(tilepro_adjust_insn_length): Likewise for param "insn".
(next_insn_to_bundle): Likewise for return type and params
"r", "end".
(tilepro_gen_bundles): Likewise for locals "insn", "next", "end".
(replace_pc_relative_symbol_ref): Likewise for param "insn" and
local "new_insns".
(match_addli_pcrel): Likewise for param "insn".
(replace_addli_pcrel): Likewise.
(match_auli_pcrel): Likewise.
(replace_auli_pcrel): Likewise.
(tilepro_fixup_pcrel_references): Likewise for locals "insn",
"next_insn".
(reorder_var_tracking_notes): Likewise for locals "insn", "next",
"queue", "next_queue", "prev".
(tilepro_asm_output_mi_thunk): Likewise for local "insn".
(tilepro_final_prescan_insn): Likewise for param "insn".
---
 gcc/config/tilepro/tilepro-protos.h |  8 ++---
 gcc/config/tilepro/tilepro.c| 72 +++--
 2 files changed, 42 insertions(+), 38 deletions(-)

diff --git a/gcc/config/tilepro/tilepro-protos.h 
b/gcc/config/tilepro/tilepro-protos.h
index fcd29ab..fe9b81b 100644
--- a/gcc/config/tilepro/tilepro-protos.h
+++ b/gcc/config/tilepro/tilepro-protos.h
@@ -44,11 +44,11 @@ extern void tilepro_expand_umulsi3_highpart (rtx, rtx, rtx);
 extern bool tilepro_emit_setcc (rtx[], enum machine_mode);
 extern void tilepro_emit_conditional_branch (rtx[], enum machine_mode);
 extern rtx tilepro_emit_conditional_move (rtx);
-extern const char *tilepro_output_cbranch_with_opcode (rtx, rtx *,
+extern const char *tilepro_output_cbranch_with_opcode (rtx_insn *, rtx *,
   const char *,
   const char *, int,
   bool);
-extern const char *tilepro_output_cbranch (rtx, rtx *, bool);
+extern const char *tilepro_output_cbranch (rtx_insn *, rtx *, bool);
 extern void tilepro_expand_tablejump (rtx, rtx);
 extern void tilepro_expand_builtin_vector_binop (rtx (*)(rtx, rtx, rtx),
 enum machine_mode, rtx,
@@ -62,10 +62,10 @@ extern void tilepro_expand_epilogue (bool);
 extern int tilepro_initial_elimination_offset (int, int);
 extern rtx tilepro_return_addr (int, rtx);
 extern rtx tilepro_eh_return_handler_rtx (void);
-extern int tilepro_adjust_insn_length (rtx, int);
+extern int tilepro_adjust_insn_length (rtx_insn *, int);
 
 extern int tilepro_asm_preferred_eh_data_format (int, int);
-extern void tilepro_final_prescan_insn (rtx);
+extern void tilepro_final_prescan_insn (rtx_insn *);
 extern const char *tilepro_asm_output_opcode (FILE *, const char *);
 extern void tilepro_function_profiler (FILE *, int);
 
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 4dd60c5..520b485 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -897,7 +897,8 @@ tilepro_legitimize_tls_address (rtx addr)
   case TLS_MODEL_GLOBAL_DYNAMIC:
   case TLS_MODEL_LOCAL_DYNAMIC:
{
- rtx r0, temp1, temp2, temp3, got, last;
+ rtx r0, temp1, temp2, temp3, got;
+ rtx_insn *last;
 
  ret = gen_reg_rtx (Pmode);
  r0 = gen_rtx_REG (Pmode, 0);
@@ -917,7 +918,8 @@ tilepro_legitimize_tls_address (rtx addr)
}
   case TLS_MODEL_INITIAL_EXEC:
{
- rtx temp1, temp2, temp3, got, last;
+ rtx temp1, temp2, temp3, got;
+ rtx_insn *last;
 
  ret = gen_reg_rtx (Pmode);
  temp1 = gen_reg_rtx (Pmode);
@@ -939,7 +941,8 @@ tilepro_legitimize_tls_address (rtx addr)
}
   case TLS_MODEL_LOCAL_EXEC:
{
- rtx temp1, last;
+ rtx temp1;
+ rtx_insn *last;
 
  ret = gen_reg_rtx (Pmode);
  temp1 = gen_reg_rtx (Pmode);
@@ -2422,7 +2425,7 @@ tilepro_emit_conditional_move (rtx cmp)
 /* Return true if INSN is annotated with a REG_BR_PROB note that
indicates it's a branch that's predicted taken.  */
 static bool
-cbranch_predicted_p (rtx insn)
+cbranch_predicted_p (rtx_insn *insn)
 {

[PATCH 148/236] config/score/score.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/score/score.c (score_output_mi_thunk): Strengthen local
"insn" from rtx to rtx_insn *.
(score_prologue): Likewise.
---
 gcc/config/score/score.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index e429602..26c77a3 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -452,7 +452,8 @@ score_output_mi_thunk (FILE *file, tree thunk_fndecl 
ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
tree function)
 {
-  rtx this_rtx, temp1, insn, fnaddr;
+  rtx this_rtx, temp1, fnaddr;
+  rtx_insn *insn;
 
   /* Pretend to be a post-reload pass while generating rtl.  */
   reload_completed = 1;
@@ -1476,7 +1477,7 @@ score_prologue (void)
 
   if (size > 0)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   if (size >= -32768 && size <= 32767)
 EMIT_PL (emit_insn (gen_add3_insn (stack_pointer_rtx,
-- 
1.8.5.3



[PATCH 119/236] store-motion.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* store-motion.c (store_killed_in_insn): Strengthen param "insn"
from const_rtx to const rtx_insn *.
(store_killed_after): Likewise.  Strengthen locals "last", "act"
from rtx to rtx_insn *.
(store_killed_before): Strengthen param "insn" from const_rtx to
const rtx_insn *.  Strengthen local "first" from rtx to rtx_insn *.
(find_moveable_store): Strengthen param "insn" from rtx to
rtx_insn *.
(compute_store_table): Likewise for local "insn".
(insert_insn_start_basic_block): Likewise for param "insn" and
locals "prev", "before", "insn".
(insert_store): For now, add a checked cast to rtx_insn * on the
result of gen_move_insn.
(remove_reachable_equiv_notes): Strengthen local "insn" from rtx
to rtx_insn *.
(replace_store_insn): Likewise.  For now, add a checked cast to
rtx_insn * on the result of gen_move_insn.
---
 gcc/store-motion.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index b3e5890..567ab07 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -396,7 +396,7 @@ store_killed_in_pat (const_rtx x, const_rtx pat, int after)
after the insn.  Return true if it does.  */
 
 static bool
-store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after)
+store_killed_in_insn (const_rtx x, const_rtx x_regs, const rtx_insn *insn, int 
after)
 {
   const_rtx reg, note, pat;
 
@@ -458,10 +458,11 @@ store_killed_in_insn (const_rtx x, const_rtx x_regs, 
const_rtx insn, int after)
is killed, return the last insn in that it occurs in FAIL_INSN.  */
 
 static bool
-store_killed_after (const_rtx x, const_rtx x_regs, const_rtx insn, 
const_basic_block bb,
+store_killed_after (const_rtx x, const_rtx x_regs, const rtx_insn *insn,
+   const_basic_block bb,
int *regs_set_after, rtx *fail_insn)
 {
-  rtx last = BB_END (bb), act;
+  rtx_insn *last = BB_END (bb), *act;
 
   if (!store_ops_ok (x_regs, regs_set_after))
 {
@@ -487,10 +488,10 @@ store_killed_after (const_rtx x, const_rtx x_regs, 
const_rtx insn, const_basic_b
within basic block BB. X_REGS is list of registers mentioned in X.
REGS_SET_BEFORE is bitmap of registers set before or in this insn.  */
 static bool
-store_killed_before (const_rtx x, const_rtx x_regs, const_rtx insn, 
const_basic_block bb,
-int *regs_set_before)
+store_killed_before (const_rtx x, const_rtx x_regs, const rtx_insn *insn,
+const_basic_block bb, int *regs_set_before)
 {
-  rtx first = BB_HEAD (bb);
+  rtx_insn *first = BB_HEAD (bb);
 
   if (!store_ops_ok (x_regs, regs_set_before))
 return true;
@@ -536,7 +537,7 @@ store_killed_before (const_rtx x, const_rtx x_regs, 
const_rtx insn, const_basic_
*/
 
 static void
-find_moveable_store (rtx insn, int *regs_set_before, int *regs_set_after)
+find_moveable_store (rtx_insn *insn, int *regs_set_before, int *regs_set_after)
 {
   struct st_expr * ptr;
   rtx dest, set, tmp;
@@ -644,7 +645,8 @@ compute_store_table (void)
 #ifdef ENABLE_CHECKING
   unsigned regno;
 #endif
-  rtx insn, tmp;
+  rtx_insn *insn;
+  rtx tmp;
   df_ref *def_rec;
   int *last_set_in, *already_set;
   struct st_expr * ptr, **prev_next_ptr_ptr;
@@ -739,11 +741,11 @@ compute_store_table (void)
the BB_HEAD if needed.  */
 
 static void
-insert_insn_start_basic_block (rtx insn, basic_block bb)
+insert_insn_start_basic_block (rtx_insn *insn, basic_block bb)
 {
   /* Insert at start of successor block.  */
-  rtx prev = PREV_INSN (BB_HEAD (bb));
-  rtx before = BB_HEAD (bb);
+  rtx_insn *prev = PREV_INSN (BB_HEAD (bb));
+  rtx_insn *before = BB_HEAD (bb);
   while (before != 0)
 {
   if (! LABEL_P (before)
@@ -773,7 +775,8 @@ insert_insn_start_basic_block (rtx insn, basic_block bb)
 static int
 insert_store (struct st_expr * expr, edge e)
 {
-  rtx reg, insn;
+  rtx reg;
+  rtx_insn *insn;
   basic_block bb;
   edge tmp;
   edge_iterator ei;
@@ -787,7 +790,7 @@ insert_store (struct st_expr * expr, edge e)
 return 0;
 
   reg = expr->reaching_reg;
-  insn = gen_move_insn (copy_rtx (expr->pattern), reg);
+  insn = as_a  (gen_move_insn (copy_rtx (expr->pattern), reg));
 
   /* If we are inserting this expression on ALL predecessor edges of a BB,
  insert it at the start of the BB, and reset the insert bits on the other
@@ -845,7 +848,8 @@ remove_reachable_equiv_notes (basic_block bb, struct 
st_expr *smexpr)
   int sp;
   edge act;
   sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
-  rtx last, insn, note;
+  rtx last, note;
+  rtx_insn *insn;
   rtx mem = smexpr->pattern;
 
   stack = XNEWVEC (edge_iterator, n_basic_blocks_for_fn (cfun));
@@ -922,10 +926,11 @@ remove_reachable_equiv_notes (basic_block bb, struct 
st_expr *smexpr)
 static void
 replace_store_insn (rtx reg, rtx del, basic_bl

[PATCH 100/236] print-rtl.c: Use rtx_insn for various debug_ functions (also touches config/rs6000/rs6000.c)

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (debug_rtx_list): Strengthen param 1 "x" from const_rtx to
const rtx_insn *.
(debug_rtx_range): Likewise for params 1 and 2 "start" and "end".
(debug_rtx_find): Likewise for param 1 "x".

* print-rtl.c (debug_rtx_list): Strengthen param 1 "x" from
const_rtx to const rtx_insn *.  Likewise for local "insn".
(debug_rtx_range): Likewise for params 1 and 2 "start" and "end".
(debug_rtx_find): Likewise for param 1 "x".
(print_rtl): Likewise for local "tmp_rtx", adding a checked cast
from const_rtx to const rtx_insn * within the appropriate cases of
the switch statement.

* config/rs6000/rs6000.c (rs6000_debug_legitimize_address):
Strengthen local "insns" from rtx to rtx_insn * since this is
passed to a call to debug_rtx_list.
---
 gcc/config/rs6000/rs6000.c |  2 +-
 gcc/print-rtl.c| 24 ++--
 gcc/rtl.h  |  6 +++---
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 8d80146..5faf329 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6737,7 +6737,7 @@ static rtx
 rs6000_debug_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
 {
   rtx ret;
-  rtx insns;
+  rtx_insn *insns;
 
   start_sequence ();
   ret = rs6000_legitimize_address (x, oldx, mode);
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 2f9f547..58351ef 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -697,14 +697,15 @@ DEBUG_VARIABLE int debug_rtx_count = 0;   /* 0 is treated 
as equivalent to 1 */
 /* Call this function to print list from X on.
 
N is a count of the rtx's to print. Positive values print from the specified
-   rtx on.  Negative values print a window around the rtx.
-   EG: -5 prints 2 rtx's on either side (in addition to the specified rtx).  */
+   rtx_insn on.  Negative values print a window around the rtx_insn.
+   EG: -5 prints 2 rtx_insn's on either side (in addition to the specified
+   rtx_insn).  */
 
 DEBUG_FUNCTION void
-debug_rtx_list (const_rtx x, int n)
+debug_rtx_list (const rtx_insn *x, int n)
 {
   int i,count;
-  const_rtx insn;
+  const rtx_insn *insn;
 
   count = n == 0 ? 1 : n < 0 ? -n : n;
 
@@ -725,10 +726,11 @@ debug_rtx_list (const_rtx x, int n)
 }
 }
 
-/* Call this function to print an rtx list from START to END inclusive.  */
+/* Call this function to print an rtx_insn list from START to END
+   inclusive.  */
 
 DEBUG_FUNCTION void
-debug_rtx_range (const_rtx start, const_rtx end)
+debug_rtx_range (const rtx_insn *start, const rtx_insn *end)
 {
   while (1)
 {
@@ -740,12 +742,12 @@ debug_rtx_range (const_rtx start, const_rtx end)
 }
 }
 
-/* Call this function to search an rtx list to find one with insn uid UID,
+/* Call this function to search an rtx_insn list to find one with insn uid UID,
and then call debug_rtx_list to print it, using DEBUG_RTX_COUNT.
The found insn is returned to enable further debugging analysis.  */
 
 DEBUG_FUNCTION const_rtx
-debug_rtx_find (const_rtx x, int uid)
+debug_rtx_find (const rtx_insn *x, int uid)
 {
   while (x != 0 && INSN_UID (x) != uid)
 x = NEXT_INSN (x);
@@ -770,7 +772,7 @@ debug_rtx_find (const_rtx x, int uid)
 void
 print_rtl (FILE *outf, const_rtx rtx_first)
 {
-  const_rtx tmp_rtx;
+  const rtx_insn *tmp_rtx;
 
   outfile = outf;
   sawclose = 0;
@@ -790,7 +792,9 @@ print_rtl (FILE *outf, const_rtx rtx_first)
   case CODE_LABEL:
   case JUMP_TABLE_DATA:
   case BARRIER:
-   for (tmp_rtx = rtx_first; tmp_rtx != 0; tmp_rtx = NEXT_INSN (tmp_rtx))
+   for (tmp_rtx = as_a  (rtx_first);
+tmp_rtx != 0;
+tmp_rtx = NEXT_INSN (tmp_rtx))
  {
fputs (print_rtx_head, outfile);
print_rtx (tmp_rtx);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 759d9be..17da2be 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3105,9 +3105,9 @@ extern const char *print_rtx_head;
 extern void debug (const rtx_def &ref);
 extern void debug (const rtx_def *ptr);
 extern void debug_rtx (const_rtx);
-extern void debug_rtx_list (const_rtx, int);
-extern void debug_rtx_range (const_rtx, const_rtx);
-extern const_rtx debug_rtx_find (const_rtx, int);
+extern void debug_rtx_list (const rtx_insn *, int);
+extern void debug_rtx_range (const rtx_insn *, const rtx_insn *);
+extern const_rtx debug_rtx_find (const rtx_insn *, int);
 extern void print_mem_expr (FILE *, const_tree);
 extern void print_rtl (FILE *, const_rtx);
 extern void print_simple_rtl (FILE *, const_rtx);
-- 
1.8.5.3



[PATCH 139/236] config/mep: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* config/mep/mep-protos.h (mep_mulr_source): Strengthen first
param from rtx to rtx_insn *.
(mep_reuse_lo): Likewise for third param.
(mep_use_post_modify_p): Likewise for first param.
(mep_core_address_length): Likewise.
(mep_cop_address_length): Likewise.
(mep_final_prescan_insn): Likewise.
(mep_store_data_bypass_p): Likewise for both params.
(mep_mul_hilo_bypass_p): Likewise.
(mep_ipipe_ldc_p): Likewise for param.

* config/mep/mep.c (mep_mulr_source): Likewise for param "insn".
(mep_rewrite_mult): Likewise.
(mep_rewrite_mulsi3): Likewise.
(mep_rewrite_maddsi3): Likewise.
(mep_reuse_lo_p_1): Likewise.
(mep_reuse_lo_p): Likewise.
(mep_frame_expr): Likewise.
(mep_make_parallel): Likewise for both params.
(mep_use_post_modify_p_1): Likewise for param "set_insn" and
local "insn".
(mep_use_post_modify_p): Likewise for param "insn".
(mep_core_address_length): Likewise.
(mep_cop_address_length): Likewise.
(mep_reg_set_in_function): Likewise for local "insn".
(mep_asm_without_operands_p): Likewise.
(F): Likewise for return type and param "x".
(add_constant): Likewise for local "insn".
(maybe_dead_move): Likewise for return type and local "insn".
(mep_expand_prologue): Likewise for local "insn".
(mep_final_prescan_insn): Likewise for param "insn".
(mep_reorg_regmove): Likewise for param "insns" and locals "insn",
"next", "follow", "x".
(mep_insert_repeat_label_last): Likewise for return type, param
"last_insn", and locals "next", "prev".  Strengthen param "label"
from rtx to rtx_code_label *.
(struct mep_doloop_begin): Strengthen field "insn" from rtx to
rtx_insn *.
(struct mep_doloop_end): Likewise for fields "insn" and
"fallthrough".
(mep_reorg_repeat): Likewise for param "insns" and local "insn".
Strengthen local "repeat_label" from rtx to rtx_code_label *.
(mep_invertable_branch_p): Strengthen param "insn" from rtx to
rtx_insn *.
(mep_invert_branch): Likewise for params "insn" and "after".
(mep_reorg_erepeat): Likewise for param "insns" and locals
"insn", "prev", "new_last", "barrier", "user".  Strengthen local
"l" from rtx to rtx_code_label *.
(mep_jmp_return_reorg): Strengthen param "insns" and local "insn"
from rtx to rtx_insn *.
(mep_reorg_addcombine): Likewise for param "insns" and locals
"i", "n".
(add_sp_insn_p): Likewise for param "insn".
(mep_reorg_noframe): Likewise for param "insns" and locals
"start_frame_insn", "end_frame_insn", "next".
(mep_reorg): Likewise for local "insns".
(mep_store_data_bypass_1): Likewise for param "prev".  Add checked
cast.
(mep_store_data_bypass_p): Likewise for params "prev", "insn".
(mep_mul_hilo_bypass_p): Likewise.
(mep_ipipe_ldc_p): Likewise for param "insn".
(mep_make_bundle): Likewise for return type, param "cop" and local
"insn", splitting out the latter into a new local "seq" for when it
is a SEQUENCE rather than an insn.
(core_insn_p): Likewise for param "insn".
(mep_bundle_insns): Likewise for param "insns" and locals "insn",
"last", "first", "note", "prev", "core_insn".
---
 gcc/config/mep/mep-protos.h |  18 ++---
 gcc/config/mep/mep.c| 179 +++-
 2 files changed, 103 insertions(+), 94 deletions(-)

diff --git a/gcc/config/mep/mep-protos.h b/gcc/config/mep/mep-protos.h
index c4b74e5..e1903c7 100644
--- a/gcc/config/mep/mep-protos.h
+++ b/gcc/config/mep/mep-protos.h
@@ -19,9 +19,9 @@ along with GCC; see the file COPYING3.  If not see
 .  */
 
 extern int mep_regno_reg_class (int);
-extern rtx mep_mulr_source (rtx, rtx, rtx, rtx);
-extern bool mep_reuse_lo_p (rtx, rtx, rtx, bool);
-extern bool mep_use_post_modify_p (rtx, rtx, rtx);
+extern rtx mep_mulr_source (rtx_insn *, rtx, rtx, rtx);
+extern bool mep_reuse_lo_p (rtx, rtx, rtx_insn *, bool);
+extern bool mep_use_post_modify_p (rtx_insn *, rtx, rtx);
 extern bool mep_allow_clip (rtx, rtx, int);
 extern bool mep_bit_position_p (rtx, bool);
 extern bool mep_split_mov (rtx *, int);
@@ -31,8 +31,8 @@ extern bool mep_multi_slot (rtx);
 extern bool mep_legitimate_address (enum machine_mode, rtx, int);
 extern int mep_legitimize_address (rtx *, rtx, enum machine_mode);
 extern int mep_legitimize_reload_address (rtx *, enum machine_mode, int, 
/*enum reload_type*/ int, int);
-extern int mep_core_address_length (rtx, int);
-extern int mep_cop_address_length (rtx, int);
+extern int mep_core_address_length (rtx_insn *, int);
+extern int mep_cop_address_length (rtx_insn *, int);
 extern bool mep_expand_mov (rtx *, enum ma

[PATCH 031/236] emit_jump_table_data returns an rtx_jump_table_data *

2014-08-06 Thread David Malcolm
gcc/
* emit-rtl.c (emit_jump_table_data): Strengthen return type from
rtx to rtx_jump_table_data *.  Also for local.
* rtl.h (emit_jump_table_data): Likwise.
---
 gcc/emit-rtl.c | 5 +++--
 gcc/rtl.h  | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index afbb6a0..2614937 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -4985,10 +4985,11 @@ emit_label (rtx label)
 /* Make an insn of code JUMP_TABLE_DATA
and add it to the end of the doubly-linked list.  */
 
-rtx
+rtx_jump_table_data *
 emit_jump_table_data (rtx table)
 {
-  rtx jump_table_data = rtx_alloc (JUMP_TABLE_DATA);
+  rtx_jump_table_data *jump_table_data =
+as_a  (rtx_alloc (JUMP_TABLE_DATA));
   INSN_UID (jump_table_data) = cur_insn_uid++;
   PATTERN (jump_table_data) = table;
   BLOCK_FOR_INSN (jump_table_data) = NULL;
diff --git a/gcc/rtl.h b/gcc/rtl.h
index cca0e20..ed65d1e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2392,7 +2392,7 @@ extern rtx emit_debug_insn (rtx);
 extern rtx emit_jump_insn (rtx);
 extern rtx emit_call_insn (rtx);
 extern rtx emit_label (rtx);
-extern rtx emit_jump_table_data (rtx);
+extern rtx_jump_table_data *emit_jump_table_data (rtx);
 extern rtx emit_barrier (void);
 extern rtx_note *emit_note (enum insn_note);
 extern rtx_note *emit_note_copy (rtx_note *);
-- 
1.8.5.3



[PATCH 228/236] tablejump_p takes an rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (tablejump_p): Strengthen first param from const_rtx to
const rtx_insn *.
(label_is_jump_target_p): Likewise for second param.

* rtlanal.c (tablejump_p): Likewise for param "insn".
(label_is_jump_target_p): Likewise for param "jump_insn".
---
 gcc/rtl.h | 4 ++--
 gcc/rtlanal.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index 8f8d7f0..c38eb58 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2787,7 +2787,7 @@ extern int inequality_comparisons_p (const_rtx);
 extern rtx replace_rtx (rtx, rtx, rtx);
 extern int replace_label (rtx *, void *);
 extern int rtx_referenced_p (rtx, rtx);
-extern bool tablejump_p (const_rtx, rtx *, rtx_jump_table_data **);
+extern bool tablejump_p (const rtx_insn *, rtx *, rtx_jump_table_data **);
 extern int computed_jump_p (const_rtx);
 
 typedef int (*rtx_function) (rtx *, void *);
@@ -2822,7 +2822,7 @@ extern void remove_node_from_expr_list (const_rtx, 
rtx_expr_list **);
 extern int loc_mentioned_in_p (rtx *, const_rtx);
 extern rtx_insn *find_first_parameter_load (rtx_insn *, rtx_insn *);
 extern bool keep_with_call_p (const_rtx);
-extern bool label_is_jump_target_p (const_rtx, const_rtx);
+extern bool label_is_jump_target_p (const_rtx, const rtx_insn *);
 extern int insn_rtx_cost (rtx, bool);
 
 /* Given an insn and condition, return a canonical description of
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index df2f734..5b1e600 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2732,7 +2732,7 @@ rtx_referenced_p (rtx x, rtx body)
*LABELP and the jump table to *TABLEP.  LABELP and TABLEP may be NULL.  */
 
 bool
-tablejump_p (const_rtx insn, rtx *labelp, rtx_jump_table_data **tablep)
+tablejump_p (const rtx_insn *insn, rtx *labelp, rtx_jump_table_data **tablep)
 {
   rtx label, table;
 
@@ -3746,7 +3746,7 @@ keep_with_call_p (const_rtx insn)
not apply to the fallthru case of a conditional jump.  */
 
 bool
-label_is_jump_target_p (const_rtx label, const_rtx jump_insn)
+label_is_jump_target_p (const_rtx label, const rtx_insn *jump_insn)
 {
   rtx tmp = JUMP_LABEL (jump_insn);
   rtx_jump_table_data *table;
-- 
1.8.5.3



[PATCH 188/236] Use rtx_insn in more places in haifa-sched.c

2014-08-06 Thread David Malcolm
gcc/
* haifa-sched.c (struct model_insn_info): Strengthen field "insn"
from rtx to rtx_insn *.
(model_add_to_schedule): Likewise for locals "start", "end",
"iter".
---
 gcc/haifa-sched.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1f7e7cf..72ed6a1 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1822,7 +1822,7 @@ struct model_pressure_data {
than the main schedule.  */
 struct model_insn_info {
   /* The instruction itself.  */
-  rtx insn;
+  rtx_insn *insn;
 
   /* If this instruction is in model_worklist, these fields link to the
  previous (higher-priority) and next (lower-priority) instructions
@@ -3299,7 +3299,7 @@ model_add_to_schedule (rtx insn)
 static void
 model_analyze_insns (void)
 {
-  rtx start, end, iter;
+  rtx_insn *start, *end, *iter;
   sd_iterator_def sd_it;
   dep_t dep;
   struct model_insn_info *insn, *con;
-- 
1.8.5.3



[PATCH 095/236] modulo-sched.c: Use rtx_insn in various places

2014-08-06 Thread David Malcolm
gcc/
* modulo-sched.c (struct ps_reg_move_info): Strengthen field
"insn" from rtx to rtx_insn *.
(ps_rtl_insn): Likewise for return type.
(doloop_register_get): Likewise for params "head", "tail" and
locals "insn", "first_insn_not_to_check".
(schedule_reg_move): Likewise for local "this_insn".
(schedule_reg_moves): Add a checked cast to rtx_insn * to result
of gen_move_insn for now.
(reset_sched_times): Strengthen local "insn" from rtx to
rtx_insn *.
(permute_partial_schedule): Likewise.
(duplicate_insns_of_cycles): Likewise for local "u_insn".
(dump_insn_location): Likewise for param "insn".
(loop_canon_p): Likewise for local "insn".
(sms_schedule): Likewise.
(print_partial_schedule): Likewise.
(ps_has_conflicts): Likewise.
---
 gcc/modulo-sched.c | 36 +++-
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 328026a..911ef6b 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -155,7 +155,7 @@ struct ps_reg_move_info
   /* An instruction that sets NEW_REG to the correct value.  The first
  move associated with DEF will have an rhs of OLD_REG; later moves
  use the result of the previous move.  */
-  rtx insn;
+  rtx_insn *insn;
 };
 
 typedef struct ps_reg_move_info ps_reg_move_info;
@@ -305,7 +305,7 @@ ps_reg_move (partial_schedule_ptr ps, int id)
 
 /* Return the rtl instruction that is being scheduled by partial schedule
instruction ID, which belongs to schedule PS.  */
-static rtx
+static rtx_insn *
 ps_rtl_insn (partial_schedule_ptr ps, int id)
 {
   if (id < ps->g->num_nodes)
@@ -342,10 +342,11 @@ ps_num_consecutive_stages (partial_schedule_ptr ps, int 
id)
more than one occurrence in the loop besides the control part or the
do-loop pattern is not of the form we expect.  */
 static rtx
-doloop_register_get (rtx head ATTRIBUTE_UNUSED, rtx tail ATTRIBUTE_UNUSED)
+doloop_register_get (rtx_insn *head ATTRIBUTE_UNUSED, rtx_insn *tail 
ATTRIBUTE_UNUSED)
 {
 #ifdef HAVE_doloop_end
-  rtx reg, condition, insn, first_insn_not_to_check;
+  rtx reg, condition;
+  rtx_insn *insn, *first_insn_not_to_check;
 
   if (!JUMP_P (tail))
 return NULL_RTX;
@@ -552,7 +553,7 @@ schedule_reg_move (partial_schedule_ptr ps, int i_reg_move,
   int start, end, c, ii;
   sbitmap_iterator sbi;
   ps_reg_move_info *move;
-  rtx this_insn;
+  rtx_insn *this_insn;
   ps_insn_ptr psi;
 
   move = ps_reg_move (ps, i_reg_move);
@@ -758,7 +759,8 @@ schedule_reg_moves (partial_schedule_ptr ps)
  move->old_reg = old_reg;
  move->new_reg = gen_reg_rtx (GET_MODE (prev_reg));
  move->num_consecutive_stages = distances[0] && distances[1] ? 2 : 1;
- move->insn = gen_move_insn (move->new_reg, copy_rtx (prev_reg));
+ move->insn = as_a  (gen_move_insn (move->new_reg,
+copy_rtx (prev_reg)));
  bitmap_clear (move->uses);
 
  prev_reg = move->new_reg;
@@ -852,7 +854,7 @@ reset_sched_times (partial_schedule_ptr ps, int amount)
 if (dump_file)
   {
 /* Print the scheduling times after the rotation.  */
-   rtx insn = ps_rtl_insn (ps, u);
+   rtx_insn *insn = ps_rtl_insn (ps, u);
 
 fprintf (dump_file, "crr_insn->node=%d (insn id %d), "
  "crr_insn->cycle=%d, min_cycle=%d", u,
@@ -883,7 +885,7 @@ permute_partial_schedule (partial_schedule_ptr ps, rtx last)
   for (row = 0; row < ii ; row++)
 for (ps_ij = ps->rows[row]; ps_ij; ps_ij = ps_ij->next_in_row)
   {
-   rtx insn = ps_rtl_insn (ps, ps_ij->id);
+   rtx_insn *insn = ps_rtl_insn (ps, ps_ij->id);
 
if (PREV_INSN (last) != insn)
  {
@@ -1105,7 +1107,7 @@ duplicate_insns_of_cycles (partial_schedule_ptr ps, int 
from_stage,
   {
int u = ps_ij->id;
int first_u, last_u;
-   rtx u_insn;
+   rtx_insn *u_insn;
 
 /* Do not duplicate any insn which refers to count_reg as it
belongs to the control part.
@@ -1242,7 +1244,7 @@ loop_single_full_bb_p (struct loop *loop)
 /* Dump file:line from INSN's location info to dump_file.  */
 
 static void
-dump_insn_location (rtx insn)
+dump_insn_location (rtx_insn *insn)
 {
   if (dump_file && INSN_LOCATION (insn))
 {
@@ -1275,7 +1277,7 @@ loop_canon_p (struct loop *loop)
 {
   if (dump_file)
{
- rtx insn = BB_END (loop->header);
+ rtx_insn *insn = BB_END (loop->header);
 
  fprintf (dump_file, "SMS loop many exits");
  dump_insn_location (insn);
@@ -1288,7 +1290,7 @@ loop_canon_p (struct loop *loop)
 {
   if (dump_file)
{
- rtx insn = BB_END (loop->header);
+ rtx_insn *insn = BB_END (loop->header);
 
  fprintf (dump_file, "SMS loop many BBs.");
  dump_in

[PATCH 163/236] unshare_all_rtl_again takes an rtx_insn *

2014-08-06 Thread David Malcolm
All in-tree users of unshare_all_rtl_again now pass in an rtx_insn *.

gcc/
* rtl.h (unshare_all_rtl_again): Strengthen param "insn" from rtx
to rtx_insn *.

* emit-rtl.c (unshare_all_rtl_1): Likewise.
(unshare_all_rtl_again): Likewise, also for local "p".
---
 gcc/emit-rtl.c | 6 +++---
 gcc/rtl.h  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 74d6f80..40e3dfc 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2524,7 +2524,7 @@ set_new_first_and_last_insn (rtx first, rtx last)
structure.  This routine should only be called once.  */
 
 static void
-unshare_all_rtl_1 (rtx insn)
+unshare_all_rtl_1 (rtx_insn *insn)
 {
   /* Unshare just about everything else.  */
   unshare_all_rtl_in_chain (insn);
@@ -2544,9 +2544,9 @@ unshare_all_rtl_1 (rtx insn)
should be done sparingly.  */
 
 void
-unshare_all_rtl_again (rtx insn)
+unshare_all_rtl_again (rtx_insn *insn)
 {
-  rtx p;
+  rtx_insn *p;
   tree decl;
 
   for (p = insn; p; p = NEXT_INSN (p))
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6afafcc..f0b48c3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3060,7 +3060,7 @@ extern void push_topmost_sequence (void);
 extern void pop_topmost_sequence (void);
 extern void set_new_first_and_last_insn (rtx, rtx);
 extern unsigned int unshare_all_rtl (void);
-extern void unshare_all_rtl_again (rtx);
+extern void unshare_all_rtl_again (rtx_insn *);
 extern void unshare_all_rtl_in_chain (rtx);
 extern void verify_rtl_sharing (void);
 extern void add_insn (rtx);
-- 
1.8.5.3



[PATCH 101/236] recog.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* recog.c (split_insn): Strengthen param "insn" and locals
"first", "last" from rtx to rtx_insn *.
* recog.c (split_all_insns): Likewise for locals "insn", "next".
(split_all_insns_noflow): Likewise.
---
 gcc/recog.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/recog.c b/gcc/recog.c
index c470694..9f4291e 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -59,7 +59,7 @@ along with GCC; see the file COPYING3.  If not see
 
 static void validate_replace_rtx_1 (rtx *, rtx, rtx, rtx, bool);
 static void validate_replace_src_1 (rtx *, void *);
-static rtx split_insn (rtx);
+static rtx split_insn (rtx_insn *);
 
 struct target_recog default_target_recog;
 #if SWITCHABLE_TARGET
@@ -2956,11 +2956,11 @@ reg_fits_class_p (const_rtx operand, reg_class_t cl, 
int offset,
or NULL if unsuccessful.  */
 
 static rtx
-split_insn (rtx insn)
+split_insn (rtx_insn *insn)
 {
   /* Split insns here to get max fine-grain parallelism.  */
-  rtx first = PREV_INSN (insn);
-  rtx last = try_split (PATTERN (insn), insn, 1);
+  rtx_insn *first = PREV_INSN (insn);
+  rtx_insn *last = try_split (PATTERN (insn), insn, 1);
   rtx insn_set, last_set, note;
 
   if (last == insn)
@@ -3021,7 +3021,7 @@ split_all_insns (void)
 
   FOR_EACH_BB_REVERSE_FN (bb, cfun)
 {
-  rtx insn, next;
+  rtx_insn *insn, *next;
   bool finish = false;
 
   rtl_profile_for_bb (bb);
@@ -3077,7 +3077,7 @@ split_all_insns (void)
 unsigned int
 split_all_insns_noflow (void)
 {
-  rtx next, insn;
+  rtx_insn *next, *insn;
 
   for (insn = get_insns (); insn; insn = next)
 {
-- 
1.8.5.3



[PATCH 033/236] emit_move et al return rtx_insn *

2014-08-06 Thread David Malcolm
gcc/
* expr.h (emit_move_insn): Strengthen return type from rtx to
rtx_insn *.
(emit_move_insn_1): Likewise.
(emit_move_complex_push): Likewise.
(emit_move_complex_parts): Likewise.

* expr.c (emit_move_via_integer): Strengthen return type from rtx
to rtx_insn *.  Replace use of NULL_RTX with NULL when working
with insns.
(emit_move_complex_push): Strengthen return type from rtx to
rtx_insn *.
(emit_move_complex): Likewise, also for local "ret".
(emit_move_ccmode): Likewise.
(emit_move_multi_word): Likewise for return type and locals
"last_insn", "seq".
(emit_move_insn_1): Likewise for return type and locals "result",
"ret".
(emit_move_insn): Likewise for return type and local "last_insn".
(compress_float_constant): Likewise.
---
 gcc/expr.c | 49 ++---
 gcc/expr.h |  8 
 2 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/gcc/expr.c b/gcc/expr.c
index d99bc1e..ba1a36c 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -132,7 +132,7 @@ static void store_by_pieces_1 (struct store_by_pieces_d *, 
unsigned int);
 static void store_by_pieces_2 (insn_gen_fn, machine_mode,
   struct store_by_pieces_d *);
 static tree clear_storage_libcall_fn (int);
-static rtx compress_float_constant (rtx, rtx);
+static rtx_insn *compress_float_constant (rtx, rtx);
 static rtx get_subtarget (rtx);
 static void store_constructor_field (rtx, unsigned HOST_WIDE_INT,
 HOST_WIDE_INT, enum machine_mode,
@@ -3157,7 +3157,7 @@ emit_move_change_mode (enum machine_mode new_mode,
an integer mode of the same size as MODE.  Returns the instruction
emitted, or NULL if such a move could not be generated.  */
 
-static rtx
+static rtx_insn *
 emit_move_via_integer (enum machine_mode mode, rtx x, rtx y, bool force)
 {
   enum machine_mode imode;
@@ -3166,19 +3166,19 @@ emit_move_via_integer (enum machine_mode mode, rtx x, 
rtx y, bool force)
   /* There must exist a mode of the exact size we require.  */
   imode = int_mode_for_mode (mode);
   if (imode == BLKmode)
-return NULL_RTX;
+return NULL;
 
   /* The target must support moves in this mode.  */
   code = optab_handler (mov_optab, imode);
   if (code == CODE_FOR_nothing)
-return NULL_RTX;
+return NULL;
 
   x = emit_move_change_mode (imode, mode, x, force);
   if (x == NULL_RTX)
-return NULL_RTX;
+return NULL;
   y = emit_move_change_mode (imode, mode, y, force);
   if (y == NULL_RTX)
-return NULL_RTX;
+return NULL;
   return emit_insn (GEN_FCN (code) (x, y));
 }
 
@@ -3243,7 +3243,7 @@ emit_move_resolve_push (enum machine_mode mode, rtx x)
X is known to satisfy push_operand, and MODE is known to be complex.
Returns the last instruction emitted.  */
 
-rtx
+rtx_insn *
 emit_move_complex_push (enum machine_mode mode, rtx x, rtx y)
 {
   enum machine_mode submode = GET_MODE_INNER (mode);
@@ -3286,7 +3286,7 @@ emit_move_complex_push (enum machine_mode mode, rtx x, 
rtx y)
 /* A subroutine of emit_move_complex.  Perform the move from Y to X
via two moves of the parts.  Returns the last instruction emitted.  */
 
-rtx
+rtx_insn *
 emit_move_complex_parts (rtx x, rtx y)
 {
   /* Show the output dies here.  This is necessary for SUBREGs
@@ -3305,7 +3305,7 @@ emit_move_complex_parts (rtx x, rtx y)
 /* A subroutine of emit_move_insn_1.  Generate a move from Y into X.
MODE is known to be complex.  Returns the last instruction emitted.  */
 
-static rtx
+static rtx_insn *
 emit_move_complex (enum machine_mode mode, rtx x, rtx y)
 {
   bool try_int;
@@ -3345,7 +3345,7 @@ emit_move_complex (enum machine_mode mode, rtx x, rtx y)
 
   if (try_int)
 {
-  rtx ret;
+  rtx_insn *ret;
 
   /* For memory to memory moves, optimal behavior can be had with the
 existing block move logic.  */
@@ -3367,10 +3367,10 @@ emit_move_complex (enum machine_mode mode, rtx x, rtx y)
 /* A subroutine of emit_move_insn_1.  Generate a move from Y into X.
MODE is known to be MODE_CC.  Returns the last instruction emitted.  */
 
-static rtx
+static rtx_insn *
 emit_move_ccmode (enum machine_mode mode, rtx x, rtx y)
 {
-  rtx ret;
+  rtx_insn *ret;
 
   /* Assume all MODE_CC modes are equivalent; if we have movcc, use it.  */
   if (mode != CCmode)
@@ -3427,11 +3427,12 @@ undefined_operand_subword_p (const_rtx op, int i)
pattern.  Note that you will get better code if you define such
patterns, even if they must turn into multiple assembler instructions.  */
 
-static rtx
+static rtx_insn *
 emit_move_multi_word (enum machine_mode mode, rtx x, rtx y)
 {
-  rtx last_insn = 0;
-  rtx seq, inner;
+  rtx_insn *last_insn = 0;
+  rtx_insn *seq;
+  rtx inner;
   bool need_clobber;
   int i;
 
@@ -3507,7 +3508,7 @@ emit_move_multi_word (enum machine_mode mode, rtx x, rtx 
y)
Called jus

[PATCH 172/236] sel-sched-ir.h: Make ilist_t work on insn_t rather than rtx

2014-08-06 Thread David Malcolm
gcc/
* sel-sched-ir.h (ilist_t): Redefine this typedef in terms of
ilist_t, not _xlist_t;
(ILIST_INSN): Define in terms of new union field "insn".
(ILIST_NEXT): Define in terms of _LIST_NEXT rather than
_XLIST_NEXT.
(struct _list_node): Add new field "insn" to the union, of type
insn_t.
(ilist_add): Replace macro with an inline function, requiring an
insn_t.
(ilist_remove): Define this macro directly in terms of
_list_remove, rather than indirectly via _xlist_remove.
(ilist_clear): Likewise, in terms of _list_clear rather than
_xlist_clear.
(ilist_is_in_p): Replace macro with an inline function, requiring
an insn_t.
(_list_iter_cond_insn): New function.
(ilist_iter_remove): Define this macro directly in terms of
_list_iter_remove, rather than indirectly via _xlist_iter_remove.
(ilist_iterator): Define directly in terms of _list_iterator
rather than indirectly through _xlist_iterator.
(FOR_EACH_INSN): Define in terms of _list_iter_cond_insn rather
than in terms of _FOR_EACH_X.
(FOR_EACH_INSN_1): Likewise.
---
 gcc/sel-sched-ir.h | 56 ++
 1 file changed, 44 insertions(+), 12 deletions(-)

diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 2af7f03..abff203 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -63,9 +63,9 @@ typedef _list_t _xlist_t;
 typedef rtx insn_t;
 
 /* List of insns.  */
-typedef _xlist_t ilist_t;
-#define ILIST_INSN(L) (_XLIST_X (L))
-#define ILIST_NEXT(L) (_XLIST_NEXT (L))
+typedef _list_t ilist_t;
+#define ILIST_INSN(L) ((L)->u.insn)
+#define ILIST_NEXT(L) (_LIST_NEXT (L))
 
 /* This lists possible transformations that done locally, i.e. in
moveup_expr.  */
@@ -353,6 +353,7 @@ struct _list_node
   union
   {
 rtx x;
+insn_t insn;
 struct _bnd bnd;
 expr_def expr;
 struct _fence fence;
@@ -511,17 +512,48 @@ typedef _list_iterator _xlist_iterator;
 #define _FOR_EACH_X_1(X, I, LP) _FOR_EACH_1 (x, (X), (I), (LP))
 
 
-/* ilist_t functions.  Instruction lists are simply RTX lists.  */
+/* ilist_t functions.  */
 
-#define ilist_add(LP, INSN) (_xlist_add ((LP), (INSN)))
-#define ilist_remove(LP) (_xlist_remove (LP))
-#define ilist_clear(LP) (_xlist_clear (LP))
-#define ilist_is_in_p(L, INSN) (_xlist_is_in_p ((L), (INSN)))
-#define ilist_iter_remove(IP) (_xlist_iter_remove (IP))
+static inline void
+ilist_add (ilist_t *lp, insn_t insn)
+{
+  _list_add (lp);
+  ILIST_INSN (*lp) = insn;
+}
+#define ilist_remove(LP) (_list_remove (LP))
+#define ilist_clear(LP) (_list_clear (LP))
+
+static inline bool
+ilist_is_in_p (ilist_t l, insn_t insn)
+{
+  while (l)
+{
+  if (ILIST_INSN (l) == insn)
+return true;
+  l = ILIST_NEXT (l);
+}
+
+  return false;
+}
+
+/* Used through _FOR_EACH.  */
+static inline bool
+_list_iter_cond_insn (ilist_t l, insn_t *ip)
+{
+  if (l)
+{
+  *ip = ILIST_INSN (l);
+  return true;
+}
+
+  return false;
+}
+
+#define ilist_iter_remove(IP) (_list_iter_remove (IP))
 
-typedef _xlist_iterator ilist_iterator;
-#define FOR_EACH_INSN(INSN, I, L) _FOR_EACH_X (INSN, I, L)
-#define FOR_EACH_INSN_1(INSN, I, LP) _FOR_EACH_X_1 (INSN, I, LP)
+typedef _list_iterator ilist_iterator;
+#define FOR_EACH_INSN(INSN, I, L) _FOR_EACH (insn, (INSN), (I), (L))
+#define FOR_EACH_INSN_1(INSN, I, LP) _FOR_EACH_1 (insn, (INSN), (I), (LP))
 
 
 /* Av set iterators.  */
-- 
1.8.5.3



[PATCH 106/236] regrename.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* regrename.c (create_new_chain): Strengthen param "insn" from rtx
to rtx_insn *.
(init_rename_info): Replace use of NULL_RTX with NULL when dealing
with an insn.
(regrename_analyze): Strengthen local "insn" from rtx to
rtx_insn *.
(scan_rtx_reg): Likewise for param "insn".
(scan_rtx_address): Likewise.
(scan_rtx): Likewise.
(restore_operands): Likewise.
(record_out_operands): Likewise.
(build_def_use): Likewise for local "insn".  Replace use of
NULL_RTX with NULL when dealing with an insn.
---
 gcc/regrename.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/gcc/regrename.c b/gcc/regrename.c
index 019aee1..805cb7b 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -107,7 +107,7 @@ static struct obstack rename_obstack;
information about insn operands, and we store it here.  */
 vec insn_rr;
 
-static void scan_rtx (rtx, rtx *, enum reg_class, enum scan_actions,
+static void scan_rtx (rtx_insn *, rtx *, enum reg_class, enum scan_actions,
  enum op_type);
 static bool build_def_use (basic_block);
 
@@ -219,7 +219,7 @@ record_operand_use (struct du_head *head, struct du_chain 
*this_du)
 
 static du_head_p
 create_new_chain (unsigned this_regno, unsigned this_nregs, rtx *loc,
- rtx insn, enum reg_class cl)
+ rtx_insn *insn, enum reg_class cl)
 {
   struct du_head *head = XOBNEW (&rename_obstack, struct du_head);
   struct du_chain *this_du;
@@ -579,7 +579,7 @@ init_rename_info (struct bb_rename_info *p, basic_block bb)
  du_head_p chain;
  if (dump_file)
fprintf (dump_file, "opening incoming chain\n");
- chain = create_new_chain (i, iri->nregs, NULL, NULL_RTX, NO_REGS);
+ chain = create_new_chain (i, iri->nregs, NULL, NULL, NO_REGS);
  bitmap_set_bit (&p->incoming_open_chains_set, chain->id);
}
 }
@@ -724,7 +724,7 @@ regrename_analyze (bitmap bb_mask)
  open_chains = NULL;
  if (insn_rr.exists ())
{
- rtx insn;
+ rtx_insn *insn;
  FOR_BB_INSNS (bb1, insn)
{
  insn_rr_info *p = &insn_rr[INSN_UID (insn)];
@@ -1023,7 +1023,7 @@ note_sets_clobbers (rtx x, const_rtx set, void *data)
 }
 
 static void
-scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl, enum scan_actions action,
+scan_rtx_reg (rtx_insn *insn, rtx *loc, enum reg_class cl, enum scan_actions 
action,
  enum op_type type)
 {
   struct du_head **p;
@@ -1178,7 +1178,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl, enum 
scan_actions action,
BASE_REG_CLASS depending on how the register is being considered.  */
 
 static void
-scan_rtx_address (rtx insn, rtx *loc, enum reg_class cl,
+scan_rtx_address (rtx_insn *insn, rtx *loc, enum reg_class cl,
  enum scan_actions action, enum machine_mode mode,
  addr_space_t as)
 {
@@ -1328,7 +1328,7 @@ scan_rtx_address (rtx insn, rtx *loc, enum reg_class cl,
 }
 
 static void
-scan_rtx (rtx insn, rtx *loc, enum reg_class cl, enum scan_actions action,
+scan_rtx (rtx_insn *insn, rtx *loc, enum reg_class cl, enum scan_actions 
action,
  enum op_type type)
 {
   const char *fmt;
@@ -1458,7 +1458,7 @@ hide_operands (int n_ops, rtx *old_operands, rtx 
*old_dups,
are processing; the arguments are the same as in hide_operands.  */
 
 static void
-restore_operands (rtx insn, int n_ops, rtx *old_operands, rtx *old_dups)
+restore_operands (rtx_insn *insn, int n_ops, rtx *old_operands, rtx *old_dups)
 {
   int i;
   for (i = 0; i < recog_data.n_dups; i++)
@@ -1475,7 +1475,7 @@ restore_operands (rtx insn, int n_ops, rtx *old_operands, 
rtx *old_dups)
record information about the operands in the insn.  */
 
 static void
-record_out_operands (rtx insn, bool earlyclobber, insn_rr_info *insn_info)
+record_out_operands (rtx_insn *insn, bool earlyclobber, insn_rr_info 
*insn_info)
 {
   int n_ops = recog_data.n_operands;
   int alt = which_alternative;
@@ -1525,7 +1525,7 @@ record_out_operands (rtx insn, bool earlyclobber, 
insn_rr_info *insn_info)
 static bool
 build_def_use (basic_block bb)
 {
-  rtx insn;
+  rtx_insn *insn;
   unsigned HOST_WIDE_INT untracked_operands;
 
   fail_current_block = false;
@@ -1626,7 +1626,7 @@ build_def_use (basic_block bb)
  enum machine_mode mode = GET_MODE (op);
  unsigned this_regno = REGNO (op);
  unsigned this_nregs = hard_regno_nregs[this_regno][mode];
- create_new_chain (this_regno, this_nregs, NULL, NULL_RTX,
+ create_new_chain (this_regno, this_nregs, NULL, NULL,
NO_REGS);
}
}
-- 
1.8.5.3



[PATCH 011/236] Replace PREV_INSN et al macros with functions

2014-08-06 Thread David Malcolm
Yet more scaffolding: convert the NEXT_INSN/PREV_INSN macros
and their SET_* variants into functions.

Convert the rvalue-style functions into returning
rtx_insn * rather than plain rtx.

For now, this is done by adding a checked cast, but I hope this can
eventually become a field lookup.  The lvalue forms for now return an rtx&
to allow in-place modification.

gcc/
* rtl.h (PREV_INSN): Convert to an inline function.  Strengthen
the return type from rtx to rtx_insn *,  which will enable various
conversions in followup patches.  For now this is is done by a
checked cast.
(NEXT_INSN): Likewise.
(SET_PREV_INSN): Convert to an inilne function.  This is intended
for use as an lvalue, and so returns an rtx& to allow in-place
modification.
(SET_NEXT_INSN): Likewise.
---
 gcc/rtl.h | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/gcc/rtl.h b/gcc/rtl.h
index e08f05b..5936829 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -972,15 +972,33 @@ extern void rtl_check_failed_flag (const char *, 
const_rtx, const char *,
   (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", (INSN))->u2.insn_uid)
 
 /* Chain insns together in sequence.  */
+
 /* For now these are split in two: an rvalue form:
  PREV_INSN/NEXT_INSN
and an lvalue form:
  SET_NEXT_INSN/SET_PREV_INSN.  */
 
-#define PREV_INSN(INSN)  XEXP ((const_rtx)(INSN), 0)
-#define SET_PREV_INSN(INSN)  XEXP (INSN, 0)
-#define NEXT_INSN(INSN)  XEXP ((const_rtx)(INSN), 1)
-#define SET_NEXT_INSN(INSN)  XEXP (INSN, 1)
+inline rtx_insn *PREV_INSN (const_rtx insn)
+{
+  rtx prev = XEXP (insn, 0);
+  return as_a_nullable  (prev);
+}
+
+inline rtx& SET_PREV_INSN (rtx insn)
+{
+  return XEXP (insn, 0);
+}
+
+inline rtx_insn *NEXT_INSN (const_rtx insn)
+{
+  rtx next = XEXP (insn, 1);
+  return as_a_nullable  (next);
+}
+
+inline rtx& SET_NEXT_INSN (rtx insn)
+{
+  return XEXP (insn, 1);
+}
 
 #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
 
-- 
1.8.5.3



[PATCH 147/236] config/s390: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* config/s390/s390-protos.h (s390_match_ccmode): Strengthen param
1 from rtx to rtx_insn *.
(s390_emit_jump): Likewise for return type.
(s390_emit_call): Likewise.
(s390_load_got): Likewise.

* config/s390/s390.c (last_scheduled_insn): Likewise for this
variable.
(s390_match_ccmode): Likewise for param "insn".
(s390_emit_jump): Likewise for return type.
(s390_split_branches): Likewise for local "label".
(struct constant): Strengthen field "label" from rtx to
rtx_code_label *.
(struct constant_pool): Likewise for field "label".  Strengthen
fields "first_insn", "pool_insn", "emit_pool_after" from rtx to
rtx_insn *.
(s390_alloc_pool): Replace NULL_RTX with NULL when dealing with
insns.
(s390_start_pool): Strengthen param "insn" from rtx to rtx_insn *.
(s390_end_pool): Likewise.
(s390_dump_pool): Likewise for local "insn".
(s390_mainpool_start): Likewise.
(s390_chunkify_start): Likewise.
(s390_chunkify_start): Replace NULL_RTX with NULL when dealing
with insns.  Strengthen locals "label", "jump", "barrier", "next",
"prev", "vec_insn", "insn" from rtx to rtx_insn *.
(s390_chunkify_finish): Strengthen local "insn" from rtx to
rtx_insn *.
(s390_chunkify_cancel): Likewise for locals "insn", "barrier",
"jump", "label", "next_insn".
(s390_regs_ever_clobbered): Likewise for local "cur_insn".
(s390_optimize_nonescaping_tx): Likewise for locals "insn",
"tbegin_insn".
(s390_load_got): Likewise for return type and local "insns".
(s390_save_gprs_to_fprs): Likewise for local "insn".
(s390_restore_gprs_from_fprs): Likewise.
(pass_s390_early_mach::execute): Likewise.
(s390_emit_prologue): Likewise for local "insns".
(s390_expand_tbegin): Strengthen local "leave_label" from rtx to
rtx_code_label *.
(s390_emit_call): Strengthen return type and local "insn" from
rtx to rtx_insn *.
(s390_emit_tpf_eh_return): Likewise for local "insn".
(s390_optimize_prologue): Likewise for locals "insn", "new_insn",
"next_insn", introducing locals "s_pat", "rpat" to allow this.
(s390_fix_long_loop_prediction): Likewise for param "insn" and
local "cur_insn".
(s390_non_addr_reg_read_p): Likewise for param "insn".
(find_cond_jump): Likewise for return type and param "insn".
(s390_swap_cmp): Likewise for param "insn".
(s390_z10_optimize_cmp): Likewise for param "insn" and locals
"prev_insn", "next_insn".
(s390_reorg): Likewise for locals "insn", "target".
(s390_z10_prevent_earlyload_conflicts): Likewise for local "insn".
(s390_sched_variable_issue): For now, rename param "insn" to
"uncast_insn", introducing a checked cast.
(s390_sched_init): Replace NULL_RTX with NULL when dealing with
insn.
(s390_loop_unroll_adjust): Strengthen local "insn" from rtx to
rtx_insn *.  Use for_each_rtx_in_insn rather than for_each_rtx.
---
 gcc/config/s390/s390-protos.h |   8 +--
 gcc/config/s390/s390.c| 132 ++
 2 files changed, 72 insertions(+), 68 deletions(-)

diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 9bd08fa..dca26d8 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -56,11 +56,11 @@ extern bool s390_overlap_p (rtx, rtx, HOST_WIDE_INT);
 extern bool s390_offset_p (rtx, rtx, rtx);
 extern int tls_symbolic_operand (rtx);
 
-extern bool s390_match_ccmode (rtx, enum machine_mode);
+extern bool s390_match_ccmode (rtx_insn *, enum machine_mode);
 extern enum machine_mode s390_tm_ccmode (rtx, rtx, bool);
 extern enum machine_mode s390_select_ccmode (enum rtx_code, rtx, rtx);
 extern rtx s390_emit_compare (enum rtx_code, rtx, rtx);
-extern rtx s390_emit_jump (rtx, rtx);
+extern rtx_insn *s390_emit_jump (rtx, rtx);
 extern bool symbolic_reference_mentioned_p (rtx);
 extern bool tls_symbolic_reference_mentioned_p (rtx);
 extern bool legitimate_la_operand_p (rtx);
@@ -92,7 +92,7 @@ extern void s390_expand_atomic (enum machine_mode, enum 
rtx_code,
 extern void s390_expand_tbegin (rtx, rtx, rtx, bool);
 extern rtx s390_return_addr_rtx (int, rtx);
 extern rtx s390_back_chain_rtx (void);
-extern rtx s390_emit_call (rtx, rtx, rtx, rtx);
+extern rtx_insn *s390_emit_call (rtx, rtx, rtx, rtx);
 extern void s390_expand_logical_operator (enum rtx_code,
  enum machine_mode, rtx *);
 extern bool s390_logical_operator_ok_p (rtx *);
@@ -104,7 +104,7 @@ extern void print_operand (FILE *, rtx, int);
 extern void s390_output_pool_entry (rtx, enum machine_mode, unsigned int);
 extern int s390_label_align (rtx);
 extern int s390_agen_dep_p (rtx, rtx);
-extern rtx s390_lo

[PATCH 043/236] peephole returns an rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* output.h (peephole): Strengthen return type from rtx to rtx_insn *.
* rtl.h (delete_for_peephole): Likewise for both params.
* genpeep.c (main): In generated "peephole" function, strengthen
return type and local "insn" from rtx to rtx_insn *.  For now,
rename param "ins1" to "uncast_ins1", adding "ins1" back as an
rtx_insn *, with a checked cast.
* jump.c (delete_for_peephole): Strengthen params "from", "to" and
locals "insn", "next", "prev" from rtx to rtx_insn *.
---
 gcc/genpeep.c | 6 --
 gcc/jump.c| 8 
 gcc/output.h  | 2 +-
 gcc/rtl.h | 2 +-
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index a8afadb..bc2785e 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -378,8 +378,10 @@ from the machine description file `md'.  */\n\n");
   printf ("extern rtx peep_operand[];\n\n");
   printf ("#define operands peep_operand\n\n");
 
-  printf ("rtx\npeephole (rtx ins1)\n{\n");
-  printf ("  rtx insn ATTRIBUTE_UNUSED, x ATTRIBUTE_UNUSED, pat 
ATTRIBUTE_UNUSED;\n\n");
+  printf ("rtx_insn *\npeephole (rtx uncast_ins1)\n{\n");
+  printf ("  rtx_insn *ins1 = as_a  (uncast_ins1);\n");
+  printf ("  rtx_insn *insn ATTRIBUTE_UNUSED;\n");
+  printf ("  rtx x ATTRIBUTE_UNUSED, pat ATTRIBUTE_UNUSED;\n\n");
 
   /* Early out: no peepholes for insns followed by barriers.  */
   printf ("  if (NEXT_INSN (ins1)\n");
diff --git a/gcc/jump.c b/gcc/jump.c
index 0cac620..1a150ac 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1388,14 +1388,14 @@ delete_related_insns (rtx insn)
peephole insn that will replace them.  */
 
 void
-delete_for_peephole (rtx from, rtx to)
+delete_for_peephole (rtx_insn *from, rtx_insn *to)
 {
-  rtx insn = from;
+  rtx_insn *insn = from;
 
   while (1)
 {
-  rtx next = NEXT_INSN (insn);
-  rtx prev = PREV_INSN (insn);
+  rtx_insn *next = NEXT_INSN (insn);
+  rtx_insn *prev = PREV_INSN (insn);
 
   if (!NOTE_P (insn))
{
diff --git a/gcc/output.h b/gcc/output.h
index 2b32601..53d575a 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -281,7 +281,7 @@ extern void assemble_addr_to_section (rtx, section *);
 extern int get_pool_size (void);
 
 #ifdef HAVE_peephole
-extern rtx peephole (rtx);
+extern rtx_insn *peephole (rtx);
 #endif
 
 extern void output_shared_constant_pool (void);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index f28a62a..0ad200e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3035,7 +3035,7 @@ extern rtx reversed_comparison (const_rtx, enum 
machine_mode);
 extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
 extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
 const_rtx, const_rtx);
-extern void delete_for_peephole (rtx, rtx);
+extern void delete_for_peephole (rtx_insn *, rtx_insn *);
 extern int condjump_in_parallel_p (const_rtx);
 
 /* In emit-rtl.c.  */
-- 
1.8.5.3



[PATCH 051/236] bb-reorder.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* bb-reorder.c (copy_bb_p): Strengthen local "insn" from rtx to
rtx_insn *.
(get_uncond_jump_length): Likewise for locals "label", "jump".
(fix_up_crossing_landing_pad): Likewise for locals "new_label",
"jump", "insn".
(add_labels_and_missing_jumps): Likewise for local "new_jump".
(fix_up_fall_thru_edges): Likewise for local "old_jump".
(find_jump_block): Likewise for local "insn".
(fix_crossing_conditional_branches): Likewise for locals
"old_jump", "new_jump".
(fix_crossing_unconditional_branches): Likewise for locals
"last_insn", "indirect_jump_sequence", "jump_insn", "cur_insn".
(pass_duplicate_computed_gotos::execute): Likewise for local "insn".
---
 gcc/bb-reorder.c | 30 --
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 2d3e6eb..551320e 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1331,7 +1331,7 @@ copy_bb_p (const_basic_block bb, int code_may_grow)
 {
   int size = 0;
   int max_size = uncond_jump_length;
-  rtx insn;
+  rtx_insn *insn;
 
   if (!bb->frequency)
 return false;
@@ -1371,7 +1371,7 @@ copy_bb_p (const_basic_block bb, int code_may_grow)
 int
 get_uncond_jump_length (void)
 {
-  rtx label, jump;
+  rtx_insn *label, *jump;
   int length;
 
   label = emit_label_before (gen_label_rtx (), get_insns ());
@@ -1393,7 +1393,8 @@ fix_up_crossing_landing_pad (eh_landing_pad old_lp, 
basic_block old_bb)
 {
   eh_landing_pad new_lp;
   basic_block new_bb, last_bb, post_bb;
-  rtx new_label, jump, post_label;
+  rtx_insn *new_label, *jump;
+  rtx post_label;
   unsigned new_partition;
   edge_iterator ei;
   edge e;
@@ -1434,7 +1435,7 @@ fix_up_crossing_landing_pad (eh_landing_pad old_lp, 
basic_block old_bb)
   for (ei = ei_start (old_bb->preds); (e = ei_safe_edge (ei)) != NULL; )
 if (BB_PARTITION (e->src) == new_partition)
   {
-   rtx insn = BB_END (e->src);
+   rtx_insn *insn = BB_END (e->src);
rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
 
gcc_assert (note != NULL);
@@ -1732,7 +1733,8 @@ add_labels_and_missing_jumps (vec crossing_edges)
 {
   basic_block src = e->src;
   basic_block dest = e->dest;
-  rtx label, new_jump;
+  rtx label;
+  rtx_insn *new_jump;
 
   if (dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
continue;
@@ -1789,7 +1791,7 @@ fix_up_fall_thru_edges (void)
   edge e;
   bool cond_jump_crosses;
   int invert_worked;
-  rtx old_jump;
+  rtx_insn *old_jump;
   rtx fall_thru_label;
 
   FOR_EACH_BB_FN (cur_bb, cfun)
@@ -1936,7 +1938,7 @@ find_jump_block (basic_block jump_dest)
 {
   basic_block source_bb = NULL;
   edge e;
-  rtx insn;
+  rtx_insn *insn;
   edge_iterator ei;
 
   FOR_EACH_EDGE (e, ei, jump_dest->preds)
@@ -1986,7 +1988,7 @@ fix_crossing_conditional_branches (void)
   edge succ2;
   edge crossing_edge;
   edge new_edge;
-  rtx old_jump;
+  rtx_insn *old_jump;
   rtx set_src;
   rtx old_label = NULL_RTX;
   rtx new_label;
@@ -2053,7 +2055,7 @@ fix_crossing_conditional_branches (void)
  else
{
  basic_block last_bb;
- rtx new_jump;
+ rtx_insn *new_jump;
 
  /* Create new basic block to be dest for
 conditional jump.  */
@@ -2113,13 +2115,13 @@ static void
 fix_crossing_unconditional_branches (void)
 {
   basic_block cur_bb;
-  rtx last_insn;
+  rtx_insn *last_insn;
   rtx label;
   rtx label_addr;
-  rtx indirect_jump_sequence;
-  rtx jump_insn = NULL_RTX;
+  rtx_insn *indirect_jump_sequence;
+  rtx_insn *jump_insn = NULL;
   rtx new_reg;
-  rtx cur_insn;
+  rtx_insn *cur_insn;
   edge succ;
 
   FOR_EACH_BB_FN (cur_bb, cfun)
@@ -2443,7 +2445,7 @@ pass_duplicate_computed_gotos::execute (function *fun)
  mark it in the candidates.  */
   FOR_EACH_BB_FN (bb, fun)
 {
-  rtx insn;
+  rtx_insn *insn;
   edge e;
   edge_iterator ei;
   int size, all_flags;
-- 
1.8.5.3



[PATCH 073/236] expmed.c: Use rtx_insn and rtx_code_label

2014-08-06 Thread David Malcolm
gcc/
* expmed.c (store_bit_field_using_insv): Strengthen local "last"
from rtx to rtx_insn *.
(store_bit_field_1): Likewise.
(extract_bit_field_1): Likewise.
(expand_mult_const): Likewise for local "insns".
(expmed_mult_highpart): Strengthen local "label" from rtx to
rtx_code_label *.
(expand_smod_pow2): Likewise.
(expand_sdiv_pow2): Likewise.
(expand_divmod): Strengthen locals "last", "insn" from rtx to
rtx_insn *.  Strengthen locals "label", "label1", "label2",
"label3", "label4", "label5", "lab" from rtx to rtx_code_label *.
(emit_cstore): Strengthen local "last" from rtx to rtx_insn *.
(emit_store_flag): Likewise.
(emit_store_flag_force): Strengthen local "label" from rtx to
rtx_code_label *.
(do_cmp_and_jump): Likewise for param "label".
---
 gcc/expmed.c | 61 +---
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/gcc/expmed.c b/gcc/expmed.c
index e76b6fc..1c79618 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -65,7 +65,7 @@ static rtx extract_fixed_bit_field_1 (enum machine_mode, rtx,
 static rtx lshift_value (enum machine_mode, unsigned HOST_WIDE_INT, int);
 static rtx extract_split_bit_field (rtx, unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT, int);
-static void do_cmp_and_jump (rtx, rtx, enum rtx_code, enum machine_mode, rtx);
+static void do_cmp_and_jump (rtx, rtx, enum rtx_code, enum machine_mode, 
rtx_code_label *);
 static rtx expand_smod_pow2 (enum machine_mode, rtx, HOST_WIDE_INT);
 static rtx expand_sdiv_pow2 (enum machine_mode, rtx, HOST_WIDE_INT);
 
@@ -508,7 +508,7 @@ store_bit_field_using_insv (const extraction_insn *insv, 
rtx op0,
   struct expand_operand ops[4];
   rtx value1;
   rtx xop0 = op0;
-  rtx last = get_last_insn ();
+  rtx_insn *last = get_last_insn ();
   bool copy_back = false;
 
   enum machine_mode op_mode = insv->field_mode;
@@ -794,7 +794,7 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT 
bitsize,
   unsigned int backwards = WORDS_BIG_ENDIAN && fieldmode != BLKmode;
   unsigned int nwords = (bitsize + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
   unsigned int i;
-  rtx last;
+  rtx_insn *last;
 
   /* This is the mode we must force value to, so that there will be enough
 subwords to extract.  Note that fieldmode will often (always?) be
@@ -900,7 +900,7 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT 
bitsize,
  && store_bit_field_using_insv (&insv, op0, bitsize, bitnum, value))
return true;
 
-  rtx last = get_last_insn ();
+  rtx_insn *last = get_last_insn ();
 
   /* Try loading part of OP0 into a register, inserting the bitfield
 into that, and then copying the result back to OP0.  */
@@ -1579,7 +1579,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT 
bitsize,
   unsigned int backwards = WORDS_BIG_ENDIAN;
   unsigned int nwords = (bitsize + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
   unsigned int i;
-  rtx last;
+  rtx_insn *last;
 
   if (target == 0 || !REG_P (target) || !valid_multiword_target_p (target))
target = gen_reg_rtx (mode);
@@ -1697,7 +1697,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT 
bitsize,
return result;
}
 
-  rtx last = get_last_insn ();
+  rtx_insn *last = get_last_insn ();
 
   /* Try loading part of OP0 into a register and extracting the
 bitfield from that.  */
@@ -2929,7 +2929,8 @@ expand_mult_const (enum machine_mode mode, rtx op0, 
HOST_WIDE_INT val,
   enum mult_variant variant)
 {
   HOST_WIDE_INT val_so_far;
-  rtx insn, accum, tem;
+  rtx_insn *insn;
+  rtx accum, tem;
   int opno;
   enum machine_mode nmode;
 
@@ -3526,7 +3527,8 @@ expmed_mult_highpart_optab (enum machine_mode mode, rtx 
op0, rtx op1,
   && (mul_cost (speed, wider_mode) + shift_cost (speed, mode, size-1)
  < max_cost))
 {
-  rtx insns, wop0, wop1;
+  rtx_insn *insns;
+  rtx wop0, wop1;
 
   /* We need to widen the operands, for example to ensure the
 constant multiplier is correctly sign or zero extended.
@@ -3647,7 +3649,8 @@ expmed_mult_highpart (enum machine_mode mode, rtx op0, 
rtx op1,
 static rtx
 expand_smod_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
 {
-  rtx result, temp, shift, label;
+  rtx result, temp, shift;
+  rtx_code_label *label;
   int logd;
   int prec = GET_MODE_PRECISION (mode);
 
@@ -3743,7 +3746,8 @@ expand_smod_pow2 (enum machine_mode mode, rtx op0, 
HOST_WIDE_INT d)
 static rtx
 expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
 {
-  rtx temp, label;
+  rtx temp;
+  rtx_code_label *label;
   int logd;
 
   logd = floor_log2 (d);
@@ -3776,7 +3780,7 @@ expand_sdiv_pow2 (enum machine_mode mode, rtx op0, 
HOST_WIDE_INT d)
   

[PATCH 052/236] bt-load.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* bt-load.c (struct btr_user_s): Strengthen field "insn" from rtx
to rtx_insn *.
(struct btr_def_s): Likewise.
(insn_sets_btr_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(add_btr_def): Likewise.
(new_btr_user): Likewise.
(compute_defs_uses_and_gen): Strengthen locals "insn", "last" from
rtx to rtx_insn *.
(link_btr_uses): Likewise.
(move_btr_def): Likewise for locals "insp", "old_insn",
"new_insn".  Add checked cast to rtx_insn * for now on result of
gen_move_insn.
(can_move_up): Strengthen param "insn" from const_rtx to
const rtx_insn *.
---
 gcc/bt-load.c | 37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index f57d84d..58dbc09 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -53,7 +53,7 @@ typedef struct btr_user_s
   struct btr_user_s *next;
   basic_block bb;
   int luid;
-  rtx insn;
+  rtx_insn *insn;
   /* If INSN has a single use of a single branch register, then
  USE points to it within INSN.  If there is more than
  one branch register use, or the use is in some way ambiguous,
@@ -79,7 +79,7 @@ typedef struct btr_def_s
   struct btr_def_s *next_this_group;
   basic_block bb;
   int luid;
-  rtx insn;
+  rtx_insn *insn;
   int btr;
   int cost;
   /* For a branch register setting insn that has a constant
@@ -112,14 +112,14 @@ typedef struct btr_def_s
 static int issue_rate;
 
 static int basic_block_freq (const_basic_block);
-static int insn_sets_btr_p (const_rtx, int, int *);
+static int insn_sets_btr_p (const rtx_insn *, int, int *);
 static rtx *find_btr_use (rtx);
 static int btr_referenced_p (rtx, rtx *);
 static int find_btr_reference (rtx *, void *);
 static void find_btr_def_group (btr_def_group *, btr_def);
-static btr_def add_btr_def (fibheap_t, basic_block, int, rtx,
+static btr_def add_btr_def (fibheap_t, basic_block, int, rtx_insn *,
unsigned int, int, btr_def_group *);
-static btr_user new_btr_user (basic_block, int, rtx);
+static btr_user new_btr_user (basic_block, int, rtx_insn *);
 static void dump_hard_reg_set (HARD_REG_SET);
 static void dump_btrs_live (int);
 static void note_other_use_this_block (unsigned int, btr_user);
@@ -140,7 +140,7 @@ static void btr_def_live_range (btr_def, HARD_REG_SET *);
 static void move_btr_def (basic_block, int, btr_def, bitmap, HARD_REG_SET *);
 static int migrate_btr_def (btr_def, int);
 static void migrate_btr_defs (enum reg_class, int);
-static int can_move_up (const_basic_block, const_rtx, int);
+static int can_move_up (const_basic_block, const rtx_insn *, int);
 static void note_btr_set (rtx, const_rtx, void *);
 
 /* The following code performs code motion of target load instructions
@@ -222,7 +222,7 @@ btr_referenced_p (rtx x, rtx *excludep)
If such a set is found and REGNO is nonzero, assign the register number
of the destination register to *REGNO.  */
 static int
-insn_sets_btr_p (const_rtx insn, int check_const, int *regno)
+insn_sets_btr_p (const rtx_insn *insn, int check_const, int *regno)
 {
   rtx set;
 
@@ -297,7 +297,8 @@ find_btr_def_group (btr_def_group *all_btr_def_groups, 
btr_def def)
block BB, instruction INSN, and insert it into ALL_BTR_DEFS.  Return
the new definition.  */
 static btr_def
-add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid, rtx insn,
+add_btr_def (fibheap_t all_btr_defs, basic_block bb, int insn_luid,
+rtx_insn *insn,
 unsigned int dest_reg, int other_btr_uses_before_def,
 btr_def_group *all_btr_def_groups)
 {
@@ -330,7 +331,7 @@ add_btr_def (fibheap_t all_btr_defs, basic_block bb, int 
insn_luid, rtx insn,
 /* Create a new target register user structure, for a use in block BB,
instruction INSN.  Return the new user.  */
 static btr_user
-new_btr_user (basic_block bb, int insn_luid, rtx insn)
+new_btr_user (basic_block bb, int insn_luid, rtx_insn *insn)
 {
   /* This instruction reads target registers.  We need
  to decide whether we can replace all target register
@@ -463,8 +464,8 @@ compute_defs_uses_and_gen (fibheap_t all_btr_defs, btr_def 
*def_array,
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
   int reg;
   btr_def defs_this_bb = NULL;
-  rtx insn;
-  rtx last;
+  rtx_insn *insn;
+  rtx_insn *last;
   int can_throw = 0;
 
   info.users_this_bb = NULL;
@@ -671,8 +672,8 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, 
sbitmap *bb_out,
   for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
 {
   basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
-  rtx insn;
-  rtx last;
+  rtx_insn *insn;
+  rtx_insn *last;
 
   bitmap_union_of_preds (reaching_defs, bb_out, BASIC_BLOCK_FOR_FN (cfun, 
i));
   for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb));
@@ -1154,11 +115

[PATCH 183/236] Strengthen various insn emission functions

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (push_to_sequence): Strengthen param from rtx to
rtx_insn *.
(push_to_sequence2): Likewise for both params.
(delete_insns_since): Likewise for param.
(reorder_insns_nobb): Likewise for all three params.
(set_new_first_and_last_insn): Likewise for both params.

* emit-rtl.h (set_first_insn): Strengthen param "insn" from rtx to
rtx_insn *.  Remove now-redundant cast.
(set_last_insn): Likewise.

* builtins.c (expand_builtin_return): Strengthen local
"call_fusage" from rtx to rtx_insn *.
* cfgrtl.c (create_basic_block_structure): Likewise for local
"after".
* emit-rtl.c (set_new_first_and_last_insn): Likewise for params
"first", "last" and local "insn".
(delete_insns_since): Likewise for param "from".
(reorder_insns_nobb): Likewise for params "from", "to", "after"
and local "x".
(push_to_sequence): Likewise for param "first" and local "last".
(push_to_sequence2): Likewise for params "first" and "last".
* lra.c (emit_add3_insn): Likewise for local "last".
(lra_emit_add): Likewise.
* lra-constraints.c (process_address_1): Likewise for locals
"insn", last".
* modulo-sched.c (ps_first_note): Likewise for return type.
* optabs.c (expand_binop_directly): Likewise for param "last".
---
 gcc/builtins.c|  2 +-
 gcc/cfgrtl.c  |  2 +-
 gcc/emit-rtl.c| 16 
 gcc/emit-rtl.h|  8 
 gcc/lra-constraints.c |  4 ++--
 gcc/lra.c |  6 --
 gcc/modulo-sched.c|  2 +-
 gcc/optabs.c  |  2 +-
 gcc/rtl.h | 10 +-
 9 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 0443211..ba654b9 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1770,7 +1770,7 @@ expand_builtin_return (rtx result)
   int size, align, regno;
   enum machine_mode mode;
   rtx reg;
-  rtx call_fusage = 0;
+  rtx_insn *call_fusage = 0;
 
   result = convert_memory_address (Pmode, result);
 
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index b20e871..ee55788 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -283,7 +283,7 @@ create_basic_block_structure (rtx_insn *head, rtx_insn 
*end, rtx_note *bb_note,
 {
   /* If we found an existing note, thread it back onto the chain.  */
 
-  rtx after;
+  rtx_insn *after;
 
   if (LABEL_P (head))
after = head;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 64ae70f..0374a35 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2483,9 +2483,9 @@ gen_label_rtx (void)
Used for an inline-procedure after copying the insn chain.  */
 
 void
-set_new_first_and_last_insn (rtx first, rtx last)
+set_new_first_and_last_insn (rtx_insn *first, rtx_insn *last)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   set_first_insn (first);
   set_last_insn (last);
@@ -4152,7 +4152,7 @@ add_function_usage_to (rtx call_insn, rtx call_fusage)
FROM becomes the new last instruction.  */
 
 void
-delete_insns_since (rtx from)
+delete_insns_since (rtx_insn *from)
 {
   if (from == 0)
 set_first_insn (0);
@@ -4172,10 +4172,10 @@ delete_insns_since (rtx from)
called after delay-slot filling has been done.  */
 
 void
-reorder_insns_nobb (rtx from, rtx to, rtx after)
+reorder_insns_nobb (rtx_insn *from, rtx_insn *to, rtx_insn *after)
 {
 #ifdef ENABLE_CHECKING
-  rtx x;
+  rtx_insn *x;
   for (x = from; x != to; x = NEXT_INSN (x))
 gcc_assert (after != x);
   gcc_assert (after != to);
@@ -5296,9 +5296,9 @@ start_sequence (void)
start_sequence for more information about how to use this function.  */
 
 void
-push_to_sequence (rtx first)
+push_to_sequence (rtx_insn *first)
 {
-  rtx last;
+  rtx_insn *last;
 
   start_sequence ();
 
@@ -5313,7 +5313,7 @@ push_to_sequence (rtx first)
looping through the list.  */
 
 void
-push_to_sequence2 (rtx first, rtx last)
+push_to_sequence2 (rtx_insn *first, rtx_insn *last)
 {
   start_sequence ();
 
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index a7ecf1f..f339886 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -83,10 +83,10 @@ get_insns (void)
 /* Specify a new insn as the first in the chain.  */
 
 static inline void
-set_first_insn (rtx insn)
+set_first_insn (rtx_insn *insn)
 {
   gcc_checking_assert (!insn || !PREV_INSN (insn));
-  crtl->emit.x_first_insn = as_a_nullable  (insn);
+  crtl->emit.x_first_insn = insn;
 }
 
 /* Return the last insn emitted in current sequence or current function.  */
@@ -100,10 +100,10 @@ get_last_insn (void)
 /* Specify a new insn as the last in the chain.  */
 
 static inline void
-set_last_insn (rtx insn)
+set_last_insn (rtx_insn *insn)
 {
   gcc_checking_assert (!insn || !NEXT_INSN (insn));
-  crtl->emit.x_last_insn = as_a_nullable  (insn);
+  crtl->emit.x_last_insn = insn;
 }
 
 /* Return a number larger than any instruction's uid in this function.  */
diff --git a/gcc/lra-

[PATCH 046/236] delete_related_insns returns an rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (delete_related_insns): Strengthen return type from rtx to
rtx_insn *.

* jump.c (delete_related_insns): Likewise, also for locals "next"
and "prev".
---
 gcc/jump.c | 4 ++--
 gcc/rtl.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/jump.c b/gcc/jump.c
index 1a150ac..b51ca17 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1238,12 +1238,12 @@ mark_jump_label_asm (rtx asmop, rtx insn)
Usage of this instruction is deprecated.  Use delete_insn instead and
subsequent cfg_cleanup pass to delete unreachable code if needed.  */
 
-rtx
+rtx_insn *
 delete_related_insns (rtx insn)
 {
   int was_code_label = (LABEL_P (insn));
   rtx note;
-  rtx next = NEXT_INSN (insn), prev = PREV_INSN (insn);
+  rtx_insn *next = NEXT_INSN (insn), *prev = PREV_INSN (insn);
 
   while (next && INSN_DELETED_P (next))
 next = NEXT_INSN (next);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0ad200e..9c097b6 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2436,7 +2436,7 @@ extern enum rtx_code signed_condition (enum rtx_code);
 extern void mark_jump_label (rtx, rtx, int);
 
 /* In jump.c */
-extern rtx delete_related_insns (rtx);
+extern rtx_insn *delete_related_insns (rtx);
 
 /* In recog.c  */
 extern rtx *find_constant_term_loc (rtx *);
-- 
1.8.5.3



[PATCH 097/236] postreload-gcse.c: Use rtx_insn in various places

2014-08-06 Thread David Malcolm
gcc/
* postreload-gcse.c (struct occr): Strengthen field "insn" from
rtx to rtx_insn *.
(struct unoccr): Likewise.
(struct modifies_mem): Likewise.
(alloc_mem): Likewise for local "insn".
(insert_expr_in_table): Likewise for param "insn".
(dump_expr_hash_table_entry): Likewise for local "insn".
(oprs_unchanged_p): Likewise for param "insn".
(load_killed_in_block_p): Likewise for local "setter".
(record_last_reg_set_info): Likewise for param "insn".
(record_last_reg_set_info_regno): Likewise.
(record_last_mem_set_info): Likewise.
(record_last_set_info): Likewise for local "last_set_insn".
(record_opr_changes): Likewise for param "insn".
(hash_scan_set): Likewise.
(compute_hash_table): Likewise for local "insn".
(get_avail_load_store_reg): Likewise for param "insn".
(eliminate_partially_redundant_load): Likewise, also for locals
"avail_insn", "next_pred_bb_end".  Replace use of NULL_RTX with
RTX for insns.
(eliminate_partially_redundant_loads): Likewise for local "insn".
---
 gcc/postreload-gcse.c | 62 +--
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index af2d731..73848b7 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -162,7 +162,7 @@ struct occr
   /* Next occurrence of this expression.  */
   struct occr *next;
   /* The insn that computes the expression.  */
-  rtx insn;
+  rtx_insn *insn;
   /* Nonzero if this [anticipatable] occurrence has been deleted.  */
   char deleted_p;
 };
@@ -175,7 +175,7 @@ struct unoccr
 {
   struct unoccr *next;
   edge pred;
-  rtx insn;
+  rtx_insn *insn;
 };
 
 static struct obstack unoccr_obstack;
@@ -194,7 +194,7 @@ static int *reg_avail_info;
 /* A list of insns that may modify memory within the current basic block.  */
 struct modifies_mem
 {
-  rtx insn;
+  rtx_insn *insn;
   struct modifies_mem *next;
 };
 static struct modifies_mem *modifies_mem_list;
@@ -218,12 +218,12 @@ static void alloc_mem (void);
 static void free_mem (void);
 
 /* Support for hash table construction and transformations.  */
-static bool oprs_unchanged_p (rtx, rtx, bool);
-static void record_last_reg_set_info (rtx, rtx);
-static void record_last_reg_set_info_regno (rtx, int);
-static void record_last_mem_set_info (rtx);
+static bool oprs_unchanged_p (rtx, rtx_insn *, bool);
+static void record_last_reg_set_info (rtx_insn *, rtx);
+static void record_last_reg_set_info_regno (rtx_insn *, int);
+static void record_last_mem_set_info (rtx_insn *);
 static void record_last_set_info (rtx, const_rtx, void *);
-static void record_opr_changes (rtx);
+static void record_opr_changes (rtx_insn *);
 
 static void find_mem_conflicts (rtx, const_rtx, void *);
 static int load_killed_in_block_p (int, rtx, bool);
@@ -231,7 +231,7 @@ static void reset_opr_set_tables (void);
 
 /* Hash table support.  */
 static hashval_t hash_expr (rtx, int *);
-static void insert_expr_in_table (rtx, rtx);
+static void insert_expr_in_table (rtx, rtx_insn *);
 static struct expr *lookup_expr_in_table (rtx);
 static void dump_hash_table (FILE *);
 
@@ -239,16 +239,16 @@ static void dump_hash_table (FILE *);
 static bool reg_killed_on_edge (rtx, edge);
 static bool reg_used_on_edge (rtx, edge);
 
-static rtx get_avail_load_store_reg (rtx);
+static rtx get_avail_load_store_reg (rtx_insn *);
 
 static bool bb_has_well_behaved_predecessors (basic_block);
 static struct occr* get_bb_avail_insn (basic_block, struct occr *);
-static void hash_scan_set (rtx);
+static void hash_scan_set (rtx_insn *);
 static void compute_hash_table (void);
 
 /* The work horses of this pass.  */
 static void eliminate_partially_redundant_load (basic_block,
-   rtx,
+   rtx_insn *,
struct expr *);
 static void eliminate_partially_redundant_loads (void);
 
@@ -261,7 +261,7 @@ alloc_mem (void)
 {
   int i;
   basic_block bb;
-  rtx insn;
+  rtx_insn *insn;
 
   /* Find the largest UID and create a mapping from UIDs to CUIDs.  */
   uid_cuid = XCNEWVEC (int, get_max_uid () + 1);
@@ -322,7 +322,7 @@ free_mem (void)
basic block.  */
 
 static void
-insert_expr_in_table (rtx x, rtx insn)
+insert_expr_in_table (rtx x, rtx_insn *insn)
 {
   int do_not_record_p;
   hashval_t hash;
@@ -443,7 +443,7 @@ dump_expr_hash_table_entry (expr **slot, FILE *file)
   occr = exprs->avail_occr;
   while (occr)
 {
-  rtx insn = occr->insn;
+  rtx_insn *insn = occr->insn;
   print_rtl_single (file, insn);
   fprintf (file, "\n");
   occr = occr->next;
@@ -491,7 +491,7 @@ reg_changed_after_insn_p (rtx x, int cuid)
2) from INSN to the end of INSN's basic block if AFTER_INSN is true.  */
 
 static bool
-oprs_unchanged_p (r

[PATCH 089/236] loop-iv.c: Use rtx_insn (also touches cfgloop.h and loop-unroll.c)

2014-08-06 Thread David Malcolm
gcc/
* cfgloop.h (iv_analyze): Strengthen param 1 "insn" from rtx to
rtx_insn *.
(iv_analyze_result): Likewise.
(iv_analyze_expr): Likewise.
(biv_p): Likewise.

* loop-iv.c (iv_get_reaching_def): Strengthen param "insn" and
local "def_insn" from rtx to rtx_insn *.
(get_biv_step_1): Likewise for local "insn".
(iv_analyze_expr): Likewise for param "insn".
(iv_analyze_def): Likewise for local "insn".
(iv_analyze_op): Likewise for param "insn".
(iv_analyze): Likewise.
(iv_analyze_result): Likewise.
(biv_p): Likewise.
(suitable_set_for_replacement): Likewise.
(simplify_using_initial_values): Likewise for local "insn".
(iv_number_of_iterations): Likewise for param "insn".
(check_simple_exit): Add checked cast to rtx_insn when invoking
iv_number_of_iterations for now (until get_condition is
strengthened).

* loop-unroll.c (analyze_iv_to_split_insn): Strengthen param
"insn" from rtx to rtx_insn *.
(analyze_insns_in_loop): Likewise for local "insn".
---
 gcc/cfgloop.h |  9 +
 gcc/loop-iv.c | 31 +--
 gcc/loop-unroll.c |  6 +++---
 3 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 7d2c1de..b7f5d2a 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -423,11 +423,12 @@ struct GTY(()) niter_desc
 };
 
 extern void iv_analysis_loop_init (struct loop *);
-extern bool iv_analyze (rtx, rtx, struct rtx_iv *);
-extern bool iv_analyze_result (rtx, rtx, struct rtx_iv *);
-extern bool iv_analyze_expr (rtx, rtx, enum machine_mode, struct rtx_iv *);
+extern bool iv_analyze (rtx_insn *, rtx, struct rtx_iv *);
+extern bool iv_analyze_result (rtx_insn *, rtx, struct rtx_iv *);
+extern bool iv_analyze_expr (rtx_insn *, rtx, enum machine_mode,
+struct rtx_iv *);
 extern rtx get_iv_value (struct rtx_iv *, rtx);
-extern bool biv_p (rtx, rtx);
+extern bool biv_p (rtx_insn *, rtx);
 extern void find_simple_exit (struct loop *, struct niter_desc *);
 extern void iv_analysis_done (void);
 
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index ee6c71e..b8b5d19 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -136,7 +136,7 @@ biv_entry_hasher::equal (const value_type *b, const 
compare_type *r)
 
 static hash_table  bivs;
 
-static bool iv_analyze_op (rtx, rtx, struct rtx_iv *);
+static bool iv_analyze_op (rtx_insn *, rtx, struct rtx_iv *);
 
 /* Return the RTX code corresponding to the IV extend code EXTEND.  */
 static inline enum rtx_code
@@ -339,11 +339,11 @@ latch_dominating_def (rtx reg, df_ref *def)
 /* Gets definition of REG reaching its use in INSN and stores it to DEF.  */
 
 static enum iv_grd_result
-iv_get_reaching_def (rtx insn, rtx reg, df_ref *def)
+iv_get_reaching_def (rtx_insn *insn, rtx reg, df_ref *def)
 {
   df_ref use, adef;
   basic_block def_bb, use_bb;
-  rtx def_insn;
+  rtx_insn *def_insn;
   bool dom_p;
 
   *def = NULL;
@@ -650,7 +650,7 @@ get_biv_step_1 (df_ref def, rtx reg,
   rtx set, rhs, op0 = NULL_RTX, op1 = NULL_RTX;
   rtx next, nextr, tmp;
   enum rtx_code code;
-  rtx insn = DF_REF_INSN (def);
+  rtx_insn *insn = DF_REF_INSN (def);
   df_ref next_def;
   enum iv_grd_result res;
 
@@ -946,7 +946,8 @@ iv_analyze_biv (rtx def, struct rtx_iv *iv)
The mode of the induction variable is MODE.  */
 
 bool
-iv_analyze_expr (rtx insn, rtx rhs, enum machine_mode mode, struct rtx_iv *iv)
+iv_analyze_expr (rtx_insn *insn, rtx rhs, enum machine_mode mode,
+struct rtx_iv *iv)
 {
   rtx mby = NULL_RTX, tmp;
   rtx op0 = NULL_RTX, op1 = NULL_RTX;
@@ -1073,7 +1074,7 @@ iv_analyze_expr (rtx insn, rtx rhs, enum machine_mode 
mode, struct rtx_iv *iv)
 static bool
 iv_analyze_def (df_ref def, struct rtx_iv *iv)
 {
-  rtx insn = DF_REF_INSN (def);
+  rtx_insn *insn = DF_REF_INSN (def);
   rtx reg = DF_REF_REG (def);
   rtx set, rhs;
 
@@ -1134,7 +1135,7 @@ iv_analyze_def (df_ref def, struct rtx_iv *iv)
 /* Analyzes operand OP of INSN and stores the result to *IV.  */
 
 static bool
-iv_analyze_op (rtx insn, rtx op, struct rtx_iv *iv)
+iv_analyze_op (rtx_insn *insn, rtx op, struct rtx_iv *iv)
 {
   df_ref def = NULL;
   enum iv_grd_result res;
@@ -1192,7 +1193,7 @@ iv_analyze_op (rtx insn, rtx op, struct rtx_iv *iv)
 /* Analyzes value VAL at INSN and stores the result to *IV.  */
 
 bool
-iv_analyze (rtx insn, rtx val, struct rtx_iv *iv)
+iv_analyze (rtx_insn *insn, rtx val, struct rtx_iv *iv)
 {
   rtx reg;
 
@@ -1217,7 +1218,7 @@ iv_analyze (rtx insn, rtx val, struct rtx_iv *iv)
 /* Analyzes definition of DEF in INSN and stores the result to IV.  */
 
 bool
-iv_analyze_result (rtx insn, rtx def, struct rtx_iv *iv)
+iv_analyze_result (rtx_insn *insn, rtx def, struct rtx_iv *iv)
 {
   df_ref adef;
 
@@ -1233,7 +1234,7 @@ iv_analyze_result (rtx insn, rtx def, struct rtx_iv *iv)
iv_analysis_loop_init) for this f

[PATCH 075/236] final.c: Use rtx_insn (also touches output.c and config/arc/arc.c)

2014-08-06 Thread David Malcolm
In particular, after this patch, the first param passed to the
FINAL_PRESCAN_INSN macro is strengthened from rtx to rtx_insn *.

gcc/
* output.h (final_scan_insn): Strengthen return type from rtx to
rtx_insn *.
(final_forward_branch_p): Likewise for param.
(current_output_insn): Likewise for this global.

* final.c (rtx debug_insn): Likewise for this variable.
(current_output_insn): Likewise.
(get_attr_length_1): Rename param "insn" to "uncast_insn",
adding "insn" back in as an rtx_insn * with a checked cast, so
that macro ADJUST_INSN_LENGTH can be passed an rtx_insn * as the
first param.
(compute_alignments): Strengthen local "label" from rtx to
rtx_insn *.
(shorten_branches): Rename param from "first" to "uncast_first",
introducing a new local rtx_insn * "first" using a checked cast to
effectively strengthen "first" from rtx to rtx_insn * without
affecting the type signature.  Strengthen locals "insn", "seq",
"next", "label" from rtx to rtx_insn *.
(change_scope): Strengthen param "orig_insn" and local "insn" from
rtx to rtx_insn *.
(final_start_function): Rename param from "first" to "uncast_first",
introducing a new local rtx_insn * "first" using a checked cast to
effectively strengthen "first" from rtx to rtx_insn * without
affecting the type signature.  Strengthen local "insn" from rtx to
rtx_insn *.
(dump_basic_block_info): Strengthen param "insn" from rtx to
rtx_insn *.
(final): Rename param from "first" to "uncast_first",
introducing a new local rtx_insn * "first" using a checked cast to
effectively strengthen "first" from rtx to rtx_insn * without
affecting the type signature.  Strengthen locals "insn", "next"
from rtx to rtx_insn *.
(output_alternate_entry_point): Strengthen param "insn" from rtx to
rtx_insn *.
(call_from_call_insn): Strengthen param "insn" from rtx to
rtx_call_insn *.
(final_scan_insn): Rename param from "insn" to "uncast_insn",
introducing a new local rtx_insn * "insn" using a checked cast to
effectively strengthen "insn" from rtx to rtx_insn * without
affecting the type signature.  Strengthen return type and locals
"next", "note", "prev", "new_rtx" from rtx to rtx_insn *.  Remove
now-redundant checked cast to rtx_insn * from both invocations of
debug_hooks->var_location.  Convert CALL_P into a dyn_cast,
introducing a local "call_insn" for use when invoking
call_from_call_insn.
(notice_source_line): Strengthen param "insn" from rtx to
rtx_insn *.
(leaf_function_p): Likewise for local "insn".
(final_forward_branch_p): Likewise.
(leaf_renumber_regs): Likewise for param "first".
(rest_of_clean_state): Likewise for locals "insn" and "next".
(collect_fn_hard_reg_usage): Likewise for local "insn".
(get_call_fndecl): Likewise for param "insn".
(get_call_cgraph_rtl_info): Likewise.
(get_call_reg_set_usage): Rename param from "insn" to "uncast_insn",
introducing a new local rtx_insn * "insn" using a checked cast to
effectively strengthen "insn" from rtx to rtx_insn * without
affecting the type signature.

* config/arc/arc.c (arc_final_prescan_insn): For now, add checked
cast when assigning from param "insn" to current_output_insn.
(arc_pad_return): Strengthen local "insn" from rtx to rtx_insn *
so that we can assign it back to current_output_insn.
---
 gcc/config/arc/arc.c |  4 +--
 gcc/final.c  | 99 
 gcc/output.h |  6 ++--
 3 files changed, 58 insertions(+), 51 deletions(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 3b3e820..c502d10 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -3944,7 +3944,7 @@ arc_final_prescan_insn (rtx insn, rtx *opvec 
ATTRIBUTE_UNUSED,
   current_output_insn =
emit_insn_before (gen_nop (), NEXT_INSN (PREV_INSN (insn)));
   final_scan_insn (current_output_insn, asm_out_file, optimize, 1, NULL);
-  current_output_insn = insn;
+  current_output_insn = as_a  (insn);
 }
   /* Restore extraction data which might have been clobbered by arc_hazard.  */
   extract_constrain_insn_cached (insn);
@@ -8652,7 +8652,7 @@ arc_branch_size_unknown_p (void)
 void
 arc_pad_return (void)
 {
-  rtx insn = current_output_insn;
+  rtx_insn *insn = current_output_insn;
   rtx prev = prev_active_insn (insn);
   int want_long;
 
diff --git a/gcc/final.c b/gcc/final.c
index 1ae2c90..22d75c3 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -117,8 +117,8 @@ along with GCC; see the file COPYING3.  If not see
 #define SEEN_EMITTED   2
 
 /* Last insn processed by final_scan_insn.  */

[PATCH 091/236] lower-subreg.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* lower-subreg.c (simple_move): Strengthen param "insn" from rtx
to rtx_insn *.
(resolve_reg_notes): Likewise.
(resolve_simple_move): Likewise for return type, param "insn", and
locals "insns", "minsn".
(resolve_clobber): Strengthen param "insn" from rtx to rtx_insn *.
(resolve_use): Likewise.
(resolve_debug): Likewise.
(find_decomposable_shift_zext): Likewise.
(resolve_shift_zext): Likewise for return type, param "insn", and
locals "insns", "in".  Eliminate use of NULL_RTX in favor of NULL.
(decompose_multiword_subregs): Likewise for local "insn",
"orig_insn", "decomposed_shift", "end".
---
 gcc/lower-subreg.c | 49 ++---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 916e4ad..3451a5e 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -321,7 +321,7 @@ simple_move_operand (rtx x)
is called.  */
 
 static rtx
-simple_move (rtx insn, bool speed_p)
+simple_move (rtx_insn *insn, bool speed_p)
 {
   rtx x;
   rtx set;
@@ -800,7 +800,7 @@ adjust_decomposed_uses (rtx *px, void *data 
ATTRIBUTE_UNUSED)
INSN.  */
 
 static void
-resolve_reg_notes (rtx insn)
+resolve_reg_notes (rtx_insn *insn)
 {
   rtx *pnote, note;
 
@@ -870,10 +870,11 @@ can_decompose_p (rtx x)
we don't change anything, return INSN, otherwise return the start
of the sequence of moves.  */
 
-static rtx
-resolve_simple_move (rtx set, rtx insn)
+static rtx_insn *
+resolve_simple_move (rtx set, rtx_insn *insn)
 {
-  rtx src, dest, real_dest, insns;
+  rtx src, dest, real_dest;
+  rtx_insn *insns;
   enum machine_mode orig_mode, dest_mode;
   unsigned int words;
   bool pushing;
@@ -915,7 +916,8 @@ resolve_simple_move (rtx set, rtx insn)
  || (GET_MODE_SIZE (orig_mode)
  != GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest))
 {
-  rtx reg, minsn, smove;
+  rtx reg, smove;
+  rtx_insn *minsn;
 
   reg = gen_reg_rtx (orig_mode);
   minsn = emit_move_insn (reg, src);
@@ -1062,7 +1064,8 @@ resolve_simple_move (rtx set, rtx insn)
 
   if (real_dest != NULL_RTX)
 {
-  rtx mdest, minsn, smove;
+  rtx mdest, smove;
+  rtx_insn *minsn;
 
   if (dest_mode == orig_mode)
mdest = dest;
@@ -1108,7 +,7 @@ resolve_simple_move (rtx set, rtx insn)
component registers.  Return whether we changed something.  */
 
 static bool
-resolve_clobber (rtx pat, rtx insn)
+resolve_clobber (rtx pat, rtx_insn *insn)
 {
   rtx reg;
   enum machine_mode orig_mode;
@@ -1149,7 +1152,7 @@ resolve_clobber (rtx pat, rtx insn)
whether we changed something.  */
 
 static bool
-resolve_use (rtx pat, rtx insn)
+resolve_use (rtx pat, rtx_insn *insn)
 {
   if (resolve_reg_p (XEXP (pat, 0)) || resolve_subreg_p (XEXP (pat, 0)))
 {
@@ -1165,7 +1168,7 @@ resolve_use (rtx pat, rtx insn)
 /* A VAR_LOCATION can be simplified.  */
 
 static void
-resolve_debug (rtx insn)
+resolve_debug (rtx_insn *insn)
 {
   for_each_rtx (&PATTERN (insn), adjust_decomposed_uses, NULL_RTX);
 
@@ -1180,7 +1183,7 @@ resolve_debug (rtx insn)
if INSN is decomposable.  */
 
 static bool
-find_decomposable_shift_zext (rtx insn, bool speed_p)
+find_decomposable_shift_zext (rtx_insn *insn, bool speed_p)
 {
   rtx set;
   rtx op;
@@ -1236,33 +1239,33 @@ find_decomposable_shift_zext (rtx insn, bool speed_p)
and 'set to zero' insn.  Return a pointer to the new insn when a
replacement was done.  */
 
-static rtx
-resolve_shift_zext (rtx insn)
+static rtx_insn *
+resolve_shift_zext (rtx_insn *insn)
 {
   rtx set;
   rtx op;
   rtx op_operand;
-  rtx insns;
+  rtx_insn *insns;
   rtx src_reg, dest_reg, dest_upper, upper_src = NULL_RTX;
   int src_reg_num, dest_reg_num, offset1, offset2, src_offset;
 
   set = single_set (insn);
   if (!set)
-return NULL_RTX;
+return NULL;
 
   op = SET_SRC (set);
   if (GET_CODE (op) != ASHIFT
   && GET_CODE (op) != LSHIFTRT
   && GET_CODE (op) != ASHIFTRT
   && GET_CODE (op) != ZERO_EXTEND)
-return NULL_RTX;
+return NULL;
 
   op_operand = XEXP (op, 0);
 
   /* We can tear this operation apart only if the regs were already
  torn apart.  */
   if (!resolve_reg_p (SET_DEST (set)) && !resolve_reg_p (op_operand))
-return NULL_RTX;
+return NULL;
 
   /* src_reg_num is the number of the word mode register which we
  are operating on.  For a left shift and a zero_extend on little
@@ -1326,7 +1329,7 @@ resolve_shift_zext (rtx insn)
 
   if (dump_file)
 {
-  rtx in;
+  rtx_insn *in;
   fprintf (dump_file, "; Replacing insn: %d with insns: ", INSN_UID 
(insn));
   for (in = insns; in != insn; in = NEXT_INSN (in))
fprintf (dump_file, "%d ", INSN_UID (in));
@@ -1465,7 +1468,7 @@ decompose_multiword_subregs (bool decompose_copies)
   speed_p = optimize_function_for_speed_p (cfun);
   FOR_EACH_BB_FN (bb, cfun)

[PATCH 093/236] mode-switching.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* mode-switching.c (struct seginfo): Strengthen field "insn_ptr"
from rtx to rtx_insn *.
(new_seginfo): Likewise for param "insn".
(create_pre_exit): Likewise for locals "last_insn",
"before_return_copy", "return_copy".
(optimize_mode_switching): Likewise for locals "insn", "ins_pos",
"mode_set".
---
 gcc/mode-switching.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index c06f113..4d590e2 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -70,7 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 struct seginfo
 {
   int mode;
-  rtx insn_ptr;
+  rtx_insn *insn_ptr;
   int bbnum;
   struct seginfo *next;
   HARD_REG_SET regs_live;
@@ -88,7 +88,7 @@ static sbitmap *antic;
 static sbitmap *transp;
 static sbitmap *comp;
 
-static struct seginfo * new_seginfo (int, rtx, int, HARD_REG_SET);
+static struct seginfo * new_seginfo (int, rtx_insn *, int, HARD_REG_SET);
 static void add_seginfo (struct bb_info *, struct seginfo *);
 static void reg_dies (rtx, HARD_REG_SET *);
 static void reg_becomes_live (rtx, const_rtx, void *);
@@ -102,7 +102,7 @@ static void make_preds_opaque (basic_block, int);
manner.  */
 
 static struct seginfo *
-new_seginfo (int mode, rtx insn, int bb, HARD_REG_SET regs_live)
+new_seginfo (int mode, rtx_insn *insn, int bb, HARD_REG_SET regs_live)
 {
   struct seginfo *ptr;
 
@@ -214,7 +214,8 @@ create_pre_exit (int n_entities, int *entity_map, const int 
*num_modes)
 if (eg->flags & EDGE_FALLTHRU)
   {
basic_block src_bb = eg->src;
-   rtx last_insn, ret_reg;
+   rtx_insn *last_insn;
+   rtx ret_reg;
 
gcc_assert (!pre_exit);
/* If this function returns a value at the end, we have to
@@ -231,11 +232,11 @@ create_pre_exit (int n_entities, int *entity_map, const 
int *num_modes)
bool short_block = false;
bool multi_reg_return = false;
bool forced_late_switch = false;
-   rtx before_return_copy;
+   rtx_insn *before_return_copy;
 
do
  {
-   rtx return_copy = PREV_INSN (last_insn);
+   rtx_insn *return_copy = PREV_INSN (last_insn);
rtx return_copy_pat, copy_reg;
int copy_start, copy_num;
int j;
@@ -452,7 +453,7 @@ create_pre_exit (int n_entities, int *entity_map, const int 
*num_modes)
 static int
 optimize_mode_switching (void)
 {
-  rtx insn;
+  rtx_insn *insn;
   int e;
   basic_block bb;
   int need_commit = 0;
@@ -540,7 +541,7 @@ optimize_mode_switching (void)
break;
if (e)
  {
-   rtx ins_pos = BB_HEAD (bb);
+   rtx_insn *ins_pos = BB_HEAD (bb);
if (LABEL_P (ins_pos))
  ins_pos = NEXT_INSN (ins_pos);
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (ins_pos));
@@ -674,7 +675,7 @@ optimize_mode_switching (void)
  int mode;
  basic_block src_bb;
  HARD_REG_SET live_at_edge;
- rtx mode_set;
+ rtx_insn *mode_set;
 
  eg->aux = 0;
 
@@ -734,7 +735,7 @@ optimize_mode_switching (void)
  next = ptr->next;
  if (ptr->mode != no_mode)
{
- rtx mode_set;
+ rtx_insn *mode_set;
 
  rtl_profile_for_bb (bb);
  start_sequence ();
-- 
1.8.5.3



[PATCH 053/236] builtins.c: strengthen various rtx to rtx_insn * and other subclasses

2014-08-06 Thread David Malcolm
gcc/
* builtins.c (expand_builtin_longjmp): Strengthen locals "insn"
and "last" from rtx to rtx_insn *.
(expand_builtin_nonlocal_goto): Likewise for local "insn".
(expand_builtin_apply): Strengthen local "call_insn" from rtx to
rtx_call_insn *.
(expand_errno_check): Strengthen local "lab" from rtx to
rtx_code_label *.
(expand_builtin_mathfn): Strengthen local "insns" from rtx to
rtx_insn *.
(expand_builtin_mathfn_2): Likewise.
(expand_builtin_mathfn_ternary): Likewise.
(expand_builtin_mathfn_3): Likewise.
(expand_builtin_interclass_mathfn): Likewise for local "last".
(expand_builtin_int_roundingfn): Likewise for local "insns".
(expand_builtin_int_roundingfn_2): Likewise.
(expand_builtin_strlen): Likewise for local "before_strlen".
(expand_builtin_strncmp): Likewise for local "seq".
(expand_builtin_signbit): Likewise for local "last".
(expand_builtin_atomic_compare_exchange): Strengthen local "label"
from rtx to rtx_code_label *.
(expand_stack_restore):  Strengthen local "prev" from rtx to
rtx_insn *.
---
 gcc/builtins.c | 45 +
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 140d6ba..0443211 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -992,7 +992,8 @@ expand_builtin_setjmp_receiver (rtx receiver_label 
ATTRIBUTE_UNUSED)
 static void
 expand_builtin_longjmp (rtx buf_addr, rtx value)
 {
-  rtx fp, lab, stack, insn, last;
+  rtx fp, lab, stack;
+  rtx_insn *insn, *last;
   enum machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL);
 
   /* DRAP is needed for stack realign if longjmp is expanded to current
@@ -1136,7 +1137,8 @@ static rtx
 expand_builtin_nonlocal_goto (tree exp)
 {
   tree t_label, t_save_area;
-  rtx r_label, r_save_area, r_fp, r_sp, insn;
+  rtx r_label, r_save_area, r_fp, r_sp;
+  rtx_insn *insn;
 
   if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE))
 return NULL_RTX;
@@ -1600,7 +1602,8 @@ expand_builtin_apply (rtx function, rtx arguments, rtx 
argsize)
 {
   int size, align, regno;
   enum machine_mode mode;
-  rtx incoming_args, result, reg, dest, src, call_insn;
+  rtx incoming_args, result, reg, dest, src;
+  rtx_call_insn *call_insn;
   rtx old_stack_level = 0;
   rtx call_fusage = 0;
   rtx struct_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE 
(cfun->decl) : 0, 0);
@@ -1995,7 +1998,7 @@ mathfn_built_in (tree type, enum built_in_function fn)
 static void
 expand_errno_check (tree exp, rtx target)
 {
-  rtx lab = gen_label_rtx ();
+  rtx_code_label *lab = gen_label_rtx ();
 
   /* Test the result; if it is NaN, set errno=EDOM because
  the argument was not in the domain.  */
@@ -2042,7 +2045,8 @@ static rtx
 expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
 {
   optab builtin_optab;
-  rtx op0, insns;
+  rtx op0;
+  rtx_insn *insns;
   tree fndecl = get_callee_fndecl (exp);
   enum machine_mode mode;
   bool errno_set = false;
@@ -2168,7 +2172,8 @@ static rtx
 expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
 {
   optab builtin_optab;
-  rtx op0, op1, insns, result;
+  rtx op0, op1, result;
+  rtx_insn *insns;
   int op1_type = REAL_TYPE;
   tree fndecl = get_callee_fndecl (exp);
   tree arg0, arg1;
@@ -2277,7 +2282,8 @@ static rtx
 expand_builtin_mathfn_ternary (tree exp, rtx target, rtx subtarget)
 {
   optab builtin_optab;
-  rtx op0, op1, op2, insns, result;
+  rtx op0, op1, op2, result;
+  rtx_insn *insns;
   tree fndecl = get_callee_fndecl (exp);
   tree arg0, arg1, arg2;
   enum machine_mode mode;
@@ -2350,7 +2356,8 @@ static rtx
 expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
 {
   optab builtin_optab;
-  rtx op0, insns;
+  rtx op0;
+  rtx_insn *insns;
   tree fndecl = get_callee_fndecl (exp);
   enum machine_mode mode;
   tree arg;
@@ -2509,7 +2516,7 @@ expand_builtin_interclass_mathfn (tree exp, rtx target)
   if (icode != CODE_FOR_nothing)
 {
   struct expand_operand ops[1];
-  rtx last = get_last_insn ();
+  rtx_insn *last = get_last_insn ();
   tree orig_arg = arg;
 
   /* Wrap the computation of the argument in a SAVE_EXPR, as we may
@@ -2727,7 +2734,8 @@ static rtx
 expand_builtin_int_roundingfn (tree exp, rtx target)
 {
   convert_optab builtin_optab;
-  rtx op0, insns, tmp;
+  rtx op0, tmp;
+  rtx_insn *insns;
   tree fndecl = get_callee_fndecl (exp);
   enum built_in_function fallback_fn;
   tree fallback_fndecl;
@@ -2863,7 +2871,8 @@ static rtx
 expand_builtin_int_roundingfn_2 (tree exp, rtx target)
 {
   convert_optab builtin_optab;
-  rtx op0, insns;
+  rtx op0;
+  rtx_insn *insns;
   tree fndecl = get_callee_fndecl (exp);
   tree arg;
   enum machine_mode mode;
@@ -3012,7 +3021,8 @@ expand_builtin_strlen (tree exp, rtx target,
   rtx pat;
   tree len;
   tree src = CALL_EXP

[PATCH 057/236] cfgcleanup.c: Use rtx_insn (also touches basic-block.h and ifcvt.c)

2014-08-06 Thread David Malcolm
gcc/
* basic-block.h (flow_find_cross_jump): Strengthen params 3 and 4
"f1" and "f2" from rtx * to rtx_insn **.
(flow_find_head_matching_sequence): Likewise.

* cfgcleanup.c (try_simplify_condjump): Strengthen local
"cbranch_insn" from rtx to rtx_insn *.
(thread_jump): Likewise for local "insn".
(try_forward_edges): Likewise for local "last".
(merge_blocks_move_predecessor_nojumps): Likewise for local "barrier".
(merge_blocks_move_successor_nojumps): Likewise for locals "barrier",
"real_b_end".
(can_replace_by): Likewise for params "i1", "i2".
(old_insns_match_p): Likewise.
(merge_notes): Likewise.
(walk_to_nondebug_insn): Likewise for param "i1".
(flow_find_cross_jump): Strengthen params "f1" and "f2" from rtx *
to rtx_insn **.  Strengthen locals "i1", "i2", "last1", "last2",
"afterlast1", "afterlast2" from rtx to rtx_insn *.
(flow_find_head_matching_sequence): Strengthen params "f1" and
"f2" from rtx * to rtx_insn **.  Strengthen locals "i1", "i2",
"last1", "last2", "beforelast1", "beforelast2" from rtx to
rtx_insn *.
(outgoing_edges_match): Likewise for locals "last1", "last2".
(try_crossjump_to_edge): Likewise for local "insn".
Replace call to for_each_rtx with for_each_rtx_in_insn.

(try_crossjump_to_edge): Likewise for locals "newpos1", "newpos2".
(try_head_merge_bb): Likewise for locals "e0_last_head_, "jump",
"e0_last", "e_last", "head", "curr", "insn".  Strengthen locals
"headptr", "currptr", "nextptr" from rtx * to rtx_insn **.
(try_optimize_cfg): Strengthen local "last" from rtx to
rtx_insn *.
(delete_dead_jumptables): Likewise for locals "insn", "next",
"label".

* ifcvt.c (cond_exec_process_if_block): Likewise for locals
"rtx then_last_head", "rtx else_last_head", "rtx then_first_tail",
"rtx else_first_tail", to reflect the basic-block.h changes above.
---
 gcc/basic-block.h |  6 ++--
 gcc/cfgcleanup.c  | 82 ---
 gcc/ifcvt.c   |  8 +++---
 3 files changed, 49 insertions(+), 47 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 2eb6553..172908d 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -818,10 +818,10 @@ enum replace_direction { dir_none, dir_forward, 
dir_backward, dir_both };
 
 /* In cfgcleanup.c.  */
 extern bool cleanup_cfg (int);
-extern int flow_find_cross_jump (basic_block, basic_block, rtx *, rtx *,
- enum replace_direction*);
+extern int flow_find_cross_jump (basic_block, basic_block, rtx_insn **,
+rtx_insn **, enum replace_direction*);
 extern int flow_find_head_matching_sequence (basic_block, basic_block,
-rtx *, rtx *, int);
+rtx_insn **, rtx_insn **, int);
 
 extern bool delete_unreachable_blocks (void);
 
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index e6a8084..0edb7b5 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -69,7 +69,7 @@ static bool block_was_dirty;
 static bool try_crossjump_to_edge (int, edge, edge, enum replace_direction);
 static bool try_crossjump_bb (int, basic_block);
 static bool outgoing_edges_match (int, basic_block, basic_block);
-static enum replace_direction old_insns_match_p (int, rtx, rtx);
+static enum replace_direction old_insns_match_p (int, rtx_insn *, rtx_insn *);
 
 static void merge_blocks_move_predecessor_nojumps (basic_block, basic_block);
 static void merge_blocks_move_successor_nojumps (basic_block, basic_block);
@@ -114,7 +114,7 @@ try_simplify_condjump (basic_block cbranch_block)
 {
   basic_block jump_block, jump_dest_block, cbranch_dest_block;
   edge cbranch_jump_edge, cbranch_fallthru_edge;
-  rtx cbranch_insn;
+  rtx_insn *cbranch_insn;
 
   /* Verify that there are exactly two successors.  */
   if (EDGE_COUNT (cbranch_block->succs) != 2)
@@ -264,7 +264,8 @@ mentions_nonequal_regs (rtx *x, void *data)
 static edge
 thread_jump (edge e, basic_block b)
 {
-  rtx set1, set2, cond1, cond2, insn;
+  rtx set1, set2, cond1, cond2;
+  rtx_insn *insn;
   enum rtx_code code1, code2, reversed_code2;
   bool reverse1 = false;
   unsigned i;
@@ -488,7 +489,7 @@ try_forward_edges (int mode, basic_block b)
new_target = NULL;
  else
{
- rtx last;
+ rtx_insn *last;
 
  if (new_locus != UNKNOWN_LOCATION)
locus = new_locus;
@@ -659,7 +660,7 @@ try_forward_edges (int mode, basic_block b)
 static void
 merge_blocks_move_predecessor_nojumps (basic_block a, basic_block b)
 {
-  rtx barrier;
+  rtx_insn *barrier;
 
   /* If we are partitioning hot/cold basic blocks, we don't want to
  mess 

[PATCH 105/236] reginfo.c: Use rtx_insn (also touches rtl.h)

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (reg_scan): Strengthen param "f" from rtx to rtx_insn *.
* reginfo.c (reg_scan): Likewise, also for local "insn".
(reg_scan_mark_refs): Likewise for param "insn".
(init_subregs_of_mode): Likewise for local "insn".
---
 gcc/reginfo.c | 10 +-
 gcc/rtl.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index edb865e..ed92a41 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1020,12 +1020,12 @@ setup_reg_classes (int regno,
again just before loop.  It finds the first and last use of each
pseudo-register.  */
 
-static void reg_scan_mark_refs (rtx, rtx);
+static void reg_scan_mark_refs (rtx, rtx_insn *);
 
 void
-reg_scan (rtx f, unsigned int nregs ATTRIBUTE_UNUSED)
+reg_scan (rtx_insn *f, unsigned int nregs ATTRIBUTE_UNUSED)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   timevar_push (TV_REG_SCAN);
 
@@ -1046,7 +1046,7 @@ reg_scan (rtx f, unsigned int nregs ATTRIBUTE_UNUSED)
We should only record information for REGs with numbers
greater than or equal to MIN_REGNO.  */
 static void
-reg_scan_mark_refs (rtx x, rtx insn)
+reg_scan_mark_refs (rtx x, rtx_insn *insn)
 {
   enum rtx_code code;
   rtx dest;
@@ -1257,7 +1257,7 @@ void
 init_subregs_of_mode (void)
 {
   basic_block bb;
-  rtx insn;
+  rtx_insn *insn;
   bitmap_obstack srom_obstack;
   bitmap subregs_of_mode;
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 17da2be..4c1d20b 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3180,7 +3180,7 @@ extern void init_fake_stack_mems (void);
 extern void save_register_info (void);
 extern void init_reg_sets (void);
 extern void regclass (rtx, int);
-extern void reg_scan (rtx, unsigned int);
+extern void reg_scan (rtx_insn *, unsigned int);
 extern void fix_register (const char *, int, int);
 extern bool invalid_mode_change_p (unsigned int, enum reg_class);
 
-- 
1.8.5.3



[PATCH 158/236] Remove BB_FOOTER scaffolding

2014-08-06 Thread David Malcolm
gcc/
* basic-block.h (struct rtl_bb_info): Strengthen field "footer_"
from rtx to rtx_insn *.
(BB_FOOTER): Replace function with access macro.
(SET_BB_FOOTER): Delete.

* cfgcleanup.c (try_optimize_cfg): Replace uses of SET_BB_FOOTER
with BB_FOOTER.
* cfgrtl.c (try_redirect_by_replacing_jump): Likewise.
(emit_barrier_after_bb): Likewise.
(record_effective_endpoints): Likewise.
(relink_block_chain): Likewise.
(fixup_fallthru_exit_predecessor): Likewise.
(cfg_layout_duplicate_bb): Likewise.
(cfg_layout_split_block): Likewise.
(cfg_layout_delete_block): Likewise.
(cfg_layout_merge_blocks): Likewise.
(BB_FOOTER): Delete function.
(SET_BB_FOOTER): Delete function.
* combine.c (update_cfg_for_uncondjump): Replace uses of
SET_BB_FOOTER with BB_FOOTER.

/
* rtx-classes-status.txt: Remove SET_BB_FOOTER.
---
 gcc/basic-block.h  |  5 ++---
 gcc/cfgcleanup.c   |  6 +++---
 gcc/cfgrtl.c   | 43 ++-
 gcc/combine.c  |  2 +-
 rtx-classes-status.txt |  2 +-
 5 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 18d3871..0f55a8b 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -127,7 +127,7 @@ struct GTY(()) rtl_bb_info {
   /* In CFGlayout mode points to insn notes/jumptables to be placed just before
  and after the block.   */
   rtx header_;
-  rtx footer_;
+  rtx_insn *footer_;
 };
 
 struct GTY(()) gimple_bb_info {
@@ -381,8 +381,7 @@ extern rtx& SET_BB_END (basic_block bb);
 extern rtx_insn *BB_HEADER (const_basic_block bb);
 extern rtx& SET_BB_HEADER (basic_block bb);
 
-extern rtx_insn *BB_FOOTER (const_basic_block bb);
-extern rtx& SET_BB_FOOTER (basic_block bb);
+#define BB_FOOTER(B)(B)->il.x.rtl->footer_
 
 /* Special block numbers [markers] for entry and exit.
Neither of them is supposed to hold actual statements.  */
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 0edb7b5..6930c03 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2676,13 +2676,13 @@ try_optimize_cfg (int mode)
{
  if (BB_FOOTER (b))
{
- SET_BB_FOOTER (e->src) = BB_FOOTER (b);
- SET_BB_FOOTER (b) = NULL;
+ BB_FOOTER (e->src) = BB_FOOTER (b);
+ BB_FOOTER (b) = NULL;
}
  else
{
  start_sequence ();
- SET_BB_FOOTER (e->src) = emit_barrier ();
+ BB_FOOTER (e->src) = emit_barrier ();
  end_sequence ();
}
}
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 612eca7..1525a75 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1064,7 +1064,7 @@ try_redirect_by_replacing_jump (edge e, basic_block 
target, bool in_cfglayout)
  if (PREV_INSN (insn))
SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
  else
-   SET_BB_FOOTER (src) = NEXT_INSN (insn);
+   BB_FOOTER (src) = NEXT_INSN (insn);
  if (NEXT_INSN (insn))
SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
@@ -1452,7 +1452,7 @@ emit_barrier_after_bb (basic_block bb)
   gcc_assert (current_ir_type () == IR_RTL_CFGRTL
   || current_ir_type () == IR_RTL_CFGLAYOUT);
   if (current_ir_type () == IR_RTL_CFGLAYOUT)
-SET_BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
+BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
 }
 
 /* Like force_nonfallthru below, but additionally performs redirection
@@ -3463,7 +3463,7 @@ record_effective_endpoints (void)
PREV_INSN (BB_HEAD (bb)));
   end = skip_insns_after_block (bb);
   if (NEXT_INSN (BB_END (bb)) && BB_END (bb) != end)
-   SET_BB_FOOTER (bb) = unlink_insn_chain (NEXT_INSN (BB_END (bb)), end);
+   BB_FOOTER (bb) = unlink_insn_chain (NEXT_INSN (BB_END (bb)), end);
   next_insn = NEXT_INSN (BB_END (bb));
 }
 
@@ -3623,7 +3623,7 @@ relink_block_chain (bool stay_in_cfglayout_mode)
 {
   bb->aux = NULL;
   if (!stay_in_cfglayout_mode)
-   SET_BB_HEADER (bb) = SET_BB_FOOTER (bb) = NULL;
+   SET_BB_HEADER (bb) = BB_FOOTER (bb) = NULL;
 }
 
   /* Maybe reset the original copy tables, they are not valid anymore
@@ -3991,8 +3991,8 @@ fixup_fallthru_exit_predecessor (void)
  bb = split_block (bb, NULL)->dest;
  bb->aux = c->aux;
  c->au

[PATCH 126/236] config/alpha/alpha.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/alpha/alpha.c (alpha_emit_set_const): Strengthen local
"insn" from rtx to rtx_insn *.
(alpha_gp_save_rtx): Likewise for local "seq".
(alpha_instantiate_decls): Likewise for local "top".
(get_some_local_dynamic_name): Likewise for local "insn".
(alpha_does_function_need_gp): Likewise.
(set_frame_related_p): Likewise for return type and for locals
"seq" and "insn".
(emit_frame_store_1): Likewise for local "insn".
(alpha_expand_prologue): Likewise for locals "insn", "seq".
(alpha_end_function): Likewise for local "insn".
(alpha_output_mi_thunk_osf): Likewise.
(alphaev4_insn_pipe): Likewise for param "insn".
(alphaev5_insn_pipe): Likewise.
(alphaev4_next_group): Likewise for return type and param 1
"insn".
(alphaev5_next_group): Likewise.
(alpha_align_insns): Likewise for return type and param 1 of
callback param "next_group", and for locals "i", "next", "prev",
"where", "where2", "insn".
---
 gcc/config/alpha/alpha.c | 59 ++--
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index efef1e9..2764f79 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -1881,7 +1881,8 @@ alpha_emit_set_const (rtx target, enum machine_mode mode,
   result = alpha_emit_set_const_1 (target, mode, c, i, no_output);
   if (result)
{
- rtx insn, set;
+ rtx_insn *insn;
+ rtx set;
 
  if (no_output)
return result;
@@ -4827,7 +4828,8 @@ alpha_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
 rtx
 alpha_gp_save_rtx (void)
 {
-  rtx seq, m = cfun->machine->gp_save_rtx;
+  rtx_insn *seq;
+  rtx m = cfun->machine->gp_save_rtx;
 
   if (m == NULL)
 {
@@ -4865,7 +4867,7 @@ alpha_instantiate_decls (void)
 static int
 alpha_ra_ever_killed (void)
 {
-  rtx top;
+  rtx_insn *top;
 
   if (!has_hard_reg_initial_val (Pmode, REG_RA))
 return (int)df_regs_ever_live_p (REG_RA);
@@ -5011,7 +5013,7 @@ get_some_local_dynamic_name_1 (rtx *px, void *data 
ATTRIBUTE_UNUSED)
 static const char *
 get_some_local_dynamic_name (void)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   if (cfun->machine->some_ld_name)
 return cfun->machine->some_ld_name;
@@ -7479,7 +7481,7 @@ alpha_find_lo_sum_using_gp (rtx insn)
 static int
 alpha_does_function_need_gp (void)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   /* The GP being variable is an OSF abi thing.  */
   if (! TARGET_ABI_OSF)
@@ -7522,16 +7524,16 @@ alpha_does_function_need_gp (void)
 /* Helper function to set RTX_FRAME_RELATED_P on instructions, including
sequences.  */
 
-static rtx
+static rtx_insn *
 set_frame_related_p (void)
 {
-  rtx seq = get_insns ();
-  rtx insn;
+  rtx_insn *seq = get_insns ();
+  rtx_insn *insn;
 
   end_sequence ();
 
   if (!seq)
-return NULL_RTX;
+return NULL;
 
   if (INSN_P (seq))
 {
@@ -7563,7 +7565,8 @@ static void
 emit_frame_store_1 (rtx value, rtx base_reg, HOST_WIDE_INT frame_bias,
HOST_WIDE_INT base_ofs, rtx frame_reg)
 {
-  rtx addr, mem, insn;
+  rtx addr, mem;
+  rtx_insn *insn;
 
   addr = plus_constant (Pmode, base_reg, base_ofs);
   mem = gen_frame_mem (DImode, addr);
@@ -7824,8 +7827,9 @@ alpha_expand_prologue (void)
   /* Register frame procedures save the fp.  */
   if (alpha_procedure_type == PT_REGISTER)
{
- rtx insn = emit_move_insn (gen_rtx_REG (DImode, vms_save_fp_regno),
-hard_frame_pointer_rtx);
+ rtx_insn *insn =
+   emit_move_insn (gen_rtx_REG (DImode, vms_save_fp_regno),
+   hard_frame_pointer_rtx);
  add_reg_note (insn, REG_CFA_REGISTER, NULL);
  RTX_FRAME_RELATED_P (insn) = 1;
}
@@ -7841,7 +7845,7 @@ alpha_expand_prologue (void)
   /* If we have to allocate space for outgoing args, do it now.  */
   if (crtl->outgoing_args_size != 0)
{
- rtx seq
+ rtx_insn *seq
= emit_move_insn (stack_pointer_rtx,
  plus_constant
  (Pmode, hard_frame_pointer_rtx,
@@ -8281,7 +8285,7 @@ alpha_expand_epilogue (void)
 void
 alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   /* We output a nop after noreturn calls at the very end of the function to
  ensure that the return address always remains in the caller's code range,
@@ -8324,7 +8328,8 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl 
ATTRIBUTE_UNUSED,
   tree function)
 {
   HOST_WIDE_INT hi, lo;
-  rtx this_rtx, insn, funexp;
+  rtx this_rtx, funexp;
+  rtx_insn *insn;
 
   /* We always require a valid GP.  */
   emit_insn (gen_prologue_ldgp ());
@@ -8779,7 +8784,7 @@ enum alphaev5_pipe {
 };
 
 s

Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)

2014-08-06 Thread DJ Delorie

> As for PSImode, I dunno - seems only m32c and AVR use that?  I have no
> way how to perform testing on such targets.

and msp430.  m32c and msp430 have simulators in gdb.


[PATCH 160/236] function.c and shrink-wrap.*: more rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* function.c (thread_prologue_and_epilogue_insns): Likewise for
locals "returnjump", "epilogue_end", "insn", "next".

* shrink-wrap.h (get_unconverted_simple_return): Strengthen param
"returnjump" from rtx * to rtx_insn **.
* shrink-wrap.c (get_unconverted_simple_return): Likewise.
---
 gcc/function.c| 11 ++-
 gcc/shrink-wrap.c |  2 +-
 gcc/shrink-wrap.h |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/function.c b/gcc/function.c
index c5619e9..771ced9 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5583,8 +5583,9 @@ thread_prologue_and_epilogue_insns (void)
   vec unconverted_simple_returns = vNULL;
   bitmap_head bb_flags;
 #endif
-  rtx returnjump;
-  rtx seq ATTRIBUTE_UNUSED, epilogue_end ATTRIBUTE_UNUSED;
+  rtx_insn *returnjump;
+  rtx seq ATTRIBUTE_UNUSED;
+  rtx_insn *epilogue_end ATTRIBUTE_UNUSED;
   rtx prologue_seq ATTRIBUTE_UNUSED, split_prologue_seq ATTRIBUTE_UNUSED;
   edge e, entry_edge, orig_entry_edge, exit_fallthru_edge;
   edge_iterator ei;
@@ -5595,8 +5596,8 @@ thread_prologue_and_epilogue_insns (void)
 
   inserted = false;
   seq = NULL_RTX;
-  epilogue_end = NULL_RTX;
-  returnjump = NULL_RTX;
+  epilogue_end = NULL;
+  returnjump = NULL;
 
   /* Can't deal with multiple successors of the entry block at the
  moment.  Function should always have at least one entry
@@ -5886,7 +5887,7 @@ epilogue_done:
 #ifdef HAVE_epilogue
   if (epilogue_end)
 {
-  rtx insn, next;
+  rtx_insn *insn, *next;
 
   /* Similarly, move any line notes that appear after the epilogue.
  There is no need, however, to be quite so anal about the existence
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index 785ca21..8f77ab3 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -790,7 +790,7 @@ try_shrink_wrapping (edge *entry_edge, edge orig_entry_edge,
 edge
 get_unconverted_simple_return (edge exit_fallthru_edge, bitmap_head bb_flags,
   vec *unconverted_simple_returns,
-  rtx *returnjump)
+  rtx_insn **returnjump)
 {
   if (optimize)
 {
diff --git a/gcc/shrink-wrap.h b/gcc/shrink-wrap.h
index 5576d36..66bd26d 100644
--- a/gcc/shrink-wrap.h
+++ b/gcc/shrink-wrap.h
@@ -42,7 +42,7 @@ extern void dup_block_and_redirect (basic_block bb, 
basic_block copy_bb,
 extern void try_shrink_wrapping (edge *entry_edge, edge orig_entry_edge,
 bitmap_head *bb_flags, rtx prologue_seq);
 extern edge get_unconverted_simple_return (edge, bitmap_head,
-  vec *, rtx *);
+  vec *, rtx_insn **);
 extern void convert_to_simple_return (edge entry_edge, edge orig_entry_edge,
  bitmap_head bb_flags, rtx returnjump,
  vec unconverted_simple_returns);
-- 
1.8.5.3



[PATCH 198/236] PHASE 5: Additional rtx subclasses

2014-08-06 Thread David Malcolm
/
* rtx-classes-status.txt: Update.
---
 rtx-classes-status.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 5667ae9..e51b0f3 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -4,8 +4,8 @@ exists to be modified by marker commits.
 Phase 1: initial "scaffolding" commits:DONE
 Phase 2: per-file commits in main source dir:  DONE
 Phase 3: per-file commits within "config" subdirs: DONE
-Phase 4: removal of "scaffolding": IN PROGRESS
-Phase 5: additional rtx_def subclasses:TODO
+Phase 4: removal of "scaffolding": DONE
+Phase 5: additional rtx_def subclasses:IN PROGRESS
 Phase 6: use extra rtx_def subclasses: TODO
 
 TODO: "Scaffolding" to be removed
-- 
1.8.5.3



[PATCH 014/236] VINSN_INSN_RTX scaffolding

2014-08-06 Thread David Malcolm
For now, convert into VINSN_INSN_RTX a pair of functions.  We will
eventually change them back to a macro once the relevant field is of type
rtx_insn *.

gcc/
* sel-sched-ir.h (VINSN_INSN_RTX): struct vinsn_def's "insn_rtx"
field will eventually be an rtx_insn *.  To help with transition,
for now, convert from an access macro into a pair of functions:
VINSN_INSN_RTX, returning an rtx_insn *, and...
(SET_VINSN_INSN_RTX): New function, for use where VINSN_INSN_RTX
is used as an lvalue.

* sel-sched-ir.c (vinsn_init): Replace VINSN_INSN_RTX with
SET_VINSN_INSN_RTX where it's used as an lvalue.
(VINSN_INSN_RTX): New function.
(SET_VINSN_INSN_RTX): New function.

/
* rtx-classes-status.txt: Add SET_VINSN_INSN_RTX.
---
 gcc/sel-sched-ir.c | 13 -
 gcc/sel-sched-ir.h |  3 ++-
 rtx-classes-status.txt |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index c1a8a48..18ffa6c 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1179,7 +1179,7 @@ vinsn_init (vinsn_t vi, insn_t insn, bool force_unique_p)
   hash_rtx_callback_function hrcf;
   int insn_class;
 
-  VINSN_INSN_RTX (vi) = insn;
+  SET_VINSN_INSN_RTX (vi) = insn;
   VINSN_COUNT (vi) = 0;
   vi->cost = -1;
 
@@ -6446,4 +6446,15 @@ sel_remove_loop_preheader (void)
 SET_LOOP_PREHEADER_BLOCKS (loop_outer (current_loop_nest),
   preheader_blocks);
 }
+
+rtx_insn *VINSN_INSN_RTX (vinsn_t vi)
+{
+  return as_a_nullable  (vi->insn_rtx);
+}
+
+rtx& SET_VINSN_INSN_RTX (vinsn_t vi)
+{
+  return vi->insn_rtx;
+}
+
 #endif
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index f63d571..7aef287 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -645,7 +645,8 @@ struct vinsn_def
   bool may_trap_p;
 };
 
-#define VINSN_INSN_RTX(VI) ((VI)->insn_rtx)
+extern rtx_insn *VINSN_INSN_RTX (vinsn_t);
+extern rtx& SET_VINSN_INSN_RTX (vinsn_t);
 #define VINSN_PATTERN(VI) (PATTERN (VINSN_INSN_RTX (VI)))
 
 #define VINSN_ID(VI) (&((VI)->id))
diff --git a/rtx-classes-status.txt b/rtx-classes-status.txt
index 2a8773f..fe04611 100644
--- a/rtx-classes-status.txt
+++ b/rtx-classes-status.txt
@@ -14,3 +14,4 @@ TODO: "Scaffolding" to be removed
 * SET_BB_HEAD, SET_BB_END, SET_BB_HEADER, SET_BB_FOOTER
 * SET_DEP_PRO, SET_DEP_CON
 * SET_NEXT_INSN, SET_PREV_INSN
+* SET_VINSN_INSN_RTX
-- 
1.8.5.3



[PATCH 176/236] cselib and incdec

2014-08-06 Thread David Malcolm
gcc/
* rtl.h (for_each_inc_dec): Strengthen param 1 from rtx * to
rtx_insn **.
(check_for_inc_dec): Strengthen param "insn" from rtx to
rtx_insn *.

* cselib.h (cselib_process_insn): Likewise.

* cselib.c (cselib_record_sets): Likewise.
(cselib_process_insn): Likewise.

* dse.c (struct insn_info): Likewise for field "insn".
(check_for_inc_dec_1): Likewise for local "insn".
(check_for_inc_dec): Likewise for param "insn".
(scan_insn): Likewise.
(dse_step1): Likewise for local "insn".

* rtlanal.c (for_each_inc_dec): Strengthen param 1 from rtx * to
rtx_insn **.  Use for_each_rtx_in_insn rather than for_each_rtx.
---
 gcc/cselib.c  |  6 +++---
 gcc/cselib.h  |  2 +-
 gcc/dse.c | 10 +-
 gcc/rtl.h |  4 ++--
 gcc/rtlanal.c |  6 +++---
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gcc/cselib.c b/gcc/cselib.c
index 00a04ba..c453904 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -67,7 +67,7 @@ static cselib_val *cselib_lookup_mem (rtx, int);
 static void cselib_invalidate_regno (unsigned int, enum machine_mode);
 static void cselib_invalidate_mem (rtx);
 static void cselib_record_set (rtx, cselib_val *, cselib_val *);
-static void cselib_record_sets (rtx);
+static void cselib_record_sets (rtx_insn *);
 
 struct expand_value_data
 {
@@ -2468,7 +2468,7 @@ cselib_record_autoinc_cb (rtx mem ATTRIBUTE_UNUSED, rtx 
op ATTRIBUTE_UNUSED,
 
 /* Record the effects of any sets and autoincs in INSN.  */
 static void
-cselib_record_sets (rtx insn)
+cselib_record_sets (rtx_insn *insn)
 {
   int n_sets = 0;
   int i;
@@ -2626,7 +2626,7 @@ fp_setter_insn (rtx insn)
 /* Record the effects of INSN.  */
 
 void
-cselib_process_insn (rtx insn)
+cselib_process_insn (rtx_insn *insn)
 {
   int i;
   rtx x;
diff --git a/gcc/cselib.h b/gcc/cselib.h
index 785f3b6..62374c0 100644
--- a/gcc/cselib.h
+++ b/gcc/cselib.h
@@ -75,7 +75,7 @@ extern cselib_val *cselib_lookup_from_insn (rtx, enum 
machine_mode,
 extern void cselib_init (int);
 extern void cselib_clear_table (void);
 extern void cselib_finish (void);
-extern void cselib_process_insn (rtx);
+extern void cselib_process_insn (rtx_insn *);
 extern bool fp_setter_insn (rtx);
 extern enum machine_mode cselib_reg_set_mode (const_rtx);
 extern int rtx_equal_for_cselib_p (rtx, rtx);
diff --git a/gcc/dse.c b/gcc/dse.c
index 167920c..0dc6b22 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -380,7 +380,7 @@ struct insn_info
   bool contains_cselib_groups;
 
   /* The insn. */
-  rtx insn;
+  rtx_insn *insn;
 
   /* The list of mem sets or mem clobbers that are contained in this
  insn.  If the insn is deletable, it contains only one mem set.
@@ -904,7 +904,7 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
 static bool
 check_for_inc_dec_1 (insn_info_t insn_info)
 {
-  rtx insn = insn_info->insn;
+  rtx_insn *insn = insn_info->insn;
   rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
   if (note)
 return for_each_inc_dec (&insn, emit_inc_dec_insn_before, insn_info) == 0;
@@ -917,7 +917,7 @@ check_for_inc_dec_1 (insn_info_t insn_info)
and add a parameter to this function so that it can be passed down in
insn_info.fixed_regs_live.  */
 bool
-check_for_inc_dec (rtx insn)
+check_for_inc_dec (rtx_insn *insn)
 {
   struct insn_info insn_info;
   rtx note;
@@ -2444,7 +2444,7 @@ copy_fixed_regs (const_bitmap in)
non-register target.  */
 
 static void
-scan_insn (bb_info_t bb_info, rtx insn)
+scan_insn (bb_info_t bb_info, rtx_insn *insn)
 {
   rtx body;
   insn_info_t insn_info = (insn_info_t) pool_alloc (insn_info_pool);
@@ -2710,7 +2710,7 @@ dse_step1 (void)
 
   if (bb->index >= NUM_FIXED_BLOCKS)
{
- rtx insn;
+ rtx_insn *insn;
 
  cse_store_info_pool
= create_alloc_pool ("cse_store_info_pool",
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 3b7ff48..82431f4 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2624,7 +2624,7 @@ extern int for_each_rtx_in_insn (rtx_insn **, 
rtx_function, void *);
for_each_inc_dec.  */
 typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src,
rtx srcoff, void *arg);
-extern int for_each_inc_dec (rtx *, for_each_inc_dec_fn, void *arg);
+extern int for_each_inc_dec (rtx_insn **, for_each_inc_dec_fn, void *arg);
 
 typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
   rtx *, rtx *);
@@ -3029,7 +3029,7 @@ extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
 
 /* In dse.c */
-extern bool check_for_inc_dec (rtx insn);
+extern bool check_for_inc_dec (rtx_insn *insn);
 
 /* In jump.c */
 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 9481d52..5c5e643 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3120,7 +3

[PATCH 060/236] cfgrtl.c: Use rtx subclasses

2014-08-06 Thread David Malcolm
gcc/
* cfgrtl.c (can_delete_note_p): Require a const rtx_note * rather
than a const_rtx.
(can_delete_label_p): Require a const rtx_code_label * rather than
a const_rtx.
(delete_insn): Add checked cast to rtx_code_label * when we know
we're dealing with LABEL_P (insn).  Strengthen local "bb_note" from
rtx to rtx_insn *.
(delete_insn_chain): Strengthen locals "prev" and "current" from
rtx to rtx_insn *.  Add a checked cast when assigning from
"finish" (strengthening the params will come later).  Add a
checked cast to rtx_note * in region where we know
NOTE_P (current).
(rtl_delete_block): Strengthen locals "insn" and "end" from rtx to
rtx_insn *.
(compute_bb_for_insn): Likewise.
(free_bb_for_insn): Likewise for local "insn".
(compute_bb_for_insn): Likewise.
(update_bb_for_insn_chain): Strengthen params "begin", "end" and
local "insn" from rtx to rtx_insn *
(flow_active_insn_p): Require a const rtx_insn * rather than a
const_rtx.
(contains_no_active_insn_p): Strengthen local "insn" from rtx to
rtx_insn *.
(can_fallthru): Likewise for locals "insn" and "insn2".
(bb_note): Likewise for local "note".
(first_insn_after_basic_block_note): Likewise for local "note" and
for return type.
(rtl_split_block): Likewise for locals "insn" and "next".
(unique_locus_on_edge_between_p): Likewise for locals "insn" and
"end".
(rtl_merge_blocks): Likewise for locals "b_head", "b_end",
"a_end", "del_first", "del_last", "b_debug_start", "b_debug_end",
"prev", "tmp".
(try_redirect_by_replacing_jump): Likewise for locals "insn" (both of
them), "kill_from", "barrier", "new_insn".
(patch_jump_insn): Likewise for params "insn", "old_label".
(redirect_branch_edge): Likewise for locals "old_label", "insn".
(force_nonfallthru_and_redirect): Likewise for locals "insn",
"old_label", "new_label".
(rtl_tidy_fallthru_edge): Likewise for local "q".
(rtl_split_edge): Likewise for locals "before", "last".
(commit_one_edge_insertion): Likewise for locals "before",
"after", "insns", "tmp", "last", adding a checked cast where
currently necessary.
(commit_edge_insertions): Likewise.
(rtl_dump_bb): Likewise for locals "insn", "last".
(print_rtl_with_bb): Likewise for local "x".
(rtl_verify_bb_insns): Likewise for local "x".
(rtl_verify_bb_pointers): Likewise for local "insn".
(rtl_verify_bb_insn_chain): Likewise for locals "x", "last_head",
"head", "end".
(rtl_verify_fallthru): Likewise for local "insn".
(rtl_verify_bb_layout): Likewise for locals "x" and "rtx_first".
(purge_dead_edges): Likewise for local "insn".
(fixup_abnormal_edges): Likewise for locals "insn", "stop", "next".
(skip_insns_after_block): Likewise for return type and for locals
"insn", "last_insn", "next_head", "prev".
(record_effective_endpoints): Likewise for locals "next_insn",
"insn", "end".
(fixup_reorder_chain): Likewise for locals "bb_end_insn" and "end".
(verify_insn_chain): Likewise for locals "x", "prevx", "nextx".
(cfg_layout_can_duplicate_bb_p): Likewise for local "insn".
(duplicate_insn_chain): For now, add checked cast from rtx to
rtx_insn * when returning insn.
(cfg_layout_duplicate_bb): Likewise for local "insn".
(cfg_layout_delete_block): Likewise for locals "insn", "next",
"prev", "remaints".
(cfg_layout_merge_blocks): Likewise for local "insn", "last".
(rtl_block_empty_p): Likewise.
(rtl_split_block_before_cond_jump): Likewise for locals "insn",
"split_point", "last".
(rtl_block_ends_with_call_p): Likewise for local "insn".
(need_fake_edge_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(rtl_flow_call_edges_add): Strengthen locals "insn", "prev_insn",
"split_at_insn" from rtx to rtx_insn *.
(rtl_lv_add_condition_to_bb): Likewise for locals "seq", "jump".
(rtl_can_remove_branch_p): Strengthen local "insn" from const_rtx
to const rtx_insn *.
(rtl_account_profile_record): Likewise.
---
 gcc/cfgrtl.c | 192 ++-
 1 file changed, 99 insertions(+), 93 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index e3bad95..612eca7 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -67,15 +67,15 @@ along with GCC; see the file COPYING3.  If not see
 static GTY(()) rtx cfg_layout_function_footer;
 static GTY(()) rtx cfg_layout_function_header;
 
-static rtx skip_insns_after_block (basic_block);
+static rtx_insn *skip_insns_after_block (basic_block);
 static void record_effective_end

[PATCH 197/236] Tweak to ira-lives.c

2014-08-06 Thread David Malcolm
gcc/
* ira-lives.c (find_call_crossed_cheap_reg): Strengthen local
"prev" from rtx to rtx_insn *.
---
 gcc/ira-lives.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index 4875399..98bbd4d 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -1068,7 +1068,7 @@ find_call_crossed_cheap_reg (rtx_insn *insn)
 {
   basic_block bb = BLOCK_FOR_INSN (insn);
   rtx reg = SET_SRC (exp);
-  rtx prev = PREV_INSN (insn);
+  rtx_insn *prev = PREV_INSN (insn);
   while (prev && !(INSN_P (prev)
   && BLOCK_FOR_INSN (prev) != bb))
{
-- 
1.8.5.3



[PATCH 064/236] cprop.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* cprop.c (struct occr): Strengthen field "insn" from rtx to
rtx_insn *.
(reg_available_p): Likewise for param "insn".
(insert_set_in_table): Likewise.
(hash_scan_set): Likewise.
(hash_scan_insn): Likewise.
(make_set_regs_unavailable): Likewise.
(compute_hash_table_work): Likewise for local "insn".
(reg_not_set_p): Strengthen param "insn" from const_rtx to
const rtx_insn *.
(mark_oprs_set): Strengthen param "insn" from rtx to rtx_insn *.
(try_replace_reg): Likewise.
(find_avail_set): Likewise.
(cprop_jump): Likewise for params "setcc", "jump".
(constprop_register): Likewise for param "insn".
(cprop_insn): Likewise.
(do_local_cprop): Likewise.
(local_cprop_pass): Likewise for local "insn".
(bypass_block): Likewise for params "setcc" and "jump".
(bypass_conditional_jumps): Likewise for locals "setcc" and
"insn".
(one_cprop_pass): Likewise for local "insn".
---
 gcc/cprop.c | 50 ++
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/gcc/cprop.c b/gcc/cprop.c
index aef3ee8..1378161 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -60,7 +60,7 @@ struct occr
   /* Next occurrence of this expression.  */
   struct occr *next;
   /* The insn that computes the expression.  */
-  rtx insn;
+  rtx_insn *insn;
 };
 
 typedef struct occr *occr_t;
@@ -154,7 +154,7 @@ cprop_alloc (unsigned long size)
of INSN's basic block.  */
 
 static int
-reg_available_p (const_rtx x, const_rtx insn ATTRIBUTE_UNUSED)
+reg_available_p (const_rtx x, const rtx_insn *insn ATTRIBUTE_UNUSED)
 {
   return ! REGNO_REG_SET_P (reg_set_bitmap, REGNO (x));
 }
@@ -179,8 +179,8 @@ hash_set (int regno, int hash_table_size)
IMPLICIT is true if it's an implicit set, false otherwise.  */
 
 static void
-insert_set_in_table (rtx dest, rtx src, rtx insn, struct hash_table_d *table,
-bool implicit)
+insert_set_in_table (rtx dest, rtx src, rtx_insn *insn,
+struct hash_table_d *table, bool implicit)
 {
   bool found = false;
   unsigned int hash;
@@ -264,7 +264,8 @@ cprop_constant_p (const_rtx x)
IMPLICIT is true if it's an implicit set, false otherwise.  */
 
 static void
-hash_scan_set (rtx set, rtx insn, struct hash_table_d *table, bool implicit)
+hash_scan_set (rtx set, rtx_insn *insn, struct hash_table_d *table,
+  bool implicit)
 {
   rtx src = SET_SRC (set);
   rtx dest = SET_DEST (set);
@@ -307,7 +308,7 @@ hash_scan_set (rtx set, rtx insn, struct hash_table_d 
*table, bool implicit)
 /* Process INSN and add hash table entries as appropriate.  */
 
 static void
-hash_scan_insn (rtx insn, struct hash_table_d *table)
+hash_scan_insn (rtx_insn *insn, struct hash_table_d *table)
 {
   rtx pat = PATTERN (insn);
   int i;
@@ -372,7 +373,7 @@ dump_hash_table (FILE *file, const char *name, struct 
hash_table_d *table)
 /* Record as unavailable all registers that are DEF operands of INSN.  */
 
 static void
-make_set_regs_unavailable (rtx insn)
+make_set_regs_unavailable (rtx_insn *insn)
 {
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
   df_ref *def_rec;
@@ -402,7 +403,7 @@ compute_hash_table_work (struct hash_table_d *table)
 
   FOR_EACH_BB_FN (bb, cfun)
 {
-  rtx insn;
+  rtx_insn *insn;
 
   /* Reset tables used to keep track of what's not yet invalid [since
 the end of the block].  */
@@ -522,7 +523,7 @@ reset_opr_set_tables (void)
start of the basic block containing INSN].  */
 
 static int
-reg_not_set_p (const_rtx x, const_rtx insn ATTRIBUTE_UNUSED)
+reg_not_set_p (const_rtx x, const rtx_insn *insn ATTRIBUTE_UNUSED)
 {
   return ! REGNO_REG_SET_P (reg_set_bitmap, REGNO (x));
 }
@@ -531,7 +532,7 @@ reg_not_set_p (const_rtx x, const_rtx insn ATTRIBUTE_UNUSED)
This data is used by reg_not_set_p.  */
 
 static void
-mark_oprs_set (rtx insn)
+mark_oprs_set (rtx_insn *insn)
 {
   struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
   df_ref *def_rec;
@@ -727,7 +728,7 @@ find_used_regs (rtx *xptr, void *data ATTRIBUTE_UNUSED)
Return nonzero if successful.  */
 
 static int
-try_replace_reg (rtx from, rtx to, rtx insn)
+try_replace_reg (rtx from, rtx to, rtx_insn *insn)
 {
   rtx note = find_reg_equal_equiv_note (insn);
   rtx src = 0;
@@ -801,7 +802,7 @@ try_replace_reg (rtx from, rtx to, rtx insn)
NULL no such set is found.  */
 
 static struct expr *
-find_avail_set (int regno, rtx insn)
+find_avail_set (int regno, rtx_insn *insn)
 {
   /* SET1 contains the last set found that can be returned to the caller for
  use in a substitution.  */
@@ -871,7 +872,7 @@ find_avail_set (int regno, rtx insn)
if a change was made.  */
 
 static int
-cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src)
+cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 {
   rtx

[PATCH 152/236] config/tilegx: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/tilegx/tilegx-protos.h (tilegx_output_cbranch_with_opcode):
Strengthen param 1 from rtx to rtx_insn *.
(tilegx_output_cbranch): Likewise.
(tilegx_adjust_insn_length): Likewise.
(tilegx_final_prescan_insn): Likewise for sole param.

* config/tilegx/tilegx.c (tilegx_legitimize_tls_address): Likewise
or local "last".
(cbranch_predicted_p): Likewise for param "insn".
(tilegx_output_simple_cbranch_with_opcode): Likewise.
(tilegx_output_cbranch_with_opcode): Likewise.
(tilegx_output_cbranch): Likewise.
(frame_emit_load): Likewise for return type.
(set_frame_related_p): Likewise for locals "seq", "insn".
(emit_sp_adjust): Likewise for return type, and for local "insn".
Introduce local "pat" for use in place of "insn" where the latter
isn't an instruction.
(tilegx_expand_epilogue): Strengthen locals "last_insn", "insn"
from rtx to rtx_insn *.
(tilegx_adjust_insn_length): Likewise for param "insn".
(next_insn_to_bundle): Likewise for return type and params "r" and
"end".
(tilegx_gen_bundles): Likewise for locals "insn", "next", "prev",
"end".
(replace_insns): Likewise for params "old_insn", "new_insns".
(replace_mov_pcrel_step1): Likewise for param "insn" and local
"new_insns".
(replace_mov_pcrel_step2): Likewise.
(replace_mov_pcrel_step3): Likewise.
(tilegx_fixup_pcrel_references): Likewise for locals "insn",
"next_insn".
(reorder_var_tracking_notes): Likewise for locals "insn", "next",
"queue", "next_queue", "prev".
(tilegx_output_mi_thunk): Likewise for local "insn".
(tilegx_final_prescan_insn): Likewise for param "insn".
---
 gcc/config/tilegx/tilegx-protos.h |  8 ++---
 gcc/config/tilegx/tilegx.c| 76 ---
 2 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/gcc/config/tilegx/tilegx-protos.h 
b/gcc/config/tilegx/tilegx-protos.h
index 0a9b461..a41cf4a 100644
--- a/gcc/config/tilegx/tilegx-protos.h
+++ b/gcc/config/tilegx/tilegx-protos.h
@@ -42,10 +42,10 @@ extern void tilegx_expand_umuldi3_highpart (rtx, rtx, rtx);
 extern bool tilegx_emit_setcc (rtx[], enum machine_mode);
 extern void tilegx_emit_conditional_branch (rtx[], enum machine_mode);
 extern rtx tilegx_emit_conditional_move (rtx);
-extern const char *tilegx_output_cbranch_with_opcode (rtx, rtx *,
+extern const char *tilegx_output_cbranch_with_opcode (rtx_insn *, rtx *,
  const char *,
  const char *, int);
-extern const char *tilegx_output_cbranch (rtx, rtx *, bool);
+extern const char *tilegx_output_cbranch (rtx_insn *, rtx *, bool);
 extern void tilegx_expand_tablejump (rtx, rtx);
 extern void tilegx_expand_builtin_vector_binop (rtx (*)(rtx, rtx, rtx),
enum machine_mode, rtx,
@@ -61,10 +61,10 @@ extern void tilegx_expand_epilogue (bool);
 extern int tilegx_initial_elimination_offset (int, int);
 extern rtx tilegx_return_addr (int, rtx);
 extern rtx tilegx_eh_return_handler_rtx (void);
-extern int tilegx_adjust_insn_length (rtx, int);
+extern int tilegx_adjust_insn_length (rtx_insn *, int);
 
 extern int tilegx_asm_preferred_eh_data_format (int, int);
-extern void tilegx_final_prescan_insn (rtx);
+extern void tilegx_final_prescan_insn (rtx_insn *);
 extern const char *tilegx_asm_output_opcode (FILE *, const char *);
 extern void tilegx_function_profiler (FILE *, int);
 
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index 7c251c7..be3e13e 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -1041,7 +1041,8 @@ tilegx_legitimize_tls_address (rtx addr)
}
   case TLS_MODEL_INITIAL_EXEC:
{
- rtx temp, temp2, temp3, got, last;
+ rtx temp, temp2, temp3, got;
+ rtx_insn *last;
 
  ret = gen_reg_rtx (Pmode);
  temp = gen_reg_rtx (Pmode);
@@ -1075,7 +1076,8 @@ tilegx_legitimize_tls_address (rtx addr)
}
   case TLS_MODEL_LOCAL_EXEC:
{
- rtx temp, temp2, last;
+ rtx temp, temp2;
+ rtx_insn *last;
 
  ret = gen_reg_rtx (Pmode);
  temp = gen_reg_rtx (Pmode);
@@ -2619,7 +2621,7 @@ tilegx_emit_conditional_move (rtx cmp)
 /* Return true if INSN is annotated with a REG_BR_PROB note that
indicates it's a branch that's predicted taken.  */
 static bool
-cbranch_predicted_p (rtx insn)
+cbranch_predicted_p (rtx_insn *insn)
 {
   rtx x = find_reg_note (insn, REG_BR_PROB, 0);
 
@@ -2637,7 +2639,7 @@ cbranch_predicted_p (rtx insn)
 /* Output assembly code for a specific branch instruction, appending
the branch prediction flag to the opcode if appropriate.  */
 static const char *
-tilegx_output_simple_cbranch_with_opcode 

[PATCH 190/236] Remove insn_addresses_new from 'various scheduling strengthenings'

2014-08-06 Thread David Malcolm
---
 gcc/insn-addr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/insn-addr.h b/gcc/insn-addr.h
index e255ac4..aec09fd 100644
--- a/gcc/insn-addr.h
+++ b/gcc/insn-addr.h
@@ -38,7 +38,7 @@ extern int insn_current_address;
 #define INSN_ADDRESSES_SIZE() (insn_addresses_.length ())
 
 static inline void
-insn_addresses_new (rtx_insn *insn, int insn_addr)
+insn_addresses_new (rtx insn, int insn_addr)
 {
   unsigned insn_uid = INSN_UID ((insn));
 
-- 
1.8.5.3



[PATCH 062/236] combine-stack-adj.c: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* combine-stack-adj.c (struct csa_reflist): Strengthen field
"insn" from rtx to rtx_insn *.
(single_set_for_csa): Likewise for param "insn".
(record_one_stack_ref): Likewise.
(try_apply_stack_adjustment): Likewise.
(struct record_stack_refs_data): Likewise for field "insn".
(maybe_move_args_size_note): Likewise for params "last" and "insn".
(prev_active_insn_bb): Likewise for return type and param "insn".
(next_active_insn_bb): Likewise.
(force_move_args_size_note): Likewise for params "prev" and "last"
and locals "test", "next_candidate", "prev_candidate".
(combine_stack_adjustments_for_block): Strengthen locals
"last_sp_set", "last2_sp_set", "insn", "next" from rtx to
rtx_insn *.
---
 gcc/combine-stack-adj.c | 49 ++---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 11434dd..29bd3d3 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -73,16 +73,17 @@ along with GCC; see the file COPYING3.  If not see
 struct csa_reflist
 {
   HOST_WIDE_INT sp_offset;
-  rtx insn, *ref;
+  rtx_insn *insn;
+  rtx *ref;
   struct csa_reflist *next;
 };
 
 static int stack_memref_p (rtx);
-static rtx single_set_for_csa (rtx);
+static rtx single_set_for_csa (rtx_insn *);
 static void free_csa_reflist (struct csa_reflist *);
-static struct csa_reflist *record_one_stack_ref (rtx, rtx *,
+static struct csa_reflist *record_one_stack_ref (rtx_insn *, rtx *,
 struct csa_reflist *);
-static int try_apply_stack_adjustment (rtx, struct csa_reflist *,
+static int try_apply_stack_adjustment (rtx_insn *, struct csa_reflist *,
   HOST_WIDE_INT, HOST_WIDE_INT);
 static void combine_stack_adjustments_for_block (basic_block);
 static int record_stack_refs (rtx *, void *);
@@ -122,7 +123,7 @@ stack_memref_p (rtx x)
tying fp and sp adjustments.  */
 
 static rtx
-single_set_for_csa (rtx insn)
+single_set_for_csa (rtx_insn *insn)
 {
   int i;
   rtx tmp = single_set (insn);
@@ -171,7 +172,7 @@ free_csa_reflist (struct csa_reflist *reflist)
predicate stack_memref_p or a REG representing the stack pointer.  */
 
 static struct csa_reflist *
-record_one_stack_ref (rtx insn, rtx *ref, struct csa_reflist *next_reflist)
+record_one_stack_ref (rtx_insn *insn, rtx *ref, struct csa_reflist 
*next_reflist)
 {
   struct csa_reflist *ml;
 
@@ -194,7 +195,7 @@ record_one_stack_ref (rtx insn, rtx *ref, struct 
csa_reflist *next_reflist)
on success.  */
 
 static int
-try_apply_stack_adjustment (rtx insn, struct csa_reflist *reflist,
+try_apply_stack_adjustment (rtx_insn *insn, struct csa_reflist *reflist,
HOST_WIDE_INT new_adjust, HOST_WIDE_INT delta)
 {
   struct csa_reflist *ml;
@@ -240,7 +241,7 @@ try_apply_stack_adjustment (rtx insn, struct csa_reflist 
*reflist,
references in the insn and discard all other stack pointer references.  */
 struct record_stack_refs_data
 {
-  rtx insn;
+  rtx_insn *insn;
   struct csa_reflist *reflist;
 };
 
@@ -297,7 +298,7 @@ record_stack_refs (rtx *xp, void *data)
AFTER is true iff LAST follows INSN in the instruction stream.  */
 
 static void
-maybe_move_args_size_note (rtx last, rtx insn, bool after)
+maybe_move_args_size_note (rtx_insn *last, rtx_insn *insn, bool after)
 {
   rtx note, last_note;
 
@@ -319,35 +320,36 @@ maybe_move_args_size_note (rtx last, rtx insn, bool after)
 
 /* Return the next (or previous) active insn within BB.  */
 
-static rtx
-prev_active_insn_bb (basic_block bb, rtx insn)
+static rtx_insn *
+prev_active_insn_bb (basic_block bb, rtx_insn *insn)
 {
   for (insn = PREV_INSN (insn);
insn != PREV_INSN (BB_HEAD (bb));
insn = PREV_INSN (insn))
 if (active_insn_p (insn))
   return insn;
-  return NULL_RTX;
+  return NULL;
 }
 
-static rtx
-next_active_insn_bb (basic_block bb, rtx insn)
+static rtx_insn *
+next_active_insn_bb (basic_block bb, rtx_insn *insn)
 {
   for (insn = NEXT_INSN (insn);
insn != NEXT_INSN (BB_END (bb));
insn = NEXT_INSN (insn))
 if (active_insn_p (insn))
   return insn;
-  return NULL_RTX;
+  return NULL;
 }
 
 /* If INSN has a REG_ARGS_SIZE note, if possible move it to PREV.  Otherwise
search for a nearby candidate within BB where we can stick the note.  */
 
 static void
-force_move_args_size_note (basic_block bb, rtx prev, rtx insn)
+force_move_args_size_note (basic_block bb, rtx_insn *prev, rtx_insn *insn)
 {
-  rtx note, test, next_candidate, prev_candidate;
+  rtx note;
+  rtx_insn *test, *next_candidate, *prev_candidate;
 
   /* If PREV exists, tail-call to the logic in the other function.  */
   if (prev)
@@ -425,10 +427,11 @@ static void
 combine_stack_adjustments_for_block (basic_block bb)
 {
   HOST_WIDE_INT last_sp_adjust = 0;
-  rtx l

Re: [PATCH 195/236] Convert PATTERN from a macro to a pair of inline functions

2014-08-06 Thread Jakub Jelinek
On Wed, Aug 06, 2014 at 01:22:54PM -0400, David Malcolm wrote:
> gcc/
>   * rtl.h (PATTERN): Convert this macro into a pair of inline
>   functions, for now, requiring const_rtx and rtx.
> ---
>  gcc/rtl.h | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index 79cca1b..640616f 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -1226,7 +1226,15 @@ inline rtx& SET_NEXT_INSN (rtx insn)
>  #define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 2)
>  
>  /* The body of an insn.  */
> -#define PATTERN(INSN)XEXP (INSN, 3)
> +inline rtx PATTERN (const_rtx insn)
> +{
> +  return XEXP (insn, 3);
> +}
> +
> +inline rtx& PATTERN (rtx insn)
> +{
> +  return XEXP (insn, 3);
> +}

:(, that is going to make debugging harder.  Can you make sure they are
ignored by gdb?
skip file rtl.h
probably in gdbinit.in.  I guess we also want skip file gimple.h and
similarly for some other headers where we have just tiny inlines we really
don't want to step in through.

Jakub


[PATCH 208/236] resource.c: Use rtx_sequence

2014-08-06 Thread David Malcolm
gcc/
* resource.c (mark_referenced_resources): Strengthen local
"sequence" from rtx to rtx_sequence *, adding a checked cast, and
using methods of rtx_sequence to clarify the code.
(find_dead_or_set_registers): Within the switch statement, convert
a GET_CODE check to a dyn_cast, introducing local "seq".  Within
the JUMP_P handling, introduce another local "seq", adding a
checked cast to rtx_sequence *.  In both cases, use methods of
rtx_sequence to clarify the code.
(mark_set_resources): Within SEQUENCE case, introduce local "seq"
via a checked cast, and use methods of rtx_sequence to simplify
the code.
---
 gcc/resource.c | 35 +++
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/gcc/resource.c b/gcc/resource.c
index ef08976..dfd10f6 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -309,15 +309,15 @@ mark_referenced_resources (rtx x, struct resources *res,
 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 sequence = 0;
+ rtx_sequence *sequence = 0;
  int seq_size = 0;
  int i;
 
  /* If we are part of a delay slot sequence, point at the SEQUENCE.  */
  if (NEXT_INSN (insn) != x)
{
- sequence = PATTERN (NEXT_INSN (insn));
- seq_size = XVECLEN (sequence, 0);
+ sequence = as_a  (PATTERN (NEXT_INSN (insn)));
+ seq_size = sequence->len ();
  gcc_assert (GET_CODE (sequence) == SEQUENCE);
}
 
@@ -356,7 +356,7 @@ mark_referenced_resources (rtx x, struct resources *res,
{
  for (i = 1; i < seq_size; i++)
{
- rtx slot_pat = PATTERN (XVECEXP (sequence, 0, i));
+ rtx slot_pat = PATTERN (sequence->element (i));
  if (GET_CODE (slot_pat) == SET
  && rtx_equal_p (SET_DEST (slot_pat),
  XEXP (XEXP (link, 0), 0)))
@@ -473,13 +473,14 @@ find_dead_or_set_registers (rtx target, struct resources 
*res,
}
  else if (GET_CODE (PATTERN (insn)) == CLOBBER)
continue;
- else if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+ else if (rtx_sequence *seq =
+dyn_cast  (PATTERN (insn)))
{
  /* An unconditional jump can be used to fill the delay slot
 of a call, so search for a JUMP_INSN in any position.  */
- for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
+ for (i = 0; i < seq->len (); i++)
{
- this_jump_insn = XVECEXP (PATTERN (insn), 0, i);
+ this_jump_insn = seq->element (i);
  if (JUMP_P (this_jump_insn))
break;
}
@@ -536,17 +537,18 @@ find_dead_or_set_registers (rtx target, struct resources 
*res,
  if (GET_CODE (PATTERN (insn)) == SEQUENCE
  && INSN_ANNULLED_BRANCH_P (this_jump_insn))
{
- for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++)
-   INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i))
- = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, 
i));
+ rtx_sequence *seq = as_a  (PATTERN 
(insn));
+ for (i = 1; i < seq->len (); i++)
+   INSN_FROM_TARGET_P (seq->element (i))
+ = ! INSN_FROM_TARGET_P (seq->element (i));
 
  target_set = set;
  mark_set_resources (insn, &target_set, 0,
  MARK_SRC_DEST_CALL);
 
- for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++)
-   INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i))
- = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, 
i));
+ for (i = 1; i < seq->len (); i++)
+   INSN_FROM_TARGET_P (seq->element (i))
+ = ! INSN_FROM_TARGET_P (seq->element (i));
 
  mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
}
@@ -712,13 +714,14 @@ mark_set_resources (rtx x, struct resources *res, int 
in_dest,
 
 case SEQUENCE:
   {
-rtx control = XVECEXP (x, 0, 0);
+rtx_sequence *seq = as_a  (x);
+rtx control = seq->element (0);
 bool annul_p = JUMP_P (control) && INSN_ANNULLED_BRANCH_P (control);
 
 mark_set_resources (control, res, 0, mark_type);
-for (i = XVECLEN (x, 0) - 1; i >= 0; --i)
+for (i = seq->len () - 1; i >= 0; --i)
  {
-   rtx elt = XVECEXP (x, 0, i);
+   rtx elt = seq->elem

[PATCH 113/236] sched-rgn.c: Use rtx_insn in a couple of places

2014-08-06 Thread David Malcolm
gcc/
* sched-rgn.c (is_cfg_nonregular): Strengthen locals "insn" and
"next" from rtx to rtx_insn *.
(find_conditional_protection): Likewise for local "next".
(is_conditionally_protected): Likewise for local "insn1".
(is_pfree): Likewise for locals "insn1", "insn2".
---
 gcc/sched-rgn.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index f8660f8..68cab02 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -256,7 +256,7 @@ static int
 is_cfg_nonregular (void)
 {
   basic_block b;
-  rtx insn;
+  rtx_insn *insn;
 
   /* If we have a label that could be the target of a nonlocal goto, then
  the cfg is not well structured.  */
@@ -278,7 +278,8 @@ is_cfg_nonregular (void)
   FOR_EACH_BB_FN (b, cfun)
 FOR_BB_INSNS (b, insn)
   {
-   rtx note, next, set, dest;
+   rtx note, set, dest;
+   rtx_insn *next;
 
/* If this function has a computed jump, then we consider the cfg
   not well structured.  */
@@ -1877,7 +1878,7 @@ find_conditional_protection (rtx insn, int load_insn_bb)
   /* Iterate through DEF-USE forward dependences.  */
   FOR_EACH_DEP (insn, SD_LIST_FORW, sd_it, dep)
 {
-  rtx next = DEP_CON (dep);
+  rtx_insn *next = DEP_CON (dep);
 
   if ((CONTAINING_RGN (BLOCK_NUM (next)) ==
   CONTAINING_RGN (BB_TO_BLOCK (load_insn_bb)))
@@ -1913,7 +1914,7 @@ is_conditionally_protected (rtx load_insn, int bb_src, 
int bb_trg)
 
   FOR_EACH_DEP (load_insn, SD_LIST_BACK, sd_it, dep)
 {
-  rtx insn1 = DEP_PRO (dep);
+  rtx_insn *insn1 = DEP_PRO (dep);
 
   /* Must be a DEF-USE dependence upon non-branch.  */
   if (DEP_TYPE (dep) != REG_DEP_TRUE
@@ -1969,7 +1970,7 @@ is_pfree (rtx load_insn, int bb_src, int bb_trg)
 
   FOR_EACH_DEP (load_insn, SD_LIST_BACK, back_sd_it, back_dep)
 {
-  rtx insn1 = DEP_PRO (back_dep);
+  rtx_insn *insn1 = DEP_PRO (back_dep);
 
   if (DEP_TYPE (back_dep) == REG_DEP_TRUE)
/* Found a DEF-USE dependence (insn1, load_insn).  */
@@ -1979,7 +1980,7 @@ is_pfree (rtx load_insn, int bb_src, int bb_trg)
 
  FOR_EACH_DEP (insn1, SD_LIST_FORW, fore_sd_it, fore_dep)
{
- rtx insn2 = DEP_CON (fore_dep);
+ rtx_insn *insn2 = DEP_CON (fore_dep);
 
  if (DEP_TYPE (fore_dep) == REG_DEP_TRUE)
{
-- 
1.8.5.3



[PATCH 154/236] config/v850: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/v850/v850-protos.h (v850_adjust_insn_length): Strengthen
first param from rtx to rtx_insn *.
* config/v850/v850.c (v850_adjust_insn_length): Likewise for param
"insn".
---
 gcc/config/v850/v850-protos.h | 2 +-
 gcc/config/v850/v850.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h
index ba504cb..77eb827 100644
--- a/gcc/config/v850/v850-protos.h
+++ b/gcc/config/v850/v850-protos.h
@@ -39,7 +39,7 @@ extern char * construct_restore_jr  (rtx);
 extern char * construct_dispose_instruction (rtx);
 extern char * construct_prepare_instruction (rtx);
 extern intep_memory_operand (rtx, enum machine_mode, int);
-extern intv850_adjust_insn_length   (rtx, int);
+extern intv850_adjust_insn_length   (rtx_insn *, int);
 extern const char * v850_gen_movdi  (rtx *);
 extern rtxv850_gen_compare  (enum rtx_code, enum machine_mode,
 rtx, rtx);
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index eb19326..1f8780f 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -3091,7 +3091,7 @@ v850_memory_move_cost (enum machine_mode mode,
 }
 
 int
-v850_adjust_insn_length (rtx insn, int length)
+v850_adjust_insn_length (rtx_insn *insn, int length)
 {
   if (TARGET_V850E3V5_UP)
 {
-- 
1.8.5.3



[PATCH 129/236] config/avr: Use rtx_insn

2014-08-06 Thread David Malcolm
gcc/
* config/avr/avr-protos.h (output_movqi): Strengthen first param
from rtx to rtx_insn *.
(output_movhi): Likewise.
(output_movsisf): Likewise.
(avr_out_tstsi): Likewise.
(avr_out_tsthi): Likewise.
(avr_out_tstpsi): Likewise.
(avr_out_compare): Likewise.
(avr_out_compare64): Likewise.
(avr_out_movpsi): Likewise.
(ashlqi3_out): Likewise.
(ashlhi3_out): Likewise.
(ashlsi3_out): Likewise.
(ashrqi3_out): Likewise.
(ashrhi3_out): Likewise.
(ashrsi3_out): Likewise.
(lshrqi3_out): Likewise.
(lshrhi3_out): Likewise.
(lshrsi3_out): Likewise.
(avr_out_ashlpsi3): Likewise.
(avr_out_ashrpsi3): Likewise.
(avr_out_lshrpsi3): Likewise.
(avr_out_fract): Likewise.
(avr_out_sbxx_branch): Likewise.
(avr_out_round): Likewise.
(avr_out_xload): Likewise.
(avr_out_movmem): Likewise.
(adjust_insn_length): Likewise.
(avr_out_lpm): Likewise.
(reg_unused_after): Likewise.
(_reg_unused_after): Likewise.
(avr_jump_mode): Likewise for second param.
(jump_over_one_insn): Likewise for first param.
(avr_final_prescan_insn): Likewise.
(out_shift_with_cnt): Likewise for second param.

* config/avr/avr.c (get_sequence_length): Likewise for param
"insns" and local "insn".
(emit_push_byte): Likewise for local "insn".
(emit_push_sfr): Likewise.
(avr_prologue_setup_frame): Likewise for locals "insn",
"fp_plus_insns", "sp_plus_insns".
(avr_expand_epilogue): Likewise for local "fp_plus_insns",
"sp_plus_insns".
(avr_jump_mode): Likewise for param "insn".
(avr_final_prescan_insn): Likewise.
(avr_find_unused_d_reg): Likewise.
(avr_out_lpm_no_lpmx): Likewise.
(avr_out_lpm): Likewise.
(avr_out_xload): Likewise.
(output_movqi): Likewise.
(output_movhi): Likewise.
(out_movqi_r_mr): Likewise.
(out_movhi_r_mr): Likewise.
(out_movsi_r_mr): Likewise.
(out_movsi_mr_r): Likewise.
(output_movsisf): Likewise.
(avr_out_load_psi): Likewise.
(avr_out_store_psi): Likewise.
(avr_out_movpsi): Likewise.
(out_movqi_mr_r): Likewise.
(avr_out_movhi_mr_r_xmega): Likewise.
(out_movhi_mr_r): Likewise.
(compare_condition): Likewise for param "insn" and local "next".
(compare_sign_p): Likewise for param "insn".
(compare_diff_p): Likewise.
(compare_eq_p): Likewise.
(avr_out_compare): Likewise.
(avr_out_compare64): Likewise.
(avr_out_tsthi): Likewise.
(avr_out_tstpsi): Likewise.
(avr_out_tstsi): Likewise.
(out_shift_with_cnt): Likewise.
(ashlqi3_out): Likewise.
(ashlhi3_out): Likewise.
(avr_out_ashlpsi3): Likewise.
(ashlsi3_out): Likewise.
(ashrqi3_out): Likewise.
(ashrhi3_out): Likewise.
(avr_out_ashrpsi3): Likewise.
(ashrsi3_out): Likewise.
(lshrqi3_out): Likewise.
(lshrhi3_out): Likewise.
(avr_out_lshrpsi3): Likewise.
(lshrsi3_out): Likewise.
(avr_out_fract): Likewise.
(avr_out_round): Likewise.
(avr_adjust_insn_length): Likewise.
(reg_unused_after): Likewise.
(_reg_unused_after): Likewise.
(avr_compare_pattern): Likewise.
(avr_reorg_remove_redundant_compare): Likewise for param "insn1"
and locals "branch1", "branch2", "insn2", "jump".
(avr_reorg): Likewise for local "insn".
(avr_2word_insn_p): Likewise for param "insn".
(jump_over_one_insn_p): Likewise.
(avr_out_sbxx_branch): Likewise.
(avr_out_movmem): Likewise.
---
 gcc/config/avr/avr-protos.h |  69 ++--
 gcc/config/avr/avr.c| 153 +++-
 2 files changed, 114 insertions(+), 108 deletions(-)

diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index c5ce784..9fa9324 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -45,36 +45,36 @@ extern void avr_init_cumulative_args (CUMULATIVE_ARGS*, 
tree, rtx, tree);
 
 #ifdef RTX_CODE
 extern int avr_hard_regno_call_part_clobbered (unsigned, enum machine_mode);
-extern const char *output_movqi (rtx insn, rtx operands[], int *l);
-extern const char *output_movhi (rtx insn, rtx operands[], int *l);
-extern const char *output_movsisf (rtx insn, rtx operands[], int *l);
-extern const char *avr_out_tstsi (rtx, rtx*, int*);
-extern const char *avr_out_tsthi (rtx, rtx*, int*);
-extern const char *avr_out_tstpsi (rtx, rtx*, int*);
-extern const char *avr_out_compare (rtx, rtx*, int*);
-extern const char *avr_out_compare64 (rtx, rtx*, int*);
+extern const char *output_movqi (rtx_insn *insn, rtx operands[], int *l);
+exter

  1   2   3   4   >