]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-cp.c (ipcp_init_cloned_node): Call ipa_check_create_node_params instead of ipa_cr...
authorMartin Jambor <mjambor@suse.cz>
Tue, 8 Jul 2008 13:25:24 +0000 (15:25 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 8 Jul 2008 13:25:24 +0000 (15:25 +0200)
2008-07-08  Martin Jambor  <mjambor@suse.cz>

* ipa-cp.c (ipcp_init_cloned_node): Call ipa_check_create_node_params
instead of ipa_create_node_params.
(ipcp_driver): Allocate infos with ipa_check_create_node_params and
ipa_check_create_edge_args, free them with
free_all_ipa_structures_after_ipa_cp, call ipa_register_cgraph_hooks.

* ipa-prop.c: Include flags.h and tree-inline.h.
(ipa_node_params_vector): New variable.
(ipa_edge_args_vector): New variable.
(edge_removal_hook_holder): New variable.
(node_removal_hook_holder): New variable.
(edge_duplication_hook_holder): New variable.
(node_duplication_hook_holder): New variable.
(ipa_detect_param_modifications): Check for presence of modified flags.
(ipa_compute_jump_functions): Check for presence of jump functions.
(ipa_free_edge_args_substructures): New function.
(ipa_create_node_params): Removed.
(ipa_free_all_edge_args): Changed to deallocate the on-the-side vector.
(ipa_free_node_params_substructures): New function.
(ipa_free_all_node_params): Changed to deallocate the on-the-side
vector.
(ipa_edge_removal_hook): New function.
(ipa_node_removal_hook): New function.
(duplicate_array): New function.
(ipa_edge_duplication_hook): New function.
(ipa_node_duplication_hook): New function.
(ipa_register_cgraph_hooks): New function.
(ipa_unregister_cgraph_hooks): New function.
(free_all_ipa_structures_after_ipa_cp): New function.

* ipa-prop.h: Include vec.h.
(ipa_node_params_t): New typedef with vector types for it.
(ipa_edge_args_t):  New typedef with vector types for it.
(IPA_NODE_REF): Changed to access an on-the-side vector.
(IPA_EDGE_REF): Changed to access an on-the-side vector.
(ipa_check_create_node_params): New function.
(ipa_check_create_edge_args): New function.

* Makefile.in (IPA_PROP_H): New variable for ipa-prop.h.  Converted
all users.

From-SVN: r137620

gcc/ChangeLog
gcc/Makefile.in
gcc/ipa-cp.c
gcc/ipa-prop.c
gcc/ipa-prop.h

index 30b98a5576f8a98bbe60e7a7ccc1710c97c555e2..4a126ecef43452d5dcfaa35c99864d867ad3a66f 100644 (file)
@@ -1,3 +1,46 @@
+2008-07-08  Martin Jambor  <mjambor@suse.cz>
+
+       * ipa-cp.c (ipcp_init_cloned_node): Call ipa_check_create_node_params
+       instead of ipa_create_node_params.
+       (ipcp_driver): Allocate infos with ipa_check_create_node_params and
+       ipa_check_create_edge_args, free them with
+       free_all_ipa_structures_after_ipa_cp, call ipa_register_cgraph_hooks.
+
+       * ipa-prop.c: Include flags.h and tree-inline.h.
+       (ipa_node_params_vector): New variable.
+       (ipa_edge_args_vector): New variable.
+       (edge_removal_hook_holder): New variable.
+       (node_removal_hook_holder): New variable.
+       (edge_duplication_hook_holder): New variable.
+       (node_duplication_hook_holder): New variable.
+       (ipa_detect_param_modifications): Check for presence of modified flags.
+       (ipa_compute_jump_functions): Check for presence of jump functions.
+       (ipa_free_edge_args_substructures): New function.
+       (ipa_create_node_params): Removed.
+       (ipa_free_all_edge_args): Changed to deallocate the on-the-side vector.
+       (ipa_free_node_params_substructures): New function.
+       (ipa_free_all_node_params): Changed to deallocate the on-the-side
+       vector.
+       (ipa_edge_removal_hook): New function.
+       (ipa_node_removal_hook): New function.
+       (duplicate_array): New function.
+       (ipa_edge_duplication_hook): New function.
+       (ipa_node_duplication_hook): New function.
+       (ipa_register_cgraph_hooks): New function.
+       (ipa_unregister_cgraph_hooks): New function.
+       (free_all_ipa_structures_after_ipa_cp): New function.
+       
+       * ipa-prop.h: Include vec.h.
+       (ipa_node_params_t): New typedef with vector types for it.
+       (ipa_edge_args_t):  New typedef with vector types for it.
+       (IPA_NODE_REF): Changed to access an on-the-side vector.
+       (IPA_EDGE_REF): Changed to access an on-the-side vector.
+       (ipa_check_create_node_params): New function.
+       (ipa_check_create_edge_args): New function.
+       
+       * Makefile.in (IPA_PROP_H): New variable for ipa-prop.h.  Converted
+       all users.
+       
 2008-07-07  Tom Tromey  <tromey@redhat.com>
 
        * configure, config.in: Rebuilt.
index ef0336607dac163e68abb6c8aa100cb65e3d75ad..a3def27bd5236ac590c1c0d0c2fe1bc06f933dcc 100644 (file)
@@ -839,6 +839,7 @@ TREE_INLINE_H = tree-inline.h $(VARRAY_H) pointer-set.h
 REAL_H = real.h $(MACHMODE_H)
 DBGCNT_H = dbgcnt.h dbgcnt.def
 EBIMAP_H = ebitmap.h sbitmap.h
+IPA_PROP_H = $(TREE_H) vec.h
 
 #\f
 # Now figure out from those variables how to compile and link.
@@ -2007,7 +2008,7 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h \
    langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) intl.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
    debug.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
