/* Interprocedural constant propagation Copyright (C) 2004 Free Software Foundation, Inc. Contributed by Razya Ladelsky This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef IPA_PROP_H #define IPA_PROP_H #include "tree.h" #include "real.h" /* The following definitions are interfaces used by interprocedural analyses. */ typedef struct tree_int_cst_lowhi ipcp_int; enum Jfunc_type { UNKNOWN_IPATYPE, CONST_IPATYPE_INT, CONST_IPATYPE_FLOAT, CONST_IPATYPE_INT_REF, CONST_IPATYPE_FLOAT_REF, FORMAL_IPATYPE }; enum Cvalue_type { BOTTOM, CONST_VALUE_INT, CONST_VALUE_FLOAT, CONST_VALUE_INT_REF, CONST_VALUE_FLOAT_REF, TOP }; union info{ ipcp_int int_value; unsigned int formal_id; REAL_VALUE_TYPE float_value; }; struct ipa_jump_func { enum Jfunc_type type; union info info_type; }; struct ipcp_formal { enum Cvalue_type cvalue_type; union info cvalue; }; struct ipa_tree_map { tree param_tree; }; struct ipa_modify { bool mod; }; struct ipa_replace_map { tree old_tree; tree new_tree; bool replace_p; bool ref_p; }; struct ipa_node { /* Number of formal parameters of this method. When set to 0, this method's parameters would not be analyzed by the different stages of IPA CP. */ int ipa_arg_num; /* Array of cvals. */ struct ipcp_formal* GTY ((skip (""))) ipcp_cval; /* Mapping each parameter to its PARM_DECL tree. */ struct ipa_tree_map* GTY ((skip (""))) ipa_param_tree; /* Indicating which parameter is modified in its method. */ struct ipa_modify* GTY ((skip (""))) ipa_mod; /* Only for cloned nodes this field would not be NULL, it points to the node that IPA cp cloned from. */ struct cgraph_node *ipcp_orig_node; }; struct ipa_edge { /* Number of actual arguments in this callsite. When set to 0, this callsite's parameters would not be analyzed by the different stages of IPA CP. */ int ipa_param_num; /* Array of the callsite's jump function of each parameter. */ struct ipa_jump_func* GTY ((skip (""))) ipcp_param_map; }; typedef struct cgraph_node *ipa_method; typedef struct cgraph_edge *ipa_callsite; struct ipa_methodlist GTY(()) { ipa_method method_p; struct ipa_methodlist *next_method; }; typedef struct ipa_methodlist *ipa_methodlist_p; /* ipa_methodlist interface. */ inline ipa_methodlist_p ipa_create_methodlist_node (void); inline bool ipa_methodlist_not_empty (ipa_methodlist_p); inline ipa_method ipa_methodlist_method (ipa_methodlist_p); inline void ipa_methodlist_method_set (ipa_methodlist_p, ipa_method); inline ipa_methodlist_p ipa_methodlist_next_method (ipa_methodlist_p); inline void ipa_methodlist_next_method_set (ipa_methodlist_p, ipa_methodlist_p); void ipa_add_method (ipa_methodlist_p *, ipa_method); ipa_method ipa_remove_method (ipa_methodlist_p *); ipa_methodlist_p ipa_methodlist_init (void); /* ipa_callsite interface. */ inline int ipa_callsite_param_count (ipa_callsite); inline void ipa_callsite_param_count_set (ipa_callsite, int); inline struct ipa_jump_func *ipa_callsite_param (ipa_callsite, int); inline ipa_method ipa_callsite_callee (ipa_callsite); inline void ipa_callsite_param_set_type (ipa_callsite, int, enum Jfunc_type); inline void ipa_callsite_param_set_info_type_formal (ipa_callsite cs, int i, unsigned int formal) ; inline void ipa_callsite_param_set_info_type_int (ipa_callsite cs, int i, ipcp_int *info_type1) ; inline void ipa_callsite_param_map_create (ipa_callsite); inline tree ipa_callsite_tree (ipa_callsite); inline ipa_method ipa_callsite_caller (ipa_callsite); void ipa_callsite_compute_param (ipa_callsite); void ipa_callsite_compute_count (ipa_callsite); /* ipa_method interface. */ inline int ipa_method_formal_count (ipa_method); inline void ipa_method_formal_count_set (ipa_method, int); inline bool ipa_method_is_modified (ipa_method, int); inline tree ipa_method_get_tree (ipa_method, int); inline void ipa_method_tree_map_create (ipa_method); inline void ipa_method_modify_create (ipa_method); inline void ipa_method_modify_set (ipa_method, int, bool); int ipa_method_tree_map (ipa_method, tree); void ipa_method_compute_tree_map (ipa_method); void ipa_method_formal_compute_count (ipa_method); tree ipa_modify_walk_tree (tree *, int *, void *); void ipa_modify_walk_tree_1 (tree *, void *); void ipa_method_modify_init (ipa_method); void ipa_method_compute_modify (ipa_method); /* jump function interface. */ inline enum Jfunc_type get_type (struct ipa_jump_func *); inline union info *ipa_jf_get_info_type (struct ipa_jump_func *); /* ipa_node and ipa_edge interfaces. */ inline void ipa_node_create (ipa_method); void ipa_free (void); void ipa_nodes_create (void); void ipa_edges_create (void); /* Debugging interface. */ void ipa_method_tree_print (FILE *); void ipa_method_modify_print (FILE *); void ipcp_driver (void); #endif /* IPA_PROP_H */