diff options
author | Richard Biener <rguenther@suse.de> | 2013-04-26 11:13:14 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-04-26 11:13:14 +0000 |
commit | dd366ec309a4afc80ce5b6442321eb847b1b851f (patch) | |
tree | 027570a5994a1bcef5487d0da3c38370ec98d67f /gcc/lto-streamer-in.c | |
parent | a9e0d843713b294d12c3a3faedbc0c817e581014 (diff) | |
download | gcc-dd366ec309a4afc80ce5b6442321eb847b1b851f.zip gcc-dd366ec309a4afc80ce5b6442321eb847b1b851f.tar.gz gcc-dd366ec309a4afc80ce5b6442321eb847b1b851f.tar.bz2 |
Makefile.in (lto-streamer-in.o): Add $(CFGLOOP_H) dependency.
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.
From-SVN: r198334
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index c4daa30..f5789c0 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); } |