aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-05-15 14:14:15 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-05-15 14:14:15 +0000
commitaf205f678d2d6ac9043daa70c4caefdd76cd65bc (patch)
treefa7f8529c4634be7caa170a0bcfcd4fd08a639c8 /gcc/cfgrtl.c
parent9adcfa3c1f4f3194b50c893f06bb52f1058aebe8 (diff)
downloadgcc-af205f678d2d6ac9043daa70c4caefdd76cd65bc.zip
gcc-af205f678d2d6ac9043daa70c4caefdd76cd65bc.tar.gz
gcc-af205f678d2d6ac9043daa70c4caefdd76cd65bc.tar.bz2
function.h (has_bb_partition): New rtl_data flag.
2013-05-15 Teresa Johnson <tejohnson@google.com> * function.h (has_bb_partition): New rtl_data flag. (bb_reorder_complete): Ditto. * cfgcleanup.c (try_crossjump_to_edge): Check for has_bb_partition instead of flag_reorder_blocks_and_partition. * cfgrtl.c (verify_hot_cold_block_grouping): Moved from bb-reorder.c, with some enhancements. (rtl_verify_flow_info_1): Call verify_hot_cold_block_grouping. * bb-reorder.c (connect_traces): Check for has_bb_partition instead of flag_reorder_blocks_and_partition. (verify_hot_cold_block_grouping): Moved to cfgrtl.c. (reorder_basic_blocks): Set bb_reorder_complete flag, remove call to verify_hot_cold_block_grouping. (partition_hot_cold_basic_blocks): Set has_bb_partition. From-SVN: r198934
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 9b12d28..335e4d9 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2058,6 +2058,44 @@ get_last_bb_insn (basic_block bb)
return end;
}
+
+/* Verify, in the basic block chain, that there is at most one switch
+ between hot/cold partitions. This condition will not be true until
+ after reorder_basic_blocks is called. */
+
+static void
+verify_hot_cold_block_grouping (void)
+{
+ basic_block bb;
+ int err = 0;
+ bool switched_sections = false;
+ int current_partition = BB_UNPARTITIONED;
+
+ if (!crtl->bb_reorder_complete)
+ return;
+
+ FOR_EACH_BB (bb)
+ {
+ if (current_partition != BB_UNPARTITIONED
+ && BB_PARTITION (bb) != current_partition)
+ {
+ if (switched_sections)
+ {
+ error ("multiple hot/cold transitions found (bb %i)",
+ bb->index);
+ err = 1;
+ }
+ else
+ switched_sections = true;
+
+ if (!crtl->has_bb_partition)
+ error ("partition found but function partition flag not set");
+ }
+ current_partition = BB_PARTITION (bb);
+ }
+
+ gcc_assert(!err);
+}
/* Verify the CFG and RTL consistency common for both underlying RTL and
cfglayout RTL.
@@ -2072,6 +2110,7 @@ get_last_bb_insn (basic_block bb)
and NOTE_INSN_BASIC_BLOCK
- verify that no fall_thru edge crosses hot/cold partition boundaries
- verify that there are no pending RTL branch predictions
+ - verify that there is a single hot/cold partition boundary after bbro
In future it can be extended check a lot of other stuff as well
(reachability of basic blocks, life information, etc. etc.). */
@@ -2323,6 +2362,8 @@ rtl_verify_flow_info_1 (void)
}
}
+ verify_hot_cold_block_grouping();
+
/* Clean up. */
return err;
}