-   ipa-prop.h value-prof.h $(TARGET_H) $(INTEGRATE_H)
+   $(IPA_PROP_H) value-prof.h $(TARGET_H) $(INTEGRATE_H)
 print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    $(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h $(TREE_FLOW_H)
 stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -2520,7 +2521,7 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(FLAGS_H) $(GGC_H) \
    $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
    $(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \
-   $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) ipa-prop.h \
+   $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \
    gt-cgraphunit.h 
 cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(TREE_GIMPLE_H) \
@@ -2529,14 +2530,14 @@ varpool.o : varpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(FLAGS_H) $(GGC_H) \
    $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
    $(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \
-   $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) ipa-prop.h \
+   $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) $(IPA_PROP_H) \
    gt-varpool.h
 ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H)
 ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h  \
-   langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) ipa-prop.h \
-   $(TREE_FLOW_H) $(TM_H) tree-pass.h $(FLAGS_H) $(TREE_H)
+   langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) \
+   $(TREE_FLOW_H) $(TM_H) tree-pass.h $(FLAGS_H) $(TREE_H) tree-inline.h
 ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h  \
-   langhooks.h $(TARGET_H) $(CGRAPH_H) ipa-prop.h tree-inline.h tree-dump.h \
+   langhooks.h $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) tree-inline.h tree-dump.h \
    $(TREE_FLOW_H) $(TM_H) tree-pass.h $(FLAGS_H) $(TREE_H) $(DIAGNOSTIC_H)
 matrix-reorg.o : matrix-reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h  \
    $(TARGET_H) $(CGRAPH_H) $(TREE_FLOW_H) $(TM_H) tree-pass.h  \
