Commit cfa434f6 by David Malcolm Committed by David Malcolm

lra: use rtx_insn

gcc/
	* lra-int.h (struct lra_insn_recog_data): Strengthen field "insn"
	from rtx to rtx_insn *.
	(lra_push_insn): Likewise for 1st param.
	(lra_push_insn_and_update_insn_regno_info): Likewise.
	(lra_pop_insn): Likewise for return type.
	(lra_invalidate_insn_data): Likewise for 1st param.
	(lra_set_insn_deleted): Likewise.
	(lra_delete_dead_insn): Likewise.
	(lra_process_new_insns): Likewise for first 3 params.
	(lra_set_insn_recog_data): Likewise for 1st param.
	(lra_update_insn_recog_data): Likewise.
	(lra_set_used_insn_alternative): Likewise.
	(lra_invalidate_insn_regno_info): Likewise.
	(lra_update_insn_regno_info): Likewise.
	(lra_former_scratch_operand_p): Likewise.
	(lra_eliminate_regs_1): Likewise.
	(lra_get_insn_recog_data): Likewise.

	* lra-assigns.c (assign_by_spills): Strengthen local "insn" from
	rtx to rtx_insn *.

	* lra-coalesce.c (move_freq_compare_func): Likewise for locals
	"mv1" and "mv2".
	(substitute_within_insn): New.
	(lra_coalesce): Strengthen locals "mv", "insn", "next" from rtx to
	rtx_insn *.  Strengthen sorted_moves from rtx * to rxt_insn **.
	Replace call to "substitute" with call to substitute_within_insn.

	* lra-constraints.c (curr_insn): Strengthen from rtx to
	rtx_insn *.
	(get_equiv_with_elimination): Likewise for param "insn".
	(match_reload): Strengthen params "before" and "after" from rtx *
	to rtx_insn **.
	(emit_spill_move): Likewise for return type.  Add a checked cast
	to rtx_insn * on result of gen_move_insn for now.
	(check_and_process_move): Likewise for local "before".  Replace
	NULL_RTX with NULL when referring to insns.
	(process_addr_reg): Strengthen params "before" and "after" from
	rtx * to rtx_insn **.
	(insert_move_for_subreg): Likewise.
	(simplify_operand_subreg): Strengthen locals "before" and "after"
	from rtx to rtx_insn *.
	(process_address_1): Strengthen params "before" and "after" from
	rtx * to rtx_insn **.  Strengthen locals "insns", "last_insn" from
	rtx to rtx_insn *.
	(process_address): Strengthen params "before" and "after" from
	rtx * to rtx_insn **.
	(emit_inc): Strengthen local "last" from rtx to rtx_insn *.
	(curr_insn_transform): Strengthen locals "before" and "after"
	from rtx to rtx_insn *.  Replace NULL_RTX with NULL when referring
	to insns.
	(loc_equivalence_callback): Update cast of "data", changing
	resulting type from rtx to rtx_insn *.
	(substitute_pseudo_within_insn): New.
	(inherit_reload_reg): Strengthen param "insn" from rtx to
	rtx_insn *; likewise for local "new_insns".  Replace NULL_RTX with
	NULL when referring to insns.  Add a checked cast to rtx_insn *
	when using usage_insn to invoke lra_update_insn_regno_info.
	(split_reg): Strengthen param "insn" from rtx to rtx_insn *;
	likewise for locals "restore", "save".  Add checked casts to
	rtx_insn * when using usage_insn to invoke
	lra_update_insn_regno_info and lra_process_new_insns.  Replace
	NULL_RTX with NULL when referring to insns.
	(split_if_necessary): Strengthen param "insn" from rtx to
	rtx_insn *.
	(update_ebb_live_info): Likewise for params "head", "tail" and local
	"prev_insn".
	(get_last_insertion_point): Likewise for return type and local "insn".
	(get_live_on_other_edges): Likewise for local "last".
	(inherit_in_ebb): Likewise for params "head", "tail" and locals
	"prev_insn", "next_insn", "restore".
	(remove_inheritance_pseudos): Likewise for local "prev_insn".
	(undo_optional_reloads): Likewise for local "insn".

	* lra-eliminations.c (lra_eliminate_regs_1): Likewise for param
	"insn".
	(lra_eliminate_regs): Replace NULL_RTX with NULL when referring to
	insns.
	(eliminate_regs_in_insn): Strengthen param "insn" from rtx to
	rtx_insn *.
	(spill_pseudos): Likewise for local "insn".
	(init_elimination): Likewise.
	(process_insn_for_elimination): Likewise for param "insn".

	* lra-lives.c (curr_insn): Likewise.;

	* lra-spills.c (assign_spill_hard_regs): Likewise for local "insn".
	(remove_pseudos): Likewise for param "insn".
	(spill_pseudos): Likewise for local "insn".
	(lra_final_code_change): Likewise for locals "insn", "curr".

	* lra.c (lra_invalidate_insn_data): Likewise for param "insn".
	(lra_set_insn_deleted): Likewise.
	(lra_delete_dead_insn): Likewise, and for local "prev".
	(new_insn_reg): Likewise for param "insn".
	(lra_set_insn_recog_data): Likewise.
	(lra_update_insn_recog_data): Likewise.
	(lra_set_used_insn_alternative): Likewise.
	(get_insn_freq): Likewise.
	(invalidate_insn_data_regno_info): Likewise.
	(lra_invalidate_insn_regno_info): Likewise.
	(lra_update_insn_regno_info): Likewise.
	(lra_constraint_insn_stack): Strengthen from vec<rtx> to
	vec<rtx_insn *>.
	(lra_push_insn_1): Strengthen param "insn" from rtx to
	rtx_insn *.
	(lra_push_insn): Likewise.
	(lra_push_insn_and_update_insn_regno_info): Likewise.
	(lra_pop_insn): Likewise for return type and local "insn".
	(push_insns): Likewise for params "from", "to", and local "insn".
	(setup_sp_offset): Likewise for params "from", "last" and locals
	"before", "insn".
	(lra_process_new_insns): Likewise for params "insn", "before",
	"after" and local "last".
	(struct sloc): Likewise for field "insn".
	(lra_former_scratch_operand_p): Likewise for param "insn".
	(remove_scratches): Likewise for locals "insn", "last".
	(check_rtl): Likewise for local "insn".
	(add_auto_inc_notes): Likewise for param "insn".
	(update_inc_notes): Likewise for local "insn".
	(lra): Replace NULL_RTX with NULL when referring to insn.

