aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-live.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2005-07-31 00:14:17 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2005-07-30 22:14:17 +0000
commit0bde02b33905ecfb252b96cbe2ea257f0c0606da (patch)
tree90c26e80fc63e94c4779d3d07c7d2bf90e51f41c /gcc/tree-ssa-live.c
parentee25d4cbe310fb88f30e64ed49be405e98cf2300 (diff)
downloadgcc-0bde02b33905ecfb252b96cbe2ea257f0c0606da.zip
gcc-0bde02b33905ecfb252b96cbe2ea257f0c0606da.tar.gz
gcc-0bde02b33905ecfb252b96cbe2ea257f0c0606da.tar.bz2
tree-outof-ssa.c (coalesce_ssa_name): Use coalesce_cost.
* tree-outof-ssa.c (coalesce_ssa_name): Use coalesce_cost. (coalesce_vars): Likewise. * tree-ssa-live.c (coalesce_cost): New. (build_tree_conflict_graph): Use coalesce_cost. * tree-ssa-live.h (coalesce_cost): Declare. From-SVN: r102593
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r--gcc/tree-ssa-live.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 1647292..132af92 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1145,11 +1145,30 @@ find_partition_pair (coalesce_list_p cl, int p1, int p2, bool create)
return node;
}
+/* Return cost of execution of copy instruction with FREQUENCY
+ possibly on CRITICAL edge and in HOT basic block. */
+int
+coalesce_cost (int frequency, bool hot, bool critical)
+{
+ /* Base costs on BB frequencies bounded by 1. */
+ int cost = frequency;
+
+ if (!cost)
+ cost = 1;
+ if (optimize_size || hot)
+ cost = 1;
+ /* Inserting copy on critical edge costs more
+ than inserting it elsewhere. */
+ if (critical)
+ cost *= 2;
+ return cost;
+}
/* Add a potential coalesce between P1 and P2 in CL with a cost of VALUE. */
void
-add_coalesce (coalesce_list_p cl, int p1, int p2, int value)
+add_coalesce (coalesce_list_p cl, int p1, int p2,
+ int value)
{
partition_pair_p node;
@@ -1383,7 +1402,9 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa,
if (bit)
bitmap_set_bit (live, p2);
if (cl)
- add_coalesce (cl, p1, p2, 1);
+ add_coalesce (cl, p1, p2,
+ coalesce_cost (bb->frequency,
+ maybe_hot_bb_p (bb), false));
set_if_valid (map, live, rhs);
}
}