diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-08 13:25:24 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-08 13:25:24 +0000 |
commit | 545eff8f3f76626a7db0e1131bac1a5d43bf0171 (patch) | |
tree | e964190c72b31bbe2578ccc7a12321dbf171286e /gcc/ipa-prop.h | |
parent | fb4830c625a5fea9a90c75c83756ef51bf2e69d1 (diff) | |
download | gcc-545eff8f3f76626a7db0e1131bac1a5d43bf0171.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137620 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 81 |
1 files changed, 66 insertions, 15 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index a81418d7f47..e442698bd3a 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -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 *); |