From-SVN: r214348
parent e967cc2f
2014-08-22 David Malcolm <dmalcolm@redhat.com> 2014-08-22 David Malcolm <dmalcolm@redhat.com>
* lra-int.h (struct lra_insn_recog_data): Strengthen field "insn"
from rtx to rtx_insn *.
(lra_push_insn): Likewise for 1st param.
(lra_push_insn_and_update_insn_regno_info): Likewise.
(lra_pop_insn): Likewise for return type.
(lra_invalidate_insn_data): Likewise for 1st param.
(lra_set_insn_deleted): Likewise.
(lra_delete_dead_insn): Likewise.
(lra_process_new_insns): Likewise for first 3 params.
(lra_set_insn_recog_data): Likewise for 1st param.
(lra_update_insn_recog_data): Likewise.
(lra_set_used_insn_alternative): Likewise.
(lra_invalidate_insn_regno_info): Likewise.
(lra_update_insn_regno_info): Likewise.
(lra_former_scratch_operand_p): Likewise.
(lra_eliminate_regs_1): Likewise.
(lra_get_insn_recog_data): Likewise.
* lra-assigns.c (assign_by_spills): Strengthen local "insn" from
rtx to rtx_insn *.
* lra-coalesce.c (move_freq_compare_func): Likewise for locals
"mv1" and "mv2".
(substitute_within_insn): New.
(lra_coalesce): Strengthen locals "mv", "insn", "next" from rtx to
rtx_insn *. Strengthen sorted_moves from rtx * to rxt_insn **.
Replace call to "substitute" with call to substitute_within_insn.
* lra-constraints.c (curr_insn): Strengthen from rtx to
rtx_insn *.
(get_equiv_with_elimination): Likewise for param "insn".
(match_reload): Strengthen params "before" and "after" from rtx *
to rtx_insn **.
(emit_spill_move): Likewise for return type. Add a checked cast
to rtx_insn * on result of gen_move_insn for now.
(check_and_process_move): Likewise for local "before". Replace
NULL_RTX with NULL when referring to insns.
(process_addr_reg): Strengthen params "before" and "after" from
rtx * to rtx_insn **.
(insert_move_for_subreg): Likewise.
(simplify_operand_subreg): Strengthen locals "before" and "after"
from rtx to rtx_insn *.
(process_address_1): Strengthen params "before" and "after" from
rtx * to rtx_insn **. Strengthen locals "insns", "last_insn" from
rtx to rtx_insn *.
(process_address): Strengthen params "before" and "after" from
rtx * to rtx_insn **.
(emit_inc): Strengthen local "last" from rtx to rtx_insn *.
(curr_insn_transform): Strengthen locals "before" and "after"
from rtx to rtx_insn *. Replace NULL_RTX with NULL when referring
to insns.
(loc_equivalence_callback): Update cast of "data", changing
resulting type from rtx to rtx_insn *.
(substitute_pseudo_within_insn): New.
(inherit_reload_reg): Strengthen param "insn" from rtx to
rtx_insn *; likewise for local "new_insns". Replace NULL_RTX with
NULL when referring to insns. Add a checked cast to rtx_insn *
when using usage_insn to invoke lra_update_insn_regno_info.
(split_reg): Strengthen param "insn" from rtx to rtx_insn *;
likewise for locals "restore", "save". Add checked casts to
rtx_insn * when using usage_insn to invoke
lra_update_insn_regno_info and lra_process_new_insns. Replace
NULL_RTX with NULL when referring to insns.
(split_if_necessary): Strengthen param "insn" from rtx to
rtx_insn *.
(update_ebb_live_info): Likewise for params "head", "tail" and local
"prev_insn".
(get_last_insertion_point): Likewise for return type and local "insn".
(get_live_on_other_edges): Likewise for local "last".
(inherit_in_ebb): Likewise for params "head", "tail" and locals
"prev_insn", "next_insn", "restore".
(remove_inheritance_pseudos): Likewise for local "prev_insn".
(undo_optional_reloads): Likewise for local "insn".
* lra-eliminations.c (lra_eliminate_regs_1): Likewise for param
"insn".
(lra_eliminate_regs): Replace NULL_RTX with NULL when referring to
insns.
(eliminate_regs_in_insn): Strengthen param "insn" from rtx to
rtx_insn *.
(spill_pseudos): Likewise for local "insn".
(init_elimination): Likewise.
(process_insn_for_elimination): Likewise for param "insn".
* lra-lives.c (curr_insn): Likewise.;
* lra-spills.c (assign_spill_hard_regs): Likewise for local "insn".
(remove_pseudos): Likewise for param "insn".
(spill_pseudos): Likewise for local "insn".
(lra_final_code_change): Likewise for locals "insn", "curr".
* lra.c (lra_invalidate_insn_data): Likewise for param "insn".
(lra_set_insn_deleted): Likewise.
(lra_delete_dead_insn): Likewise, and for local "prev".
(new_insn_reg): Likewise for param "insn".
(lra_set_insn_recog_data): Likewise.
(lra_update_insn_recog_data): Likewise.
(lra_set_used_insn_alternative): Likewise.
(get_insn_freq): Likewise.
(invalidate_insn_data_regno_info): Likewise.
(lra_invalidate_insn_regno_info): Likewise.
(lra_update_insn_regno_info): Likewise.
(lra_constraint_insn_stack): Strengthen from vec<rtx> to
vec<rtx_insn *>.
(lra_push_insn_1): Strengthen param "insn" from rtx to
rtx_insn *.
(lra_push_insn): Likewise.
(lra_push_insn_and_update_insn_regno_info): Likewise.
(lra_pop_insn): Likewise for return type and local "insn".
(push_insns): Likewise for params "from", "to", and local "insn".
(setup_sp_offset): Likewise for params "from", "last" and locals
"before", "insn".
(lra_process_new_insns): Likewise for params "insn", "before",
"after" and local "last".
(struct sloc): Likewise for field "insn".
(lra_former_scratch_operand_p): Likewise for param "insn".
(remove_scratches): Likewise for locals "insn", "last".
(check_rtl): Likewise for local "insn".
(add_auto_inc_notes): Likewise for param "insn".
(update_inc_notes): Likewise for local "insn".
(lra): Replace NULL_RTX with NULL when referring to insn.
2014-08-22 David Malcolm <dmalcolm@redhat.com>
* lower-subreg.c (simple_move): Strengthen param "insn" from rtx * lower-subreg.c (simple_move): Strengthen param "insn" from rtx
to rtx_insn *. to rtx_insn *.
(resolve_reg_notes): Likewise. (resolve_reg_notes): Likewise.
......
...@@ -1221,7 +1221,7 @@ static void ...@@ -1221,7 +1221,7 @@ static void
assign_by_spills (void) assign_by_spills (void)
{ {
int i, n, nfails, iter, regno, hard_regno, cost, restore_regno; int i, n, nfails, iter, regno, hard_regno, cost, restore_regno;
rtx insn; rtx_insn *insn;
bitmap_head changed_insns, do_not_assign_nonreload_pseudos; bitmap_head changed_insns, do_not_assign_nonreload_pseudos;
unsigned int u, conflict_regno; unsigned int u, conflict_regno;
bitmap_iterator bi; bitmap_iterator bi;
......
...@@ -75,8 +75,8 @@ static int *first_coalesced_pseudo, *next_coalesced_pseudo; ...@@ -75,8 +75,8 @@ static int *first_coalesced_pseudo, *next_coalesced_pseudo;
static int static int
move_freq_compare_func (const void *v1p, const void *v2p) move_freq_compare_func (const void *v1p, const void *v2p)
{ {
rtx mv1 = *(const rtx *) v1p; rtx_insn *mv1 = *(rtx_insn * const *) v1p;
rtx mv2 = *(const rtx *) v2p; rtx_insn *mv2 = *(rtx_insn * const *) v2p;
int pri1, pri2; int pri1, pri2;
pri1 = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv1)); pri1 = REG_FREQ_FROM_BB (BLOCK_FOR_INSN (mv1));
...@@ -168,6 +168,16 @@ substitute (rtx *loc) ...@@ -168,6 +168,16 @@ substitute (rtx *loc)
return res; return res;
} }
/* Specialize "substitute" for use on an insn. This can't change
the insn ptr, just the contents of the insn. */
static bool
substitute_within_insn (rtx_insn *insn)
{
rtx loc = insn;
return substitute (&loc);
}
/* The current iteration (1, 2, ...) of the coalescing pass. */ /* The current iteration (1, 2, ...) of the coalescing pass. */
int lra_coalesce_iter; int lra_coalesce_iter;
...@@ -219,7 +229,8 @@ bool ...@@ -219,7 +229,8 @@ bool
lra_coalesce (void) lra_coalesce (void)
{ {
basic_block bb; basic_block bb;
rtx mv, set, insn, next, *sorted_moves; rtx_insn *mv, *insn, *next, **sorted_moves;
rtx set;
int i, mv_num, sregno, dregno; int i, mv_num, sregno, dregno;
unsigned int regno; unsigned int regno;
int coalesced_moves; int coalesced_moves;
...@@ -238,7 +249,7 @@ lra_coalesce (void) ...@@ -238,7 +249,7 @@ lra_coalesce (void)
next_coalesced_pseudo = XNEWVEC (int, max_regno); next_coalesced_pseudo = XNEWVEC (int, max_regno);
for (i = 0; i < max_regno; i++) for (i = 0; i < max_regno; i++)
first_coalesced_pseudo[i] = next_coalesced_pseudo[i] = i; first_coalesced_pseudo[i] = next_coalesced_pseudo[i] = i;
sorted_moves = XNEWVEC (rtx, get_max_uid ()); sorted_moves = XNEWVEC (rtx_insn *, get_max_uid ());
mv_num = 0; mv_num = 0;
/* Collect moves. */ /* Collect moves. */
coalesced_moves = 0; coalesced_moves = 0;
...@@ -308,7 +319,7 @@ lra_coalesce (void) ...@@ -308,7 +319,7 @@ lra_coalesce (void)
if (INSN_P (insn) if (INSN_P (insn)
&& bitmap_bit_p (&involved_insns_bitmap, INSN_UID (insn))) && bitmap_bit_p (&involved_insns_bitmap, INSN_UID (insn)))
{ {
if (! substitute (&insn)) if (! substitute_within_insn (insn))
continue; continue;
lra_update_insn_regno_info (insn); lra_update_insn_regno_info (insn);
if ((set = single_set (insn)) != NULL_RTX && set_noop_p (set)) if ((set = single_set (insn)) != NULL_RTX && set_noop_p (set))
......
...@@ -302,7 +302,7 @@ get_elimination (rtx reg) ...@@ -302,7 +302,7 @@ get_elimination (rtx reg)
If we make full substitution to SP for non-null INSN, add the insn If we make full substitution to SP for non-null INSN, add the insn
sp offset. */ sp offset. */
rtx rtx
lra_eliminate_regs_1 (rtx insn, rtx x, enum machine_mode mem_mode, lra_eliminate_regs_1 (rtx_insn *insn, rtx x, enum machine_mode mem_mode,
bool subst_p, bool update_p, bool full_p) bool subst_p, bool update_p, bool full_p)
{ {
enum rtx_code code = GET_CODE (x); enum rtx_code code = GET_CODE (x);
...@@ -657,7 +657,7 @@ rtx ...@@ -657,7 +657,7 @@ rtx
lra_eliminate_regs (rtx x, enum machine_mode mem_mode, lra_eliminate_regs (rtx x, enum machine_mode mem_mode,
rtx insn ATTRIBUTE_UNUSED) rtx insn ATTRIBUTE_UNUSED)
{ {
return lra_eliminate_regs_1 (NULL_RTX, x, mem_mode, true, false, true); return lra_eliminate_regs_1 (NULL, x, mem_mode, true, false, true);
} }
/* Stack pointer offset before the current insn relative to one at the /* Stack pointer offset before the current insn relative to one at the
...@@ -848,7 +848,7 @@ remove_reg_equal_offset_note (rtx insn, rtx what) ...@@ -848,7 +848,7 @@ remove_reg_equal_offset_note (rtx insn, rtx what)
previously used) in future. */ previously used) in future. */
static void static void
eliminate_regs_in_insn (rtx insn, bool replace_p, bool first_p) eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p)
{ {
int icode = recog_memoized (insn); int icode = recog_memoized (insn);
rtx old_set = single_set (insn); rtx old_set = single_set (insn);
...@@ -1086,7 +1086,7 @@ spill_pseudos (HARD_REG_SET set) ...@@ -1086,7 +1086,7 @@ spill_pseudos (HARD_REG_SET set)
{ {
int i; int i;
bitmap_head to_process; bitmap_head to_process;
rtx insn; rtx_insn *insn;
if (hard_reg_set_empty_p (set)) if (hard_reg_set_empty_p (set))
return; return;
...@@ -1290,7 +1290,7 @@ init_elimination (void) ...@@ -1290,7 +1290,7 @@ init_elimination (void)
{ {
bool stop_to_sp_elimination_p; bool stop_to_sp_elimination_p;
basic_block bb; basic_block bb;
rtx insn; rtx_insn *insn;
struct elim_table *ep; struct elim_table *ep;
init_elim_table (); init_elim_table ();
...@@ -1339,7 +1339,7 @@ lra_eliminate_reg_if_possible (rtx *loc) ...@@ -1339,7 +1339,7 @@ lra_eliminate_reg_if_possible (rtx *loc)
the insn for subsequent processing in the constraint pass, update the insn for subsequent processing in the constraint pass, update
the insn info. */ the insn info. */
static void static void
process_insn_for_elimination (rtx insn, bool final_p, bool first_p) process_insn_for_elimination (rtx_insn *insn, bool final_p, bool first_p)
{ {
eliminate_regs_in_insn (insn, final_p, first_p); eliminate_regs_in_insn (insn, final_p, first_p);
if (! final_p) if (! final_p)
......
...@@ -218,7 +218,7 @@ struct lra_insn_recog_data ...@@ -218,7 +218,7 @@ struct lra_insn_recog_data
/* SP offset before the insn relative to one at the func start. */ /* SP offset before the insn relative to one at the func start. */
HOST_WIDE_INT sp_offset; HOST_WIDE_INT sp_offset;
/* The insn itself. */ /* The insn itself. */
rtx insn; rtx_insn *insn;
/* Common data for insns with the same ICODE. Asm insns (their /* Common data for insns with the same ICODE. Asm insns (their
ICODE is negative) do not share such structures. */ ICODE is negative) do not share such structures. */
struct lra_static_insn_data *insn_static_data; struct lra_static_insn_data *insn_static_data;
...@@ -280,38 +280,39 @@ extern lra_insn_recog_data_t *lra_insn_recog_data; ...@@ -280,38 +280,39 @@ extern lra_insn_recog_data_t *lra_insn_recog_data;
extern int lra_curr_reload_num; extern int lra_curr_reload_num;
extern void lra_push_insn (rtx); extern void lra_push_insn (rtx_insn *);
extern void lra_push_insn_by_uid (unsigned int); extern void lra_push_insn_by_uid (unsigned int);
extern void lra_push_insn_and_update_insn_regno_info (rtx); extern void lra_push_insn_and_update_insn_regno_info (rtx_insn *);
extern rtx lra_pop_insn (void); extern rtx_insn *lra_pop_insn (void);
extern unsigned int lra_insn_stack_length (void); extern unsigned int lra_insn_stack_length (void);
extern rtx lra_create_new_reg_with_unique_value (enum machine_mode, rtx, extern rtx lra_create_new_reg_with_unique_value (enum machine_mode, rtx,
enum reg_class, const char *); enum reg_class, const char *);
extern void lra_set_regno_unique_value (int); extern void lra_set_regno_unique_value (int);
extern void lra_invalidate_insn_data (rtx); extern void lra_invalidate_insn_data (rtx_insn *);
extern void lra_set_insn_deleted (rtx); extern void lra_set_insn_deleted (rtx_insn *);
extern void lra_delete_dead_insn (rtx); extern void lra_delete_dead_insn (rtx_insn *);
extern void lra_emit_add (rtx, rtx, rtx); extern void lra_emit_add (rtx, rtx, rtx);
extern void lra_emit_move (rtx, rtx); extern void lra_emit_move (rtx, rtx);
extern void lra_update_dups (lra_insn_recog_data_t, signed char *); extern void lra_update_dups (lra_insn_recog_data_t, signed char *);
extern void lra_process_new_insns (rtx, rtx, rtx, const char *); extern void lra_process_new_insns (rtx_insn *, rtx_insn *, rtx_insn *,
const char *);
extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx); extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx_insn *);
extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx); extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx_insn *);
extern void lra_set_used_insn_alternative (rtx, int); extern void lra_set_used_insn_alternative (rtx_insn *, int);
extern void lra_set_used_insn_alternative_by_uid (int, int); extern void lra_set_used_insn_alternative_by_uid (int, int);
extern void lra_invalidate_insn_regno_info (rtx); extern void lra_invalidate_insn_regno_info (rtx_insn *);
extern void lra_update_insn_regno_info (rtx); extern void lra_update_insn_regno_info (rtx_insn *);
extern struct lra_insn_reg *lra_get_insn_regs (int); extern struct lra_insn_reg *lra_get_insn_regs (int);
extern void lra_free_copies (void); extern void lra_free_copies (void);
extern void lra_create_copy (int, int, int); extern void lra_create_copy (int, int, int);
extern lra_copy_t lra_get_copy (int); extern lra_copy_t lra_get_copy (int);
extern bool lra_former_scratch_p (int); extern bool lra_former_scratch_p (int);
extern bool lra_former_scratch_operand_p (rtx, int); extern bool lra_former_scratch_operand_p (rtx_insn *, int);
extern int lra_new_regno_start; extern int lra_new_regno_start;
extern int lra_constraint_new_regno_start; extern int lra_constraint_new_regno_start;
...@@ -384,7 +385,8 @@ extern void lra_final_code_change (void); ...@@ -384,7 +385,8 @@ extern void lra_final_code_change (void);
extern void lra_debug_elim_table (void); extern void lra_debug_elim_table (void);
extern int lra_get_elimination_hard_regno (int); extern int lra_get_elimination_hard_regno (int);
extern rtx lra_eliminate_regs_1 (rtx, rtx, enum machine_mode, bool, bool, bool); extern rtx lra_eliminate_regs_1 (rtx_insn *, rtx, enum machine_mode, bool,
bool, bool);
extern void lra_eliminate (bool, bool); extern void lra_eliminate (bool, bool);
extern void lra_eliminate_reg_if_possible (rtx *); extern void lra_eliminate_reg_if_possible (rtx *);
...@@ -450,7 +452,7 @@ lra_update_operator_dups (lra_insn_recog_data_t id) ...@@ -450,7 +452,7 @@ lra_update_operator_dups (lra_insn_recog_data_t id)
/* Return info about INSN. Set up the info if it is not done yet. */ /* Return info about INSN. Set up the info if it is not done yet. */
static inline lra_insn_recog_data_t static inline lra_insn_recog_data_t
lra_get_insn_recog_data (rtx insn) lra_get_insn_recog_data (rtx_insn *insn)
{ {
lra_insn_recog_data_t data; lra_insn_recog_data_t data;
unsigned int uid = INSN_UID (insn); unsigned int uid = INSN_UID (insn);
......
...@@ -358,7 +358,7 @@ mark_regno_dead (int regno, enum machine_mode mode, int point) ...@@ -358,7 +358,7 @@ mark_regno_dead (int regno, enum machine_mode mode, int point)
} }
/* Insn currently scanned. */ /* Insn currently scanned. */
static rtx curr_insn; static rtx_insn *curr_insn;
/* The insn data. */ /* The insn data. */
static lra_insn_recog_data_t curr_id; static lra_insn_recog_data_t curr_id;
/* The insn static data. */ /* The insn static data. */
......
...@@ -256,7 +256,8 @@ assign_spill_hard_regs (int *pseudo_regnos, int n) ...@@ -256,7 +256,8 @@ assign_spill_hard_regs (int *pseudo_regnos, int n)
enum reg_class rclass, spill_class; enum reg_class rclass, spill_class;
enum machine_mode mode; enum machine_mode mode;
lra_live_range_t r; lra_live_range_t r;
rtx insn, set; rtx_insn *insn;
rtx set;
basic_block bb; basic_block bb;
HARD_REG_SET conflict_hard_regs; HARD_REG_SET conflict_hard_regs;
bitmap_head ok_insn_bitmap; bitmap_head ok_insn_bitmap;
...@@ -411,7 +412,7 @@ assign_stack_slot_num_and_sort_pseudos (int *pseudo_regnos, int n) ...@@ -411,7 +412,7 @@ assign_stack_slot_num_and_sort_pseudos (int *pseudo_regnos, int n)
corresponding memory or spilled hard reg. Ignore spilled pseudos corresponding memory or spilled hard reg. Ignore spilled pseudos
created from the scratches. */ created from the scratches. */
static void static void
remove_pseudos (rtx *loc, rtx insn) remove_pseudos (rtx *loc, rtx_insn *insn)
{ {
int i; int i;
rtx hard_reg; rtx hard_reg;
...@@ -463,7 +464,7 @@ static void ...@@ -463,7 +464,7 @@ static void
spill_pseudos (void) spill_pseudos (void)
{ {
basic_block bb; basic_block bb;
rtx insn; rtx_insn *insn;
int i; int i;
bitmap_head spilled_pseudos, changed_insns; bitmap_head spilled_pseudos, changed_insns;
...@@ -679,7 +680,7 @@ lra_final_code_change (void) ...@@ -679,7 +680,7 @@ lra_final_code_change (void)
{ {
int i, hard_regno; int i, hard_regno;
basic_block bb; basic_block bb;
rtx insn, curr; rtx_insn *insn, *curr;
int max_regno = max_reg_num (); int max_regno = max_reg_num ();
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
......
...@@ -125,8 +125,9 @@ HARD_REG_SET lra_no_alloc_regs; ...@@ -125,8 +125,9 @@ HARD_REG_SET lra_no_alloc_regs;
static int get_new_reg_value (void); static int get_new_reg_value (void);
static void expand_reg_info (void); static void expand_reg_info (void);
static void invalidate_insn_recog_data (int); static void invalidate_insn_recog_data (int);
static int get_insn_freq (rtx); static int get_insn_freq (rtx_insn *);
static void invalidate_insn_data_regno_info (lra_insn_recog_data_t, rtx, int); static void invalidate_insn_data_regno_info (lra_insn_recog_data_t,
rtx_insn *, int);
/* Expand all regno related info needed for LRA. */ /* Expand all regno related info needed for LRA. */
static void static void
...@@ -210,7 +211,7 @@ lra_set_regno_unique_value (int regno) ...@@ -210,7 +211,7 @@ lra_set_regno_unique_value (int regno)
/* Invalidate INSN related info used by LRA. The info should never be /* Invalidate INSN related info used by LRA. The info should never be
used after that. */ used after that. */
void void
lra_invalidate_insn_data (rtx insn) lra_invalidate_insn_data (rtx_insn *insn)
{ {
lra_invalidate_insn_regno_info (insn); lra_invalidate_insn_regno_info (insn);
invalidate_insn_recog_data (INSN_UID (insn)); invalidate_insn_recog_data (INSN_UID (insn));
...@@ -219,7 +220,7 @@ lra_invalidate_insn_data (rtx insn) ...@@ -219,7 +220,7 @@ lra_invalidate_insn_data (rtx insn)
/* Mark INSN deleted and invalidate the insn related info used by /* Mark INSN deleted and invalidate the insn related info used by
LRA. */ LRA. */
void void
lra_set_insn_deleted (rtx insn) lra_set_insn_deleted (rtx_insn *insn)
{ {
lra_invalidate_insn_data (insn); lra_invalidate_insn_data (insn);
SET_INSN_DELETED (insn); SET_INSN_DELETED (insn);
...@@ -228,9 +229,9 @@ lra_set_insn_deleted (rtx insn) ...@@ -228,9 +229,9 @@ lra_set_insn_deleted (rtx insn)
/* Delete an unneeded INSN and any previous insns who sole purpose is /* Delete an unneeded INSN and any previous insns who sole purpose is
loading data that is dead in INSN. */ loading data that is dead in INSN. */
void void
lra_delete_dead_insn (rtx insn) lra_delete_dead_insn (rtx_insn *insn)
{ {
rtx prev = prev_real_insn (insn); rtx_insn *prev = prev_real_insn (insn);
rtx prev_dest; rtx prev_dest;
/* If the previous insn sets a register that dies in our insn, /* If the previous insn sets a register that dies in our insn,
...@@ -503,7 +504,8 @@ init_insn_regs (void) ...@@ -503,7 +504,8 @@ init_insn_regs (void)
in the insn (EARLY_CLOBBER), and reference to the next insn reg in the insn (EARLY_CLOBBER), and reference to the next insn reg
info (NEXT). */ info (NEXT). */
static struct lra_insn_reg * static struct lra_insn_reg *
new_insn_reg (rtx insn, int regno, enum op_type type, enum machine_mode mode, new_insn_reg (rtx_insn *insn, int regno, enum op_type type,
enum machine_mode mode,
bool subreg_p, bool early_clobber, struct lra_insn_reg *next) bool subreg_p, bool early_clobber, struct lra_insn_reg *next)
{ {
struct lra_insn_reg *ir; struct lra_insn_reg *ir;
...@@ -886,7 +888,7 @@ collect_non_operand_hard_regs (rtx *x, lra_insn_recog_data_t data, ...@@ -886,7 +888,7 @@ collect_non_operand_hard_regs (rtx *x, lra_insn_recog_data_t data,
/* Set up and return info about INSN. Set up the info if it is not set up /* Set up and return info about INSN. Set up the info if it is not set up
yet. */ yet. */
lra_insn_recog_data_t lra_insn_recog_data_t
lra_set_insn_recog_data (rtx insn) lra_set_insn_recog_data (rtx_insn *insn)
{ {
lra_insn_recog_data_t data; lra_insn_recog_data_t data;
int i, n, icode; int i, n, icode;
...@@ -1123,7 +1125,7 @@ invalidate_insn_recog_data (int uid) ...@@ -1123,7 +1125,7 @@ invalidate_insn_recog_data (int uid)
/* Update all the insn info about INSN. It is usually called when /* Update all the insn info about INSN. It is usually called when
something in the insn was changed. Return the updated info. */ something in the insn was changed. Return the updated info. */
lra_insn_recog_data_t lra_insn_recog_data_t
lra_update_insn_recog_data (rtx insn) lra_update_insn_recog_data (rtx_insn *insn)
{ {
lra_insn_recog_data_t data; lra_insn_recog_data_t data;
int n; int n;
...@@ -1227,7 +1229,7 @@ lra_update_insn_recog_data (rtx insn) ...@@ -1227,7 +1229,7 @@ lra_update_insn_recog_data (rtx insn)
/* Set up that INSN is using alternative ALT now. */ /* Set up that INSN is using alternative ALT now. */
void void
lra_set_used_insn_alternative (rtx insn, int alt) lra_set_used_insn_alternative (rtx_insn *insn, int alt)
{ {
lra_insn_recog_data_t data; lra_insn_recog_data_t data;
...@@ -1521,7 +1523,7 @@ add_regs_to_insn_regno_info (lra_insn_recog_data_t data, rtx x, int uid, ...@@ -1521,7 +1523,7 @@ add_regs_to_insn_regno_info (lra_insn_recog_data_t data, rtx x, int uid,
/* Return execution frequency of INSN. */ /* Return execution frequency of INSN. */
static int static int
get_insn_freq (rtx insn) get_insn_freq (rtx_insn *insn)
{ {
basic_block bb = BLOCK_FOR_INSN (insn); basic_block bb = BLOCK_FOR_INSN (insn);
...@@ -1532,7 +1534,7 @@ get_insn_freq (rtx insn) ...@@ -1532,7 +1534,7 @@ get_insn_freq (rtx insn)
/* Invalidate all reg info of INSN with DATA and execution frequency /* Invalidate all reg info of INSN with DATA and execution frequency
FREQ. Update common info about the invalidated registers. */ FREQ. Update common info about the invalidated registers. */
static void static void
invalidate_insn_data_regno_info (lra_insn_recog_data_t data, rtx insn, invalidate_insn_data_regno_info (lra_insn_recog_data_t data, rtx_insn *insn,
int freq) int freq)
{ {
int uid; int uid;
...@@ -1561,7 +1563,7 @@ invalidate_insn_data_regno_info (lra_insn_recog_data_t data, rtx insn, ...@@ -1561,7 +1563,7 @@ invalidate_insn_data_regno_info (lra_insn_recog_data_t data, rtx insn,
/* Invalidate all reg info of INSN. Update common info about the /* Invalidate all reg info of INSN. Update common info about the
invalidated registers. */ invalidated registers. */
void void
lra_invalidate_insn_regno_info (rtx insn) lra_invalidate_insn_regno_info (rtx_insn *insn)
{ {
invalidate_insn_data_regno_info (lra_get_insn_recog_data (insn), insn, invalidate_insn_data_regno_info (lra_get_insn_recog_data (insn), insn,
get_insn_freq (insn)); get_insn_freq (insn));
...@@ -1586,7 +1588,7 @@ setup_insn_reg_info (lra_insn_recog_data_t data, int freq) ...@@ -1586,7 +1588,7 @@ setup_insn_reg_info (lra_insn_recog_data_t data, int freq)
/* Set up insn reg info of INSN. Update common reg info from reg info /* Set up insn reg info of INSN. Update common reg info from reg info
of INSN. */ of INSN. */
void void
lra_update_insn_regno_info (rtx insn) lra_update_insn_regno_info (rtx_insn *insn)
{ {
int i, uid, freq; int i, uid, freq;
lra_insn_recog_data_t data; lra_insn_recog_data_t data;
...@@ -1630,13 +1632,13 @@ lra_get_insn_regs (int uid) ...@@ -1630,13 +1632,13 @@ lra_get_insn_regs (int uid)
static sbitmap lra_constraint_insn_stack_bitmap; static sbitmap lra_constraint_insn_stack_bitmap;
/* The stack itself. */ /* The stack itself. */
vec<rtx> lra_constraint_insn_stack; vec<rtx_insn *> lra_constraint_insn_stack;
/* Put INSN on the stack. If ALWAYS_UPDATE is true, always update the reg /* Put INSN on the stack. If ALWAYS_UPDATE is true, always update the reg
info for INSN, otherwise only update it if INSN is not already on the info for INSN, otherwise only update it if INSN is not already on the
stack. */ stack. */
static inline void static inline void
lra_push_insn_1 (rtx insn, bool always_update) lra_push_insn_1 (rtx_insn *insn, bool always_update)
{ {
unsigned int uid = INSN_UID (insn); unsigned int uid = INSN_UID (insn);
if (always_update) if (always_update)
...@@ -1654,14 +1656,14 @@ lra_push_insn_1 (rtx insn, bool always_update) ...@@ -1654,14 +1656,14 @@ lra_push_insn_1 (rtx insn, bool always_update)
/* Put INSN on the stack. */ /* Put INSN on the stack. */
void void
lra_push_insn (rtx insn) lra_push_insn (rtx_insn *insn)
{ {
lra_push_insn_1 (insn, false); lra_push_insn_1 (insn, false);
} }
/* Put INSN on the stack and update its reg info. */ /* Put INSN on the stack and update its reg info. */
void void
lra_push_insn_and_update_insn_regno_info (rtx insn) lra_push_insn_and_update_insn_regno_info (rtx_insn *insn)
{ {
lra_push_insn_1 (insn, true); lra_push_insn_1 (insn, true);
} }
...@@ -1674,10 +1676,10 @@ lra_push_insn_by_uid (unsigned int uid) ...@@ -1674,10 +1676,10 @@ lra_push_insn_by_uid (unsigned int uid)
} }
/* Take the last-inserted insns off the stack and return it. */ /* Take the last-inserted insns off the stack and return it. */
rtx rtx_insn *
lra_pop_insn (void) lra_pop_insn (void)
{ {
rtx insn = lra_constraint_insn_stack.pop (); rtx_insn *insn = lra_constraint_insn_stack.pop ();
bitmap_clear_bit (lra_constraint_insn_stack_bitmap, INSN_UID (insn)); bitmap_clear_bit (lra_constraint_insn_stack_bitmap, INSN_UID (insn));
return insn; return insn;
} }
...@@ -1691,9 +1693,9 @@ lra_insn_stack_length (void) ...@@ -1691,9 +1693,9 @@ lra_insn_stack_length (void)
/* Push insns FROM to TO (excluding it) going in reverse order. */ /* Push insns FROM to TO (excluding it) going in reverse order. */
static void static void
push_insns (rtx from, rtx to) push_insns (rtx_insn *from, rtx_insn *to)
{ {
rtx insn; rtx_insn *insn;
if (from == NULL_RTX) if (from == NULL_RTX)
return; return;
...@@ -1706,13 +1708,13 @@ push_insns (rtx from, rtx to) ...@@ -1706,13 +1708,13 @@ push_insns (rtx from, rtx to)
taken from the next BB insn after LAST or zero if there in such taken from the next BB insn after LAST or zero if there in such
insn. */ insn. */
static void static void
setup_sp_offset (rtx from, rtx last) setup_sp_offset (rtx_insn *from, rtx_insn *last)
{ {
rtx before = next_nonnote_insn_bb (last); rtx_insn *before = next_nonnote_insn_bb (last);
HOST_WIDE_INT offset = (before == NULL_RTX || ! INSN_P (before) HOST_WIDE_INT offset = (before == NULL_RTX || ! INSN_P (before)
? 0 : lra_get_insn_recog_data (before)->sp_offset); ? 0 : lra_get_insn_recog_data (before)->sp_offset);
for (rtx insn = from; insn != NEXT_INSN (last); insn = NEXT_INSN (insn)) for (rtx_insn *insn = from; insn != NEXT_INSN (last); insn = NEXT_INSN (insn))
lra_get_insn_recog_data (insn)->sp_offset = offset; lra_get_insn_recog_data (insn)->sp_offset = offset;
} }
...@@ -1720,9 +1722,10 @@ setup_sp_offset (rtx from, rtx last) ...@@ -1720,9 +1722,10 @@ setup_sp_offset (rtx from, rtx last)
insns onto the stack. Print about emitting the insns with insns onto the stack. Print about emitting the insns with
TITLE. */ TITLE. */
void void
lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title) lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after,
const char *title)
{ {
rtx last; rtx_insn *last;
if (before == NULL_RTX && after == NULL_RTX) if (before == NULL_RTX && after == NULL_RTX)
return; return;
...@@ -1772,7 +1775,7 @@ lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title) ...@@ -1772,7 +1775,7 @@ lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title)
/* Description of location of a former scratch operand. */ /* Description of location of a former scratch operand. */
struct sloc struct sloc
{ {
rtx insn; /* Insn where the scratch was. */ rtx_insn *insn; /* Insn where the scratch was. */
int nop; /* Number of the operand which was a scratch. */ int nop; /* Number of the operand which was a scratch. */
}; };
...@@ -1796,7 +1799,7 @@ lra_former_scratch_p (int regno) ...@@ -1796,7 +1799,7 @@ lra_former_scratch_p (int regno)
/* Return true if the operand NOP of INSN is a former scratch. */ /* Return true if the operand NOP of INSN is a former scratch. */
bool bool
lra_former_scratch_operand_p (rtx insn, int nop) lra_former_scratch_operand_p (rtx_insn *insn, int nop)
{ {
return bitmap_bit_p (&scratch_operand_bitmap, return bitmap_bit_p (&scratch_operand_bitmap,
INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0; INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0;
...@@ -1809,7 +1812,8 @@ remove_scratches (void) ...@@ -1809,7 +1812,8 @@ remove_scratches (void)
int i; int i;
bool insn_changed_p; bool insn_changed_p;
basic_block bb; basic_block bb;
rtx insn, reg; rtx_insn *insn;
rtx reg;
sloc_t loc; sloc_t loc;
lra_insn_recog_data_t id; lra_insn_recog_data_t id;
struct lra_static_insn_data *static_id; struct lra_static_insn_data *static_id;
...@@ -1860,7 +1864,7 @@ restore_scratches (void) ...@@ -1860,7 +1864,7 @@ restore_scratches (void)
int regno; int regno;
unsigned i; unsigned i;
sloc_t loc; sloc_t loc;
rtx last = NULL_RTX; rtx_insn *last = NULL;
lra_insn_recog_data_t id = NULL; lra_insn_recog_data_t id = NULL;
for (i = 0; scratches.iterate (i, &loc); i++) for (i = 0; scratches.iterate (i, &loc); i++)
...@@ -1903,7 +1907,7 @@ static void ...@@ -1903,7 +1907,7 @@ static void
check_rtl (bool final_p) check_rtl (bool final_p)
{ {
basic_block bb; basic_block bb;
rtx insn; rtx_insn *insn;
lra_assert (! final_p || reload_completed); lra_assert (! final_p || reload_completed);
FOR_EACH_BB_FN (bb, cfun) FOR_EACH_BB_FN (bb, cfun)
...@@ -1985,7 +1989,7 @@ has_nonexceptional_receiver (void) ...@@ -1985,7 +1989,7 @@ has_nonexceptional_receiver (void)
/* Process recursively X of INSN and add REG_INC notes if necessary. */ /* Process recursively X of INSN and add REG_INC notes if necessary. */
static void static void
add_auto_inc_notes (rtx insn, rtx x) add_auto_inc_notes (rtx_insn *insn, rtx x)
{ {
enum rtx_code code = GET_CODE (x); enum rtx_code code = GET_CODE (x);
const char *fmt; const char *fmt;
...@@ -2020,7 +2024,7 @@ update_inc_notes (void) ...@@ -2020,7 +2024,7 @@ update_inc_notes (void)
{ {
rtx *pnote; rtx *pnote;
basic_block bb; basic_block bb;
rtx insn; rtx_insn *insn;
FOR_EACH_BB_FN (bb, cfun) FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn) FOR_BB_INSNS (bb, insn)
...@@ -2165,7 +2169,7 @@ lra (FILE *f) ...@@ -2165,7 +2169,7 @@ lra (FILE *f)
lra_live_ranges_init (); lra_live_ranges_init ();
lra_constraints_init (); lra_constraints_init ();
lra_curr_reload_num = 0; lra_curr_reload_num = 0;
push_insns (get_last_insn (), NULL_RTX); push_insns (get_last_insn (), NULL);
/* It is needed for the 1st coalescing. */ /* It is needed for the 1st coalescing. */
lra_constraint_new_insn_uid_start = get_max_uid (); lra_constraint_new_insn_uid_start = get_max_uid ();
bitmap_initialize (&lra_inheritance_pseudos, &reg_obstack); bitmap_initialize (&lra_inheritance_pseudos, &reg_obstack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment