summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-26 11:13:14 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-26 11:13:14 +0000
commit7a569539703acb109ac1905068a974f3dff82e82 (patch)
tree027570a5994a1bcef5487d0da3c38370ec98d67f /gcc/lto-streamer-in.c
parentf6568ea476aa52a6e23c6db43b3e240cde55783a (diff)
downloadgcc-7a569539703acb109ac1905068a974f3dff82e82.tar.gz
2013-04-26 Richard Biener <rguenther@suse.de>
* Makefile.in (lto-streamer-in.o): Add $(CFGLOOP_H) dependency. (lto-streamer-out.o): Likewise. * cfgloop.c (init_loops_structure): Export, add struct function argument and adjust. (flow_loops_find): Adjust. * cfgloop.h (enum loop_estimation): Add EST_LAST. (init_loops_structure): Declare. * lto-streamer-in.c: Include cfgloop.h. (input_cfg): Input the loop tree. * lto-streamer-out.c: Include cfgloop.h. (output_cfg): Output the loop tree. (output_struct_function_base): Do not drop PROP_loops. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index c4daa30c581..f5789c01277 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -48,6 +48,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-streamer.h"
#include "tree-pass.h"
#include "streamer-hooks.h"
+#include "cfgloop.h"
+
struct freeing_string_slot_hasher : string_slot_hasher
{
@@ -660,6 +662,58 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
p_bb = bb;
index = streamer_read_hwi (ib);
}
+
+ /* ??? The cfgloop interface is tied to cfun. */
+ gcc_assert (cfun == fn);
+
+ /* Input the loop tree. */
+ unsigned n_loops = streamer_read_uhwi (ib);
+ if (n_loops == 0)
+ return;
+
+ struct loops *loops = ggc_alloc_cleared_loops ();
+ init_loops_structure (fn, loops, n_loops);
+
+ /* Input each loop and associate it with its loop header so
+ flow_loops_find can rebuild the loop tree. */
+ for (unsigned i = 1; i < n_loops; ++i)
+ {
+ int header_index = streamer_read_hwi (ib);
+ if (header_index == -1)
+ {
+ loops->larray->quick_push (NULL);
+ continue;
+ }
+
+ struct loop *loop = alloc_loop ();
+ loop->num = loops->larray->length ();
+ loop->header = BASIC_BLOCK_FOR_FUNCTION (fn, header_index);
+ loop->header->loop_father = loop;
+
+ /* Read everything copy_loop_info copies. */
+ loop->estimate_state = streamer_read_enum (ib, loop_estimation, EST_LAST);
+ loop->any_upper_bound = streamer_read_hwi (ib);
+ if (loop->any_upper_bound)
+ {
+ loop->nb_iterations_upper_bound.low = streamer_read_uhwi (ib);
+ loop->nb_iterations_upper_bound.high = streamer_read_hwi (ib);
+ }
+ loop->any_estimate = streamer_read_hwi (ib);
+ if (loop->any_estimate)
+ {
+ loop->nb_iterations_estimate.low = streamer_read_uhwi (ib);
+ loop->nb_iterations_estimate.high = streamer_read_hwi (ib);
+ }
+
+ loops->larray->quick_push (loop);
+
+ /* flow_loops_find doesn't like loops not in the tree, hook them
+ all as siblings of the tree root temporarily. */
+ flow_loop_tree_node_add (loops->tree_root, loop);
+ }
+
+ /* Rebuild the loop tree. */
+ fn->x_current_loops = flow_loops_find (loops);
}