00001 /* Tree inlining hooks and declarations. 00002 Copyright 2001, 2003, 2004, 2005 Free Software Foundation, Inc. 00003 Contributed by Alexandre Oliva <aoliva@redhat.com> 00004 00005 This file is part of GCC. 00006 00007 GCC is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2, or (at your option) 00010 any later version. 00011 00012 GCC is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GCC; see the file COPYING. If not, write to 00019 the Free Software Foundation, 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. */ 00021 00022 #ifndef GCC_TREE_INLINE_H 00023 #define GCC_TREE_INLINE_H 00024 00025 #include "varray.h" 00026 #include "splay-tree.h" 00027 00028 00029 /* Data required for function body duplication. */ 00030 00031 typedef struct copy_body_data 00032 { 00033 /* FUNCTION_DECL for function being inlined, or in general the 00034 source function providing the original trees. */ 00035 tree src_fn; 00036 /* FUNCTION_DECL for function being inlined into, or in general 00037 the destination function receiving the new trees. */ 00038 tree dst_fn; 00039 /* Callgraph node of the source function. */ 00040 struct cgraph_node *src_node; 00041 /* Callgraph node of the destination function. */ 00042 struct cgraph_node *dst_node; 00043 /* struct function for function being inlined. Usually this is the same 00044 as DECL_STRUCT_FUNCTION (src_fn), but can be different if saved_cfg 00045 and saved_eh are in use. */ 00046 struct function *src_cfun; 00047 00048 /* The VAR_DECL for the return value. */ 00049 tree retvar; 00050 /* The map from local declarations in the inlined function to 00051 equivalents in the function into which it is being inlined. */ 00052 splay_tree decl_map; 00053 00054 /* Create a new decl to replace DECL in the destination function. */ 00055 tree (*copy_decl) (tree, struct copy_body_data *); 00056 00057 /* Current BLOCK. */ 00058 tree block; 00059 00060 /* Exception region the inlined call lie in. */ 00061 int eh_region; 00062 /* Take region number in the function being copied, add this value and 00063 get eh region number of the duplicate in the function we inline into. */ 00064 int eh_region_offset; 00065 00066 /* We use the same mechanism do all sorts of different things. Rather 00067 than enumerating the different cases, we categorize the behavior 00068 in the various situations. */ 00069 00070 /* Indicate the desired behavior wrt call graph edges. We can either 00071 duplicate the edge (inlining, cloning), move the edge (versioning, 00072 parallelization), or move the edges of the clones (saving). */ 00073 enum copy_body_cge_which { 00074 CB_CGE_DUPLICATE, 00075 CB_CGE_MOVE, 00076 CB_CGE_MOVE_CLONES 00077 } transform_call_graph_edges; 00078 00079 /* True if a new CFG should be created. False for inlining, true for 00080 everything else. */ 00081 bool transform_new_cfg; 00082 00083 /* True if RETURN_EXPRs should be transformed to just the contained 00084 MODIFY_EXPR. The branch semantics of the return will be handled 00085 by manipulating the CFG rather than a statement. */ 00086 bool transform_return_to_modify; 00087 00088 /* True if lang_hooks.decls.insert_block should be invoked when 00089 duplicating BLOCK nodes. */ 00090 bool transform_lang_insert_block; 00091 } copy_body_data; 00092 00093 /* Function prototypes. */ 00094 00095 extern tree copy_body_r (tree *, int *, void *); 00096 extern void insert_decl_map (copy_body_data *, tree, tree); 00097 00098 void optimize_inline_calls (tree); 00099 bool tree_inlinable_function_p (tree); 00100 tree copy_tree_r (tree *, int *, void *); 00101 void clone_body (tree, tree, void *); 00102 void save_body (tree, tree *, tree *); 00103 int estimate_move_cost (tree type); 00104 void push_cfun (struct function *new_cfun); 00105 void pop_cfun (void); 00106 int estimate_num_insns (tree expr); 00107 bool tree_versionable_function_p (tree); 00108 void tree_function_versioning (tree, tree, varray_type, bool); 00109 00110 extern tree remap_decl (tree decl, copy_body_data *id); 00111 extern tree remap_type (tree type, copy_body_data *id); 00112 00113 /* 0 if we should not perform inlining. 00114 1 if we should expand functions calls inline at the tree level. 00115 2 if we should consider *all* functions to be inline 00116 candidates. */ 00117 00118 extern int flag_inline_trees; 00119 00120 #endif /* GCC_TREE_INLINE_H */
1.5.6