index 9e2153141d3e6cbf5a59aff3cce07a0789434f12..bda0fc261d6b521eb6c8cd0d33e158982b58c7af 100644 (file)
@@ -153,7 +153,7 @@ static void
 ipcp_init_cloned_node (struct cgraph_node *orig_node,
                       struct cgraph_node *new_node)
 {
-  ipa_create_node_params (new_node);
+  ipa_check_create_node_params ();
   IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
   ipa_count_formal_params (new_node);
   ipa_create_param_decls_array (new_node);
@@ -998,8 +998,9 @@ ipcp_driver (void)
 {
   if (dump_file)
     fprintf (dump_file, "\nIPA constant propagation start:\n");
-  ipa_create_all_node_params ();
-  ipa_create_all_edge_args ();
+  ipa_check_create_node_params ();
+  ipa_check_create_edge_args ();
+  ipa_register_cgraph_hooks ();
   /* 1. Call the init stage to initialize 
      the ipa_node_params and ipa_edge_args structures.  */
   ipcp_init_stage ();
@@ -1025,8 +1026,7 @@ ipcp_driver (void)
       ipcp_print_profile_data (dump_file);
     }
   /* Free all IPCP structures.  */
-  ipa_free_all_node_params ();
-  ipa_free_all_edge_args ();
+  free_all_ipa_structures_after_ipa_cp ();
   if (dump_file)
     fprintf (dump_file, "\nIPA constant propagation end\n");
   cgraph_remove_unreachable_nodes (true, NULL);
index c5b4c9a80c8e5e0b6a1c8158de30363eae4ef5c7..f67d6579e10c5ce156097a66e1619b8ff4cc948d 100644 (file)
@@ -28,8 +28,21 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-prop.h"
 #include "tree-flow.h"
 #include "tree-pass.h"
+#include "tree-inline.h"
 #include "flags.h"
 #include "timevar.h"
+#include "flags.h"
+
+/* Vector where the parameter infos are actually stored. */
+VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
+/* Vector where the parameter infos are actually stored. */
+VEC (ipa_edge_args_t, heap) *ipa_edge_args_vector;
+
+/* Holders of ipa cgraph hooks: */
+struct cgraph_edge_hook_list *edge_removal_hook_holder;
+struct cgraph_node_hook_list *node_removal_hook_holder;
+struct cgraph_2edge_hook_list *edge_duplication_hook_holder;
+struct cgraph_2node_hook_list *node_duplication_hook_holder;
 
 /* Initialize worklist to contain all functions.  */
 struct ipa_func_list *
@@ -176,7 +189,7 @@ ipa_detect_param_modifications (struct cgraph_node *mt)
   tree stmt, parm_tree;
   struct ipa_node_params *info = IPA_NODE_REF (mt);
 
-  if (ipa_get_param_count (info) == 0)
+  if (ipa_get_param_count (info) == 0 || info->modified_flags)
     return;
 
   count = ipa_get_param_count (info);
@@ -244,7 +257,7 @@ ipa_compute_jump_functions (struct cgraph_edge *cs)
   call_expr_arg_iterator iter;
   struct ipa_edge_args *args = IPA_EDGE_REF (cs);
 
-  if (ipa_get_cs_argument_count (args) == 0)
+  if (ipa_get_cs_argument_count (args) == 0 || args->jump_functions)
     return;
   args->jump_functions = XCNEWVEC (struct ipa_jump_func,
                                   ipa_get_cs_argument_count (args));
@@ -316,74 +329,184 @@ ipa_compute_jump_functions (struct cgraph_edge *cs)
     }
 }
 
-/* Allocate and initialize ipa_node_params structure for the given cgraph
-   node.  */
+/* Frees all dynamically allocated structures that the argument info points
+   to.  */
 void
-ipa_create_node_params (struct cgraph_node *node)
+ipa_free_edge_args_substructures (struct ipa_edge_args *args)
 {
-  node->aux = xcalloc (1, sizeof (struct ipa_node_params));
+  if (args->jump_functions)
+    free (args->jump_functions);
+
+  memset (args, 0, sizeof (*args));
 }
 
-/* Allocate and initialize ipa_node_params structure for all
-   nodes in callgraph.  */
+/* Free all ipa_edge structures.  */
 void
-ipa_create_all_node_params (void)
+ipa_free_all_edge_args (void)
 {
-  struct cgraph_node *node;
+  int i;
+  struct ipa_edge_args *args;
 
-  for (node = cgraph_nodes; node; node = node->next)
-    ipa_create_node_params (node);
+  for (i = 0;
+       VEC_iterate (ipa_edge_args_t, ipa_edge_args_vector, i, args);
+       i++)
+    ipa_free_edge_args_substructures (args);
+
+  VEC_free (ipa_edge_args_t, heap, ipa_edge_args_vector);
+  ipa_edge_args_vector = NULL;
 }
 
-/* Allocate and initialize ipa_edge structure.  */
+/* Frees all dynamically allocated structures that the param info points
+   to.  */
 void
