aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2014-11-09 16:45:15 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2014-11-09 16:45:15 +0000
commit8160cd3ee4a5840db17416092f2d808187b7e872 (patch)
tree1cde2f4fc77823a9e058d48a80d31252d0b0cc29 /gcc/lra.c
parent205e92689198d4718a07adfb0077821cfa93e761 (diff)
downloadgcc-8160cd3ee4a5840db17416092f2d808187b7e872.zip
gcc-8160cd3ee4a5840db17416092f2d808187b7e872.tar.gz
gcc-8160cd3ee4a5840db17416092f2d808187b7e872.tar.bz2
re PR rtl-optimization/63620 (RELOAD lost SET_GOT dependency on Darwin)
2014-11-09 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/63620 * lra-constraints.c (substitute_pseudo): Add prefix lra_ to the name. Move to lra.c. Make it external. (substitute_pseudo_within_insn): Ditto. (inherit_reload_reg, split_reg, remove_inheritance_pseudos): Use the new names. (undo_optional_reloads): Ditto. * lra-int.h (lra_dump_bitmap_with_title, lra_substitute_pseudo): New prototypes. (lra_substitute_pseudo_within_insn): Ditto. * lra-lives.c (bb_killed_pseudos, bb_gen_pseudos): New. (mark_regno_live): Add parameter. Update bb_gen_pseudos. (mark_regno_dead): Add parameter. Update bb_gen_pseudos and bb_killed_pseudos. (struct bb_data, bb_data_t, bb_data): New. (get_bb_data, get_bb_data_by_index): Ditto. (all_hard_regs_bitmap): New. (live_trans_fun, live_con_fun_0, live_con_fun_n, all_blocks): New. (initiate_live_solver, finish_live_solver): New. (process_bb_lives): Change return type. Add code updating local live data and removing dead insns. Pass new argument to mark_regno_live and mark_regno_dead. Check changing bb pseudo life info. Return the result. (lra_create_live_ranges): Add code to do global pseudo live analysis. (lra_live_ranges_init): Call initiate_live_solver. (lra_live_ranges_finish): Call finish_live_solver. * lra.c (lra_dump_bitmap_with_title): New. (lra_substitute_pseudo, lra_substitute_pseudo_within_insn): Move from lra-constraints.c. From-SVN: r217265
Diffstat (limited to 'gcc/lra.c')
-rw-r--r--gcc/lra.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/gcc/lra.c b/gcc/lra.c
index ee390db..3ae47e8 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -129,6 +129,33 @@ along with GCC; see the file COPYING3. If not see
#include "lra-int.h"
#include "df.h"
+/* Dump bitmap SET with TITLE and BB INDEX. */
+void
+lra_dump_bitmap_with_title (const char *title, bitmap set, int index)
+{
+ unsigned int i;
+ int count;
+ bitmap_iterator bi;
+ static const int max_nums_on_line = 10;
+
+ if (bitmap_empty_p (set))
+ return;
+ fprintf (lra_dump_file, " %s %d:", title, index);
+ fprintf (lra_dump_file, "\n");
+ count = max_nums_on_line + 1;
+ EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
+ {
+ if (count > max_nums_on_line)
+ {
+ fprintf (lra_dump_file, "\n ");
+ count = 0;
+ }
+ fprintf (lra_dump_file, " %4u", i);
+ count++;
+ }
+ fprintf (lra_dump_file, "\n");
+}
+
/* Hard registers currently not available for allocation. It can
changed after some hard registers become not eliminable. */
HARD_REG_SET lra_no_alloc_regs;
@@ -1753,6 +1780,68 @@ lra_process_new_insns (rtx_insn *insn, rtx_insn *before, rtx_insn *after,
+/* Replace all references to register OLD_REGNO in *LOC with pseudo
+ register NEW_REG. Return true if any change was made. */
+bool
+lra_substitute_pseudo (rtx *loc, int old_regno, rtx new_reg)
+{
+ rtx x = *loc;
+ bool result = false;
+ enum rtx_code code;
+ const char *fmt;
+ int i, j;
+
+ if (x == NULL_RTX)
+ return false;
+
+ code = GET_CODE (x);
+ if (code == REG && (int) REGNO (x) == old_regno)
+ {
+ machine_mode mode = GET_MODE (*loc);
+ machine_mode inner_mode = GET_MODE (new_reg);
+
+ if (mode != inner_mode)
+ {
+ if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (inner_mode)
+ || ! SCALAR_INT_MODE_P (inner_mode))
+ new_reg = gen_rtx_SUBREG (mode, new_reg, 0);
+ else
+ new_reg = gen_lowpart_SUBREG (mode, new_reg);
+ }
+ *loc = new_reg;
+ return true;
+ }
+
+ /* Scan all the operand sub-expressions. */
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'e')
+ {
+ if (lra_substitute_pseudo (&XEXP (x, i), old_regno, new_reg))
+ result = true;
+ }
+ else if (fmt[i] == 'E')
+ {
+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ if (lra_substitute_pseudo (&XVECEXP (x, i, j), old_regno, new_reg))
+ result = true;
+ }
+ }
+ return result;
+}
+
+/* Call lra_substitute_pseudo within an insn. This won't update the insn ptr,
+ just the contents of the insn. */
+bool
+lra_substitute_pseudo_within_insn (rtx_insn *insn, int old_regno, rtx new_reg)
+{
+ rtx loc = insn;
+ return lra_substitute_pseudo (&loc, old_regno, new_reg);
+}
+
+
+
/* This page contains code dealing with scratches (changing them onto
pseudos and restoring them from the pseudos).