]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/lto-streamer-in.c
Merge from trunk.
[thirdparty/gcc.git] / gcc / lto-streamer-in.c
index 72d450ca9d9bcd01c72611117fc0de2ff72c1aff..c5b73ffb8d90a3c86b10bf4054155d0c0f2ed056 100644 (file)
@@ -26,15 +26,22 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "toplev.h"
 #include "tree.h"
+#include "stringpool.h"
 #include "expr.h"
 #include "flags.h"
 #include "params.h"
 #include "input.h"
 #include "hashtab.h"
 #include "basic-block.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
+#include "gimple-ssa.h"
+#include "tree-cfg.h"
+#include "tree-ssanames.h"
+#include "tree-into-ssa.h"
+#include "tree-dfa.h"
 #include "tree-ssa.h"
 #include "tree-pass.h"
-#include "cgraph.h"
 #include "function.h"
 #include "ggc.h"
 #include "diagnostic.h"
@@ -581,7 +588,7 @@ make_new_block (struct function *fn, unsigned int index)
   basic_block bb = alloc_block ();
   bb->index = index;
   SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb);
-  n_basic_blocks_for_function (fn)++;
+  n_basic_blocks_for_fn (fn)++;
   return bb;
 }
 
@@ -652,7 +659,7 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
       index = streamer_read_hwi (ib);
     }
 
-  p_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (fn);
+  p_bb = ENTRY_BLOCK_PTR_FOR_FN (fn);
   index = streamer_read_hwi (ib);
   while (index != -1)
     {
@@ -695,14 +702,26 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
       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);
+         HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
+         int i;
+         int prec ATTRIBUTE_UNUSED = streamer_read_uhwi (ib);
+         int len = streamer_read_uhwi (ib);
+         for (i = 0; i < len; i++)
+           a[i] = streamer_read_hwi (ib);
+         
+         loop->nb_iterations_upper_bound = widest_int::from_array (a, len);
        }
       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);
+         HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
+         int i;
+         int prec ATTRIBUTE_UNUSED = streamer_read_uhwi (ib);
+         int len = streamer_read_uhwi (ib);
+         for (i = 0; i < len; i++)
+           a[i] = streamer_read_hwi (ib);
+         
+         loop->nb_iterations_estimate = widest_int::from_array (a, len);
        }
 
       place_new_loop (fn, loop);
@@ -779,7 +798,7 @@ fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple *stmts,
         fatal_error ("Cgraph edge statement index not found");
     }
   for (i = 0;
-       ipa_ref_list_reference_iterate (&node->symbol.ref_list, i, ref);
+       ipa_ref_list_reference_iterate (&node->ref_list, i, ref);
        i++)
     if (ref->lto_stmt_uid)
       {
@@ -802,7 +821,7 @@ fixup_call_stmt_edges (struct cgraph_node *orig, gimple *stmts)
 
   while (orig->clone_of)
     orig = orig->clone_of;
-  fn = DECL_STRUCT_FUNCTION (orig->symbol.decl);
+  fn = DECL_STRUCT_FUNCTION (orig->decl);
 
   fixup_call_stmt_edges_1 (orig, stmts, fn);
   if (orig->clones)
@@ -910,7 +929,9 @@ input_function (tree fn_decl, struct data_in *data_in,
 
   gimple_register_cfg_hooks ();
 
-  node = cgraph_get_create_node (fn_decl);
+  node = cgraph_get_node (fn_decl);
+  if (!node)
+    node = cgraph_create_node (fn_decl);
   input_struct_function_base (fn, data_in, ib);
   input_cfg (ib_cfg, fn, node->count_materialization_scale);
 
@@ -987,7 +1008,7 @@ input_function (tree fn_decl, struct data_in *data_in,
      of a gimple body is used by the cgraph routines, but we should
      really use the presence of the CFG.  */
   {
-    edge_iterator ei = ei_start (ENTRY_BLOCK_PTR->succs);
+    edge_iterator ei = ei_start (ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs);
     gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
   }
 
@@ -1019,7 +1040,7 @@ lto_read_body (struct lto_file_decl_data *file_data, struct cgraph_node *node,
   int string_offset;
   struct lto_input_block ib_cfg;
   struct lto_input_block ib_main;
-  tree fn_decl = node->symbol.decl;
+  tree fn_decl = node->decl;
 
   header = (const struct lto_function_header *) data;
   cfg_offset = sizeof (struct lto_function_header);
@@ -1250,12 +1271,17 @@ lto_input_tree_1 (struct lto_input_block *ib, struct data_in *data_in,
     }
   else if (tag == LTO_integer_cst)
     {
-      /* For shared integer constants in singletons we can use the existing
-         tree integer constant merging code.  */
+      /* For shared integer constants in singletons we can use the
+         existing tree integer constant merging code.  */
       tree type = stream_read_tree (ib, data_in);
-      unsigned HOST_WIDE_INT low = streamer_read_uhwi (ib);
-      HOST_WIDE_INT high = streamer_read_hwi (ib);
-      result = build_int_cst_wide (type, low, high);
+      unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
+      unsigned HOST_WIDE_INT i;
+      HOST_WIDE_INT a[WIDE_INT_MAX_ELTS]; 
+
+      for (i = 0; i < len; i++)
+       a[i] = streamer_read_hwi (ib);
+      result = wide_int_to_tree (type, wide_int::from_array
+                                (a, len, TYPE_PRECISION (type)));
       streamer_tree_cache_append (data_in->reader_cache, result, hash);
     }
   else if (tag == LTO_tree_scc)