-ipa_create_all_edge_args (void)
+ipa_free_node_params_substructures (struct ipa_node_params *info)
 {
-  struct cgraph_node *node;
-  struct cgraph_edge *cs;
-
-  for (node = cgraph_nodes; node; node = node->next)
-    for (cs = node->callees; cs; cs = cs->next_callee)
-      cs->aux = xcalloc (1, sizeof (struct ipa_edge_args));
+  if (info->ipcp_lattices)
+    free (info->ipcp_lattices);
+  if (info->param_decls)
+    free (info->param_decls);
+  if (info->modified_flags)
+    free (info->modified_flags);
+
+  memset (info, 0, sizeof (*info));
 }
 
-/* Free ipa_edge structure.  */
+/* Free all ipa_node_params structures.  */
 void
-ipa_free_all_edge_args (void)
+ipa_free_all_node_params (void)
 {
-  struct cgraph_node *node;
-  struct cgraph_edge *cs;
+  int i;
+  struct ipa_node_params *info;
 
-  for (node = cgraph_nodes; node; node = node->next)
-    for (cs = node->callees; cs; cs = cs->next_callee)
-      if (cs->aux)
-       {
-         if (IPA_EDGE_REF (cs)->jump_functions)
-           free (IPA_EDGE_REF (cs)->jump_functions);
-         free (cs->aux);
-         cs->aux = NULL;
-       }
+  for (i = 0;
+       VEC_iterate (ipa_node_params_t, ipa_node_params_vector, i, info);
+       i++)
+    ipa_free_node_params_substructures (info);
+
+  VEC_free (ipa_node_params_t, heap, ipa_node_params_vector);
+  ipa_node_params_vector = NULL;
+}
+
+/* Hook that is called by cgraph.c when an edge is removed.  */
+static void
+ipa_edge_removal_hook (struct cgraph_edge *cs,
+                      void *data __attribute__ ((unused)))
+{
+  ipa_free_edge_args_substructures (IPA_EDGE_REF (cs));
 }
 
-/* Free ipa data structures of ipa_node_params and ipa_edge_args.  */
+/* Hook that is called by cgraph.c when a node is removed.  */
+static void
+ipa_node_removal_hook (struct cgraph_node *node,
+                      void *data __attribute__ ((unused)))
+{
+  ipa_free_node_params_substructures (IPA_NODE_REF (node));
+}
+
+/* Helper function to duplicate an array of size N that is at SRC and store a
+   pointer to it to DST.  Nothing is done if SRC is NULL.  */
+static void *
+duplicate_array (void *src, size_t n)
+{
+  void *p;
+
+  if (!src)
+    return NULL;
+
+  p = xcalloc (1, n);
+  memcpy (p, src, n);
+  return p;
+}
+
+/* Hook that is called by cgraph.c when a node is duplicated.  */
+static void
+ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
+                          void *data)
+{
+  struct ipa_edge_args *old_args, *new_args;
+  int arg_count;
+
+  ipa_check_create_edge_args ();
+
+  old_args = IPA_EDGE_REF (src);
+  new_args = IPA_EDGE_REF (dst);
+
+  arg_count = ipa_get_cs_argument_count (old_args);
+  ipa_set_cs_argument_count (new_args, arg_count);
+  new_args->jump_functions = (struct ipa_jump_func *)
+    duplicate_array (old_args->jump_functions,
+                    sizeof (struct ipa_jump_func) * arg_count);
+  data = data;                         /* Suppressing compiler warning.  */
+}
+
+/* Hook that is called by cgraph.c when a node is duplicated.  */
+static void
+ipa_node_duplication_hook (struct cgraph_node *src, struct cgraph_node *dst,
+                          void *data)
+{
+  struct ipa_node_params *old_info, *new_info;
+  int param_count;
+
+  ipa_check_create_node_params ();
+  old_info = IPA_NODE_REF (src);
+  new_info = IPA_NODE_REF (dst);
+  param_count = ipa_get_param_count (old_info);
+
+  ipa_set_param_count (new_info, param_count);
+  new_info->ipcp_lattices = (struct ipcp_lattice *)
+    duplicate_array (old_info->ipcp_lattices,
+                    sizeof (struct ipcp_lattice) * param_count);
+  new_info->param_decls = (tree *)
+    duplicate_array (old_info->param_decls, sizeof (tree) * param_count);
+  new_info->modified_flags = (bool *)
+    duplicate_array (old_info->modified_flags, sizeof (bool) * param_count);
+
+  new_info->ipcp_orig_node = old_info->ipcp_orig_node;
+  new_info->count_scale = old_info->count_scale;
+
+  data = data;                         /* Suppressing compiler warning.  */
+}
+
+/* Register our cgraph hooks if they are not already there.  */
 void
