summaryrefslogtreecommitdiff
path: root/gcc/lra.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-22 18:36:35 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-22 18:36:35 +0000
commit7f836b57868284d9f2ef53a63d010558c1bf3432 (patch)
tree04f6cbf5b4fcd0a0254eb6bc03edb6b0f5113408 /gcc/lra.c
parenta5942062896ea87571059a4971eaf71df7b8c2b1 (diff)
downloadgcc-7f836b57868284d9f2ef53a63d010558c1bf3432.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lra.c')
-rw-r--r--gcc/lra.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/gcc/lra.c b/gcc/lra.c
index 6442b1d7514..b8b09689f19 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -125,8 +125,9 @@ HARD_REG_SET lra_no_alloc_regs;
static int get_new_reg_value (void);
static void expand_reg_info (void);
static void invalidate_insn_recog_data (int);
-static int get_insn_freq (rtx);
-static void invalidate_insn_data_regno_info (lra_insn_recog_data_t, rtx, int);
+static int get_insn_freq (rtx_insn *);
+static void invalidate_insn_data_regno_info (lra_insn_recog_data_t,
+ rtx_insn *, int);
/* Expand all regno related info needed for LRA. */
static void
@@ -210,7 +211,7 @@ lra_set_regno_unique_value (int regno)
/* Invalidate INSN related info used by LRA. The info should never be
used after that. */
void
-lra_invalidate_insn_data (rtx insn)
+lra_invalidate_insn_data (rtx_insn *insn)
{
lra_invalidate_insn_regno_info (insn);
invalidate_insn_recog_data (INSN_UID (insn));
@@ -219,7 +220,7 @@ lra_invalidate_insn_data (rtx insn)
/* Mark INSN deleted and invalidate the insn related info used by
LRA. */
void
-lra_set_insn_deleted (rtx insn)
+lra_set_insn_deleted (rtx_insn *insn)
{
lra_invalidate_insn_data (insn);
SET_INSN_DELETED (insn);
@@ -228,9 +229,9 @@ lra_set_insn_deleted (rtx insn)
/* Delete an unneeded INSN and any previous insns who sole purpose is
loading data that is dead in INSN. */
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;
/* If the previous insn sets a register that dies in our insn,
@@ -503,7 +504,8 @@ init_insn_regs (void)
in the insn (EARLY_CLOBBER), and reference to the next insn reg
info (NEXT). */
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)
{
struct lra_insn_reg *ir;
@@ -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
yet. */
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;
int i, n, icode;
@@ -1123,7 +1125,7 @@ invalidate_insn_recog_data (int uid)
/* Update all the insn info about INSN. It is usually called when
something in the insn was changed. Return the updated info. */
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;
int n;
@@ -1227,7 +1229,7 @@ lra_update_insn_recog_data (rtx insn)
/* Set up that INSN is using alternative ALT now. */
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;
@@ -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. */
static int
-get_insn_freq (rtx insn)
+get_insn_freq (rtx_insn *insn)
{
basic_block bb = BLOCK_FOR_INSN (insn);
@@ -1532,7 +1534,7 @@ get_insn_freq (rtx insn)
/* Invalidate all reg info of INSN with DATA and execution frequency
FREQ. Update common info about the invalidated registers. */
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 uid;
@@ -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
invalidated registers. */
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,
get_insn_freq (insn));
@@ -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
of INSN. */
void
-lra_update_insn_regno_info (rtx insn)
+lra_update_insn_regno_info (rtx_insn *insn)
{
int i, uid, freq;
lra_insn_recog_data_t data;
@@ -1630,13 +1632,13 @@ lra_get_insn_regs (int uid)
static sbitmap lra_constraint_insn_stack_bitmap;
/* 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
info for INSN, otherwise only update it if INSN is not already on the
stack. */
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);
if (always_update)
@@ -1654,14 +1656,14 @@ lra_push_insn_1 (rtx insn, bool always_update)
/* Put INSN on the stack. */
void
-lra_push_insn (rtx insn)
+lra_push_insn (rtx_insn *insn)
{
lra_push_insn_1 (insn, false);
}
/* Put INSN on the stack and update its reg info. */
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);
}
@@ -1674,10 +1676,10 @@ lra_push_insn_by_uid (unsigned int uid)
}
/* Take the last-inserted insns off the stack and return it. */
-rtx
+rtx_insn *
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));
return insn;
}
@@ -1691,9 +1693,9 @@ lra_insn_stack_length (void)
/* Push insns FROM to TO (excluding it) going in reverse order. */
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)
return;
@@ -1706,13 +1708,13 @@ push_insns (rtx from, rtx to)
taken from the next BB insn after LAST or zero if there in such
insn. */
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)
? 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;
}
@@ -1720,9 +1722,10 @@ setup_sp_offset (rtx from, rtx last)
insns onto the stack. Print about emitting the insns with
TITLE. */
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)
return;
@@ -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. */
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. */
};
@@ -1796,7 +1799,7 @@ lra_former_scratch_p (int regno)
/* Return true if the operand NOP of INSN is a former scratch. */
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,
INSN_UID (insn) * MAX_RECOG_OPERANDS + nop) != 0;
@@ -1809,7 +1812,8 @@ remove_scratches (void)
int i;
bool insn_changed_p;
basic_block bb;
- rtx insn, reg;
+ rtx_insn *insn;
+ rtx reg;
sloc_t loc;
lra_insn_recog_data_t id;
struct lra_static_insn_data *static_id;
@@ -1860,7 +1864,7 @@ restore_scratches (void)
int regno;
unsigned i;
sloc_t loc;
- rtx last = NULL_RTX;
+ rtx_insn *last = NULL;
lra_insn_recog_data_t id = NULL;
for (i = 0; scratches.iterate (i, &loc); i++)
@@ -1903,7 +1907,7 @@ static void
check_rtl (bool final_p)
{
basic_block bb;
- rtx insn;
+ rtx_insn *insn;
lra_assert (! final_p || reload_completed);
FOR_EACH_BB_FN (bb, cfun)
@@ -1985,7 +1989,7 @@ has_nonexceptional_receiver (void)
/* Process recursively X of INSN and add REG_INC notes if necessary. */
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);
const char *fmt;
@@ -2020,7 +2024,7 @@ update_inc_notes (void)
{
rtx *pnote;
basic_block bb;
- rtx insn;
+ rtx_insn *insn;
FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
@@ -2165,7 +2169,7 @@ lra (FILE *f)
lra_live_ranges_init ();
lra_constraints_init ();
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. */
lra_constraint_new_insn_uid_start = get_max_uid ();
bitmap_initialize (&lra_inheritance_pseudos, &reg_obstack);