From: Lehua Ding <lehua.ding@rivai.ai>
To: gcc-patches@gcc.gnu.org
Cc: vmakarov@redhat.com, richard.sandiford@arm.com,
juzhe.zhong@rivai.ai, lehua.ding@rivai.ai
Subject: [PATCH V3 2/7] ira: Switch to live_subreg data
Date: Sun, 12 Nov 2023 20:08:12 +0800 [thread overview]
Message-ID: <20231112120817.2635864-3-lehua.ding@rivai.ai> (raw)
In-Reply-To: <20231112120817.2635864-1-lehua.ding@rivai.ai>
This patch switch the use of live_reg data to live_subreg data.
gcc/ChangeLog:
* ira-build.cc (create_bb_allocnos): Switch.
(create_loop_allocnos): Ditto.
* ira-color.cc (ira_loop_edge_freq): Ditto.
* ira-emit.cc (generate_edge_moves): Ditto.
(add_ranges_and_copies): Ditto.
* ira-lives.cc (process_out_of_region_eh_regs): Ditto.
(add_conflict_from_region_landing_pads): Ditto.
(process_bb_node_lives): Ditto.
* ira.cc (find_moveable_pseudos): Ditto.
(interesting_dest_for_shprep_1): Ditto.
(allocate_initial_values): Ditto.
(ira): Ditto.
---
gcc/ira-build.cc | 7 ++++---
gcc/ira-color.cc | 8 ++++----
gcc/ira-emit.cc | 12 ++++++------
gcc/ira-lives.cc | 7 ++++---
gcc/ira.cc | 16 +++++++++-------
5 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/gcc/ira-build.cc b/gcc/ira-build.cc
index 93e46033170..f931c6e304c 100644
--- a/gcc/ira-build.cc
+++ b/gcc/ira-build.cc
@@ -1919,7 +1919,8 @@ create_bb_allocnos (ira_loop_tree_node_t bb_node)
create_insn_allocnos (PATTERN (insn), NULL, false);
/* It might be a allocno living through from one subloop to
another. */
- EXECUTE_IF_SET_IN_REG_SET (df_get_live_in (bb), FIRST_PSEUDO_REGISTER, i, bi)
+ EXECUTE_IF_SET_IN_REG_SET (DF_LIVE_SUBREG_IN (bb), FIRST_PSEUDO_REGISTER,
+ i, bi)
if (ira_curr_regno_allocno_map[i] == NULL)
ira_create_allocno (i, false, ira_curr_loop_tree_node);
}
@@ -1935,9 +1936,9 @@ create_loop_allocnos (edge e)
bitmap_iterator bi;
ira_loop_tree_node_t parent;
- live_in_regs = df_get_live_in (e->dest);
+ live_in_regs = DF_LIVE_SUBREG_IN (e->dest);
border_allocnos = ira_curr_loop_tree_node->border_allocnos;
- EXECUTE_IF_SET_IN_REG_SET (df_get_live_out (e->src),
+ EXECUTE_IF_SET_IN_REG_SET (DF_LIVE_SUBREG_OUT (e->src),
FIRST_PSEUDO_REGISTER, i, bi)
if (bitmap_bit_p (live_in_regs, i))
{
diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc
index f2e8ea34152..4aa3e316282 100644
--- a/gcc/ira-color.cc
+++ b/gcc/ira-color.cc
@@ -2783,8 +2783,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds)
if (e->src != loop_node->loop->latch
&& (regno < 0
- || (bitmap_bit_p (df_get_live_out (e->src), regno)
- && bitmap_bit_p (df_get_live_in (e->dest), regno))))
+ || (bitmap_bit_p (DF_LIVE_SUBREG_OUT (e->src), regno)
+ && bitmap_bit_p (DF_LIVE_SUBREG_IN (e->dest), regno))))
freq += EDGE_FREQUENCY (e);
}
else
@@ -2792,8 +2792,8 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
auto_vec<edge> edges = get_loop_exit_edges (loop_node->loop);
FOR_EACH_VEC_ELT (edges, i, e)
if (regno < 0
- || (bitmap_bit_p (df_get_live_out (e->src), regno)
- && bitmap_bit_p (df_get_live_in (e->dest), regno)))
+ || (bitmap_bit_p (DF_LIVE_SUBREG_OUT (e->src), regno)
+ && bitmap_bit_p (DF_LIVE_SUBREG_IN (e->dest), regno)))
freq += EDGE_FREQUENCY (e);
}
diff --git a/gcc/ira-emit.cc b/gcc/ira-emit.cc
index bcc4f09f7c4..84ed482e568 100644
--- a/gcc/ira-emit.cc
+++ b/gcc/ira-emit.cc
@@ -510,8 +510,8 @@ generate_edge_moves (edge e)
return;
src_map = src_loop_node->regno_allocno_map;
dest_map = dest_loop_node->regno_allocno_map;
- regs_live_in_dest = df_get_live_in (e->dest);
- regs_live_out_src = df_get_live_out (e->src);
+ regs_live_in_dest = DF_LIVE_SUBREG_IN (e->dest);
+ regs_live_out_src = DF_LIVE_SUBREG_OUT (e->src);
EXECUTE_IF_SET_IN_REG_SET (regs_live_in_dest,
FIRST_PSEUDO_REGISTER, regno, bi)
if (bitmap_bit_p (regs_live_out_src, regno))
@@ -1229,16 +1229,16 @@ add_ranges_and_copies (void)
destination block) to use for searching allocnos by their
regnos because of subsequent IR flattening. */
node = IRA_BB_NODE (bb)->parent;
- bitmap_copy (live_through, df_get_live_in (bb));
+ bitmap_copy (live_through, DF_LIVE_SUBREG_IN (bb));
add_range_and_copies_from_move_list
(at_bb_start[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
- bitmap_copy (live_through, df_get_live_out (bb));
+ bitmap_copy (live_through, DF_LIVE_SUBREG_OUT (bb));
add_range_and_copies_from_move_list
(at_bb_end[bb->index], node, live_through, REG_FREQ_FROM_BB (bb));
FOR_EACH_EDGE (e, ei, bb->succs)
{
- bitmap_and (live_through,
- df_get_live_in (e->dest), df_get_live_out (bb));
+ bitmap_and (live_through, DF_LIVE_SUBREG_IN (e->dest),
+ DF_LIVE_SUBREG_OUT (bb));
add_range_and_copies_from_move_list
((move_t) e->aux, node, live_through,
REG_FREQ_FROM_EDGE_FREQ (EDGE_FREQUENCY (e)));
diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc
index 81af5c06460..05e2be12a26 100644
--- a/gcc/ira-lives.cc
+++ b/gcc/ira-lives.cc
@@ -1194,7 +1194,8 @@ process_out_of_region_eh_regs (basic_block bb)
if (! eh_p)
return;
- EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi)
+ EXECUTE_IF_SET_IN_BITMAP (DF_LIVE_SUBREG_OUT (bb), FIRST_PSEUDO_REGISTER, i,
+ bi)
{
ira_allocno_t a = ira_curr_regno_allocno_map[i];
for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--)
@@ -1228,7 +1229,7 @@ add_conflict_from_region_landing_pads (eh_region region, ira_object_t obj,
if ((landing_label = lp->landing_pad) != NULL
&& (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL
&& (region->type != ERT_CLEANUP
- || bitmap_bit_p (df_get_live_in (landing_bb),
+ || bitmap_bit_p (DF_LIVE_SUBREG_IN (landing_bb),
ALLOCNO_REGNO (a))))
{
HARD_REG_SET new_conflict_regs
@@ -1265,7 +1266,7 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
high_pressure_start_point[ira_pressure_classes[i]] = -1;
}
curr_bb_node = loop_tree_node;
- reg_live_out = df_get_live_out (bb);
+ reg_live_out = DF_LIVE_SUBREG_OUT (bb);
sparseset_clear (objects_live);
REG_SET_TO_HARD_REG_SET (hard_regs_live, reg_live_out);
hard_regs_live &= ~(eliminable_regset | ira_no_alloc_regs);
diff --git a/gcc/ira.cc b/gcc/ira.cc
index d7530f01380..c7f27b17002 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -4735,8 +4735,8 @@ find_moveable_pseudos (void)
bitmap_initialize (local, 0);
bitmap_initialize (transp, 0);
bitmap_initialize (moveable, 0);
- bitmap_copy (live, df_get_live_out (bb));
- bitmap_and_into (live, df_get_live_in (bb));
+ bitmap_copy (live, DF_LIVE_SUBREG_OUT (bb));
+ bitmap_and_into (live, DF_LIVE_SUBREG_IN (bb));
bitmap_copy (transp, live);
bitmap_clear (moveable);
bitmap_clear (live);
@@ -5036,7 +5036,8 @@ interesting_dest_for_shprep_1 (rtx set, basic_block call_dom)
rtx dest = SET_DEST (set);
if (!REG_P (src) || !HARD_REGISTER_P (src)
|| !REG_P (dest) || HARD_REGISTER_P (dest)
- || (call_dom && !bitmap_bit_p (df_get_live_in (call_dom), REGNO (dest))))
+ || (call_dom
+ && !bitmap_bit_p (DF_LIVE_SUBREG_IN (call_dom), REGNO (dest))))
return NULL;
return dest;
}
@@ -5514,10 +5515,10 @@ allocate_initial_values (void)
/* Update global register liveness information. */
FOR_EACH_BB_FN (bb, cfun)
{
- if (REGNO_REG_SET_P (df_get_live_in (bb), regno))
- SET_REGNO_REG_SET (df_get_live_in (bb), new_regno);
- if (REGNO_REG_SET_P (df_get_live_out (bb), regno))
- SET_REGNO_REG_SET (df_get_live_out (bb), new_regno);
+ if (REGNO_REG_SET_P (DF_LIVE_SUBREG_IN (bb), regno))
+ SET_REGNO_REG_SET (DF_LIVE_SUBREG_IN (bb), new_regno);
+ if (REGNO_REG_SET_P (DF_LIVE_SUBREG_OUT (bb), regno))
+ SET_REGNO_REG_SET (DF_LIVE_SUBREG_OUT (bb), new_regno);
}
}
}
@@ -5679,6 +5680,7 @@ ira (FILE *f)
if (optimize > 1)
df_remove_problem (df_live);
gcc_checking_assert (df_live == NULL);
+ df_live_subreg_add_problem ();
if (flag_checking)
df->changeable_flags |= DF_VERIFY_SCHEDULED;
--
2.36.3
next prev parent reply other threads:[~2023-11-12 12:08 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 12:08 [PATCH V3 0/7] ira/lra: Support subreg coalesce Lehua Ding
2023-11-12 12:08 ` [PATCH V3 1/7] df: Add DF_LIVE_SUBREG problem Lehua Ding
2023-11-13 22:38 ` Vladimir Makarov
2023-11-14 8:14 ` Richard Biener
2023-11-14 8:38 ` Lehua Ding
2023-11-14 9:03 ` Richard Biener
2023-11-14 14:52 ` Vladimir Makarov
2023-11-14 17:18 ` Vladimir Makarov
2023-11-14 18:29 ` Vladimir Makarov
2023-11-20 20:11 ` Richard Sandiford
2023-11-21 6:35 ` Lehua Ding
2023-11-12 12:08 ` Lehua Ding [this message]
2023-11-14 20:26 ` [PATCH V3 2/7] ira: Switch to live_subreg data Vladimir Makarov
2023-11-12 12:08 ` [PATCH V3 3/7] ira: Support subreg live range track Lehua Ding
2023-11-14 20:37 ` Vladimir Makarov
2023-11-12 12:08 ` [PATCH V3 4/7] ira: Support subreg copy Lehua Ding
2023-11-16 21:13 ` Vladimir Makarov
2023-11-17 2:06 ` Lehua Ding
2023-11-17 14:05 ` Vladimir Makarov
2023-11-18 8:00 ` Lehua Ding
2023-11-18 8:06 ` Sam James
2023-11-18 8:16 ` Lehua Ding
2023-11-18 8:24 ` Sam James
2023-11-18 8:27 ` Lehua Ding
2023-11-12 12:08 ` [PATCH V3 5/7] ira: Add all nregs >= 2 pseudos to tracke subreg list Lehua Ding
2023-11-16 21:14 ` Vladimir Makarov
2023-11-12 12:08 ` [PATCH V3 6/7] lra: Switch to live_subreg data flow Lehua Ding
2023-11-12 12:08 ` [PATCH V3 7/7] lra: Support subreg live range track and conflict detect Lehua Ding
2023-11-13 16:43 ` [PATCH V3 0/7] ira/lra: Support subreg coalesce Dimitar Dimitrov
2023-11-15 2:10 ` Lehua Ding
2023-11-13 19:37 ` Vladimir Makarov
2023-11-14 5:37 ` Lehua Ding
2023-11-14 23:33 ` Peter Bergner
2023-11-14 23:22 ` Peter Bergner
2023-11-15 3:12 ` Lehua Ding
2023-11-15 3:33 ` Peter Bergner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231112120817.2635864-3-lehua.ding@rivai.ai \
--to=lehua.ding@rivai.ai \
--cc=gcc-patches@gcc.gnu.org \
--cc=juzhe.zhong@rivai.ai \
--cc=richard.sandiford@arm.com \
--cc=vmakarov@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).