-ipa_free_all_node_params (void)
+ipa_register_cgraph_hooks (void)
 {
-  struct cgraph_node *node;
+  if (!edge_removal_hook_holder)
+    edge_removal_hook_holder =
+      cgraph_add_edge_removal_hook (&ipa_edge_removal_hook, NULL);
+  if (!node_removal_hook_holder)
+    node_removal_hook_holder =
+      cgraph_add_node_removal_hook (&ipa_node_removal_hook, NULL);
+  if (!edge_duplication_hook_holder)
+    edge_duplication_hook_holder =
+      cgraph_add_edge_duplication_hook (&ipa_edge_duplication_hook, NULL);
+  if (!node_duplication_hook_holder)
+    node_duplication_hook_holder =
+      cgraph_add_node_duplication_hook (&ipa_node_duplication_hook, NULL);
+}
 
-  for (node = cgraph_nodes; node; node = node->next)
-    {
-      if (node->aux == NULL)
-       continue;
-      if (IPA_NODE_REF (node)->ipcp_lattices)
-       free (IPA_NODE_REF (node)->ipcp_lattices);
-      if (IPA_NODE_REF (node)->param_decls)
-       free (IPA_NODE_REF (node)->param_decls);
-      if (IPA_NODE_REF (node)->modified_flags)
-       free (IPA_NODE_REF (node)->modified_flags);
-      free (node->aux);
-      node->aux = NULL;
-    }
+/* Unregister our cgraph hooks if they are not already there.  */
+static void
+ipa_unregister_cgraph_hooks (void)
+{
+  cgraph_remove_edge_removal_hook (edge_removal_hook_holder);
+  edge_removal_hook_holder = NULL;
+  cgraph_remove_node_removal_hook (node_removal_hook_holder);
+  node_removal_hook_holder = NULL;
+  cgraph_remove_edge_duplication_hook (edge_duplication_hook_holder);
+  edge_duplication_hook_holder = NULL;
+  cgraph_remove_node_duplication_hook (node_duplication_hook_holder);
+  node_duplication_hook_holder = NULL;
+}
+
+/* Free all ipa_node_params and all ipa_edge_args structures if they are no
+   longer needed after ipa-cp.  */
+void
+free_all_ipa_structures_after_ipa_cp (void)
+{
+  ipa_free_all_edge_args ();
+  ipa_free_all_node_params ();
+  ipa_unregister_cgraph_hooks ();
 }
 
 /* Print ipa_tree_map data structures of all functions in the
index a81418d7f47fc3108a488794c6abe4b4efa7f7f3..e442698bd3a51a4137be2cc0985f34065007d949 100644 (file)
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #define IPA_PROP_H
 
 #include "tree.h"
+#include "vec.h"
 
 /* The following definitions and interfaces are used by
    interprocedural analyses.  */
@@ -100,14 +101,6 @@ struct ipa_replace_map
   bool ref_p;
 };
 
-/* Return the field in cgraph_node/cgraph_edge struct that points
-   to ipa_node_params/ipa_edge_args struct.  */
-#define IPA_NODE_REF(MT) ((struct ipa_node_params *)(MT)->aux)
-#define IPA_EDGE_REF(EDGE) ((struct ipa_edge_args *)(EDGE)->aux)
-/* This macro checks validity of index returned by
-   ipa_get_param_decl_index function.  */
-#define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
-
 /* ipa_node_params stores information related to formal parameters of functions
    and some other information for interprocedural passes that operate on
    parameters (such as ipa-cp).  */
@@ -229,6 +222,71 @@ ipa_get_ith_jump_func (struct ipa_edge_args *args, int i)
   return &args->jump_functions[i];
 }
 
+/* Vectors need to have typedefs of structures.  */
+typedef struct ipa_node_params ipa_node_params_t;
+typedef struct ipa_edge_args ipa_edge_args_t;
+
+/* Types of vectors hodling the infos.  */
+DEF_VEC_O (ipa_node_params_t);
+DEF_VEC_ALLOC_O (ipa_node_params_t, heap);
+DEF_VEC_O (ipa_edge_args_t);
+DEF_VEC_ALLOC_O (ipa_edge_args_t, heap);
+
+/* Vector where the parameter infos are actually stored. */
+extern VEC (ipa_node_params_t, heap) *ipa_node_params_vector;
+/* Vector where the parameter infos are actually stored. */
+extern VEC (ipa_edge_args_t, heap) *ipa_edge_args_vector;
+
+/* Return the associated parameter/argument info corresponding to the given
+   node/edge.  */
+#define IPA_NODE_REF(NODE) (VEC_index (ipa_node_params_t, \
+                                      ipa_node_params_vector, (NODE)->uid))
+#define IPA_EDGE_REF(EDGE) (VEC_index (ipa_edge_args_t, \
+                                      ipa_edge_args_vector, (EDGE)->uid))
+/* This macro checks validity of index returned by
+   ipa_get_param_decl_index function.  */
+#define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1)
+
+/* Creating and freeing ipa_node_params and ipa_edge_args.  */
+void ipa_create_all_node_params (void);
+void ipa_create_all_edge_args (void);
+void ipa_free_edge_args_substructures (struct ipa_edge_args *);
+void ipa_free_node_params_substructures (struct ipa_node_params *);
+void ipa_free_all_node_params (void);
+void ipa_free_all_edge_args (void);
+void free_all_ipa_structures_after_ipa_cp (void);
+void ipa_register_cgraph_hooks (void);
+
+/* This function ensures the array of node param infos is big enough to
+   accomdate a structure for all nodes and realloacates it if not.  */
+static inline void
+ipa_check_create_node_params (void)
+{
+  if (!ipa_node_params_vector)
+    ipa_node_params_vector = VEC_alloc (ipa_node_params_t, heap,
+                                       cgraph_max_uid);
+
+  if (VEC_length (ipa_node_params_t, ipa_node_params_vector)
+      <= (unsigned) cgraph_max_uid)
+    VEC_safe_grow_cleared (ipa_node_params_t, heap,
+                          ipa_node_params_vector, cgraph_max_uid + 1);
+}
+
+/* This function ensures the array of adge arguments infos is big enough to
+   accomdate a structure for all edges and realloacates it if not.  */
+static inline void
+ipa_check_create_edge_args (void)
+{
+  if (!ipa_edge_args_vector)
+    ipa_edge_args_vector = VEC_alloc (ipa_edge_args_t, heap,
+                                     cgraph_edge_max_uid);
+
+  if (VEC_length (ipa_edge_args_t, ipa_edge_args_vector)
+      <=  (unsigned) cgraph_edge_max_uid)
+    VEC_safe_grow_cleared (ipa_edge_args_t, heap, ipa_edge_args_vector,
+                          cgraph_edge_max_uid + 1);
+}
+
 /* A function list element.  It is used to create a temporary worklist used in
    the propagation stage of IPCP. (can be used for more IPA optimizations)  */
 struct ipa_func_list
@@ -251,13 +309,6 @@ void ipa_count_formal_params (struct cgraph_node *);
 void ipa_create_param_decls_array (struct cgraph_node *);
 void ipa_detect_param_modifications (struct cgraph_node *);
 
-/* Creating and freeing ipa_node_params and ipa_edge_args.  */
-void ipa_create_node_params (struct cgraph_node *);
-void ipa_free_all_node_params (void);
-void ipa_create_all_node_params (void);
-void ipa_create_all_edge_args (void);
-void ipa_free_all_edge_args (void);
-
 /* Debugging interface.  */
 void ipa_print_all_tree_maps (FILE *);
 void ipa_print_all_params_modified (FILE *);