GCC Middle and Back End API Reference
tree-inline.c File Reference
#include "gimple.h"
Include dependency graph for tree-inline.c:

Functions

static tree declare_return_variable (copy_body_data *, tree, tree, basic_block)
static void remap_block (tree *, copy_body_data *)
static void copy_bind_expr (tree *, int *, copy_body_data *)
static void declare_inline_vars (tree, tree)
static void remap_save_expr (tree *, void *, int *)
static void prepend_lexical_block (tree current_block, tree new_block)
static tree copy_decl_to_var (tree, copy_body_data *)
static tree copy_result_decl_to_var (tree, copy_body_data *)
static tree copy_decl_maybe_to_var (tree, copy_body_data *)
static gimple remap_gimple_stmt (gimple, copy_body_data *)
static bool delete_unreachable_blocks_update_callgraph (copy_body_data *id)
void insert_decl_map ()
static void insert_debug_decl_map ()
static tree remap_ssa_name ()
tree remap_decl ()
static tree remap_type_1 ()
tree remap_type ()
static bool can_be_nonlocal ()
static tree remap_decls (tree decls, vec< tree, va_gc > **nonlocalized_list, copy_body_data *id)
static void remap_block ()
static tree remap_blocks ()
static void remap_blocks_to_null ()
static void copy_statement_list ()
static void copy_bind_expr ()
static gimple_seq remap_gimple_seq ()
static gimple copy_gimple_bind ()
static tree remap_gimple_op_r ()
tree copy_tree_body_r ()
static int remap_eh_region_nr ()
static tree remap_eh_region_tree_nr ()
static gimple remap_gimple_stmt ()
static basic_block copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, gcov_type count_scale)
static void update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb, bool can_throw, bool nonlocal_goto)
static bool copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb, bool can_make_abnormal_goto)
static void copy_phis_for_bb ()
static tree remap_decl_1 ()
static void initialize_cfun ()
static void maybe_move_debug_stmts_to_successors ()
static void copy_loops (bitmap blocks_to_copy, struct loop *dest_parent, struct loop *src_parent)
void redirect_all_calls ()
static tree copy_cfg_body (copy_body_data *id, gcov_type count, int frequency_scale, basic_block entry_block_map, basic_block exit_block_map, bitmap blocks_to_copy, basic_block new_entry)
static void copy_debug_stmt ()
static void copy_debug_stmts ()
static tree copy_tree_body ()
static tree copy_body (copy_body_data *id, gcov_type count, int frequency_scale, basic_block entry_block_map, basic_block exit_block_map, bitmap blocks_to_copy, basic_block new_entry)
static bool self_inlining_addr_expr ()
static gimple insert_init_debug_bind (copy_body_data *id, basic_block bb, tree var, tree value, gimple base_stmt)
static void insert_init_stmt ()
static gimple setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn, basic_block bb, tree *vars)
static void initialize_inlined_parameters (copy_body_data *id, gimple stmt, tree fn, basic_block bb)
static tree has_label_address_in_static_1 ()
static const char * copy_forbidden ()
static tree inline_forbidden_p_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p, struct walk_stmt_info *wip)
static bool inline_forbidden_p ()
static bool function_attribute_inlinable_p ()
bool tree_inlinable_function_p ()
int estimate_move_cost ()
static int estimate_operator_cost (enum tree_code code, eni_weights *weights, tree op1, tree op2)
static int estimate_num_insns_seq (gimple_seq stmts, eni_weights *weights)
int estimate_num_insns ()
int estimate_num_insns_fn ()
void init_inline_once ()
int count_insns_seq ()
static void prepend_lexical_block ()
static void add_local_variables (struct function *callee, struct function *caller, copy_body_data *id)
static bool expand_call_inline ()
static bool gimple_expand_calls_inline ()
static void fold_marked_statements ()
static bool has_abnormal_outgoing_edge_p ()
unsigned int optimize_inline_calls ()
tree copy_tree_r ()
static void remap_save_expr ()
static tree mark_local_labels_stmt (gimple_stmt_iterator *gsip, bool *handled_ops_p, struct walk_stmt_info *wi)
static tree replace_locals_op ()
static tree replace_locals_stmt (gimple_stmt_iterator *gsip, bool *handled_ops_p, struct walk_stmt_info *wi)
gimple_seq copy_gimple_seq_and_replace_locals ()
static tree debug_find_tree_1 ()
DEBUG_FUNCTION bool debug_find_tree ()
static void declare_inline_vars ()
static tree copy_decl_for_dup_finish ()
static tree copy_decl_to_var ()
static tree copy_result_decl_to_var ()
tree copy_decl_no_change ()
static tree copy_decl_maybe_to_var ()
static tree copy_arguments_for_versioning (tree orig_parm, copy_body_data *id, bitmap args_to_skip, tree *vars)
static tree copy_static_chain ()
bool tree_versionable_function_p ()
static bool delete_unreachable_blocks_update_callgraph ()
static void update_clone_info ()
void tree_function_versioning (tree old_decl, tree new_decl, vec< ipa_replace_map_p, va_gc > *tree_map, bool update_clones, bitmap args_to_skip, bool skip_return, bitmap blocks_to_copy, basic_block new_entry)
tree maybe_inline_call_in_expr ()
tree build_duplicate_type ()

Variables

eni_weights eni_size_weights
eni_weights eni_time_weights
static int processing_debug_stmt = 0
static const char * inline_forbidden_reason

Function Documentation

static void add_local_variables ( struct function callee,
struct function caller,
copy_body_data id 
)
inlinestatic
Add local variables from CALLEE to CALLER.   

References add_local_decl(), can_be_nonlocal(), copy_tree_body_r(), and remap_decl().

Referenced by expand_call_inline(), and tree_function_versioning().

static bool can_be_nonlocal ( )
static
Decide if DECL can be put into BLOCK_NONLOCAL_VARs.   

References auto_var_in_fn_p(), and copy_body_data::src_fn.

Referenced by add_local_variables(), and remap_decls().

static tree copy_arguments_for_versioning ( tree  orig_parm,
copy_body_data id,
bitmap  args_to_skip,
tree vars 
)
static
static basic_block copy_bb ( copy_body_data id,
basic_block  bb,
int  frequency_scale,
gcov_type  count_scale 
)
static
Copy basic block, scale profile accordingly.  Edges will be taken care of
   later   

References symtab_node_base::address_taken, apply_scale(), basic_block_def::aux, build_int_cst(), BUILT_IN_NORMAL, function::calls_alloca, function::calls_setjmp, CB_CGE_DUPLICATE, CB_CGE_MOVE, CB_CGE_MOVE_CLONES, cfun, cgraph_clone_edge(), cgraph_create_edge(), cgraph_create_edge_including_clones(), cgraph_edge(), cgraph_get_node(), cgraph_node_name(), cgraph_set_call_stmt(), cgraph_set_call_stmt_including_clones(), cgraph_speculative_call_info(), compute_call_stmt_bb_frequency(), count, basic_block_def::count, create_basic_block(), symtab_node_base::decl, symtab_node_base::definition, copy_body_data::dst_node, dump_file, copy_body_data::eh_lp_nr, copy_body_data::eh_map, force_gimple_operand_gsi(), frequency, basic_block_def::frequency, cgraph_edge::frequency, gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), gimple_block(), gimple_build_call_vec(), copy_body_data::gimple_call, gimple_call_arg_ptr(), gimple_call_copy_flags(), gimple_call_flags(), gimple_call_fn(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_num_args(), gimple_call_set_lhs(), gimple_call_set_va_arg_pack(), gimple_call_va_arg_pack_p(), gimple_duplicate_stmt_histograms(), gimple_in_ssa_p(), gimple_location(), gimple_nop_p(), gimple_regimplify_operands(), gimple_set_block(), gimple_set_location(), gimple_uid(), walk_stmt_info::gsi, GSI_CONTINUE_LINKING, gsi_end_p(), gsi_insert_after(), gsi_last_bb(), GSI_NEW_STMT, gsi_next(), gsi_replace(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, cgraph_edge::indirect_inlining_edge, cgraph_edge::indirect_unknown_callee, cgraph_edge::inline_failed, ipa_clone_ref(), is_gimple_assign(), is_gimple_call(), is_gimple_debug(), is_gimple_val(), maybe_duplicate_eh_stmt_fn(), memcpy(), pointer_set_insert(), basic_block_def::prev_bb, PROFILE_ABSENT, copy_body_data::regimplify, remap_gimple_stmt(), cgraph_edge::speculative, copy_body_data::src_cfun, copy_body_data::src_fn, copy_body_data::src_node, copy_body_data::statements_to_fold, cgraph_node::symbol, and copy_body_data::transform_call_graph_edges.

Referenced by copy_cfg_body().

static void copy_bind_expr ( tree ,
int *  ,
copy_body_data  
)
static

Referenced by copy_tree_body_r().

static void copy_bind_expr ( )
static
static tree copy_body ( copy_body_data id,
gcov_type  count,
int  frequency_scale,
basic_block  entry_block_map,
basic_block  exit_block_map,
bitmap  blocks_to_copy,
basic_block  new_entry 
)
static
Make a copy of the body of FN so that it can be inserted inline in
   another function.   

References copy_cfg_body(), and copy_debug_stmts().

Referenced by expand_call_inline(), and tree_function_versioning().

static void copy_debug_stmts ( )
static
Process deferred debug stmts.  In order to give values better odds
   of being successfully remapped, we delay the processing of debug
   stmts until all other stmts that might require remapping are
   processed.   

References copy_debug_stmt(), and copy_body_data::debug_stmts.

Referenced by copy_body().

static tree copy_decl_for_dup_finish ( )
static
Copy NODE (which must be a DECL).  The DECL originally was in the FROM_FN,
   but now it will be in the TO_FN.  PARM_TO_VAR means enable PARM_DECL to
   VAR_DECL translation.   

References copy(), and copy_body_data::src_fn.

Referenced by copy_decl_no_change(), copy_decl_to_var(), and copy_result_decl_to_var().

static tree copy_decl_maybe_to_var ( tree  ,
copy_body_data  
)
static

Referenced by optimize_inline_calls().

static tree copy_decl_maybe_to_var ( )
static
static tree copy_decl_to_var ( tree  ,
copy_body_data  
)
static
static tree copy_decl_to_var ( )
static
static bool copy_edges_for_bb ( basic_block  bb,
gcov_type  count_scale,
basic_block  ret_bb,
bool  can_make_abnormal_goto 
)
static
Copy edges from BB into its copy constructed earlier, scale profile
   accordingly.  Edges will be taken care of later.  Assume aux
   pointers to point to the copies of each BB.  Return true if any
   debug stmts are left after a statement that must end the basic block.   

References apply_scale(), basic_block_def::aux, cfun, edge_def::count, edge_def::dest, edge_def::flags, gimple_in_ssa_p(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, is_gimple_debug(), make_abnormal_goto_edges(), make_edge(), make_eh_dispatch_edges(), make_eh_edges(), edge_def::probability, si, split_block(), edge_def::src, stmt_can_make_abnormal_goto(), stmt_can_throw_internal(), basic_block_def::succs, update_ssa_across_abnormal_edges(), and update_stmt().

Referenced by copy_cfg_body().

static const char* copy_forbidden ( )
static
Determine if the function can be copied.  If so return NULL.  If
   not return a string describng the reason for failure.   

References has_label_address_in_static_1().

Referenced by inline_forbidden_p(), and tree_versionable_function_p().

static gimple copy_gimple_bind ( )
static
Copy a GIMPLE_BIND statement STMT, remapping all the symbols in its
   block using the mapping information in ID.   

References gimple_bind_block(), gimple_bind_body(), gimple_bind_vars(), gimple_build_bind(), remap_block(), remap_decls(), and remap_gimple_seq().

Referenced by remap_gimple_stmt().

static void copy_loops ( bitmap  blocks_to_copy,
struct loop dest_parent,
struct loop src_parent 
)
static
Make a copy of the sub-loops of SRC_PARENT and place them
   as siblings of DEST_PARENT.   

References alloc_loop(), basic_block_def::aux, bitmap_bit_p(), cfun, copy_loop_info(), flow_loop_tree_node_add(), loop::header, basic_block_def::index, loop::inner, loop::latch, basic_block_def::loop_father, loop::next, and place_new_loop().

Referenced by copy_cfg_body().

static void copy_phis_for_bb ( )
static
Copy the PHIs.  All blocks and edges are copied, some blocks
   was possibly split and new outgoing EH edges inserted.
   BB points to the block of original function and AUX pointers links
   the original and newly copied blocks.   

References add_phi_arg(), basic_block_def::aux, copy_tree_body_r(), create_phi_node(), copy_body_data::decl_map, find_edge(), force_gimple_operand(), gimple_phi_arg_location_from_edge(), gsi_commit_one_edge_insert(), gsi_end_p(), gsi_insert_seq_on_edge(), gsi_next(), gsi_start_phis(), gsi_stmt(), inserted, is_gimple_val(), line_table, pointer_map_contains(), basic_block_def::preds, si, edge_def::src, and virtual_operand_p().

Referenced by copy_cfg_body().

static tree copy_result_decl_to_var ( tree  ,
copy_body_data  
)
static

Referenced by declare_return_variable().

static tree copy_result_decl_to_var ( )
static
Like copy_decl_to_var, but create a return slot object instead of a
   pointer variable for return by invisible reference.   

References copy(), copy_decl_for_dup_finish(), copy_body_data::dst_fn, and type().

static void copy_statement_list ( )
static
static tree copy_static_chain ( )
static
Return a copy of the function's static chain.   

References lang_hooks::dup_lang_specific_decl, and remap_decl().

Referenced by tree_function_versioning().

static tree copy_tree_body ( )
static
Make a copy of the body of SRC_FN so that it can be inserted inline in
   another function.   

References copy_tree_body_r().

Referenced by maybe_inline_call_in_expr().

tree copy_tree_r ( )
int count_insns_seq ( )
Estimate the number of instructions in a gimple_seq.  

References estimate_num_insns(), gsi_end_p(), gsi_next(), and gsi_stmt().

Referenced by decide_copy_try_finally().

DEBUG_FUNCTION bool debug_find_tree ( )

References debug_find_tree_1().

static tree debug_find_tree_1 ( )
static
Allow someone to determine if SEARCH is a child of TOP from gdb.   

Referenced by debug_find_tree().

static void declare_inline_vars ( tree  ,
tree   
)
static
static void declare_inline_vars ( )
static
Declare the variables created by the inliner.  Add all the variables in
   VARS to BIND_EXPR.   

References add_local_decl(), cfun, and chainon().

static tree declare_return_variable ( copy_body_data id,
tree  return_slot,
tree  modify_dest,
basic_block  entry_bb 
)
static
Prototypes.   
Declare a return variable to replace the RESULT_DECL for the
   function we are calling.  An appropriate DECL_STMT is returned.
   The USE_STMT is filled to contain a use of the declaration to
   indicate the return value of the function.

   RETURN_SLOT, if non-null is place where to store the result.  It
   is set only for CALL_EXPR_RETURN_SLOT_OPT.  MODIFY_DEST, if non-null,
   was the LHS of the MODIFY_EXPR to which this call is the RHS.

   The return value is a (possibly null) value that holds the result
   as seen by the caller.   

References copy_body_data::block, build_int_cst(), copy_result_decl_to_var(), create_tmp_var(), declare_inline_vars(), fold_convertible_p(), get_base_address(), gimple_in_ssa_p(), insert_decl_map(), insert_init_stmt(), is_gimple_reg(), is_gimple_reg_type(), is_gimple_val(), is_global_var(), make_ssa_name(), copy_body_data::src_cfun, ssa_default_def(), and useless_type_conversion_p().

Referenced by expand_call_inline().

static bool delete_unreachable_blocks_update_callgraph ( copy_body_data id)
static
static bool delete_unreachable_blocks_update_callgraph ( )
static
int estimate_move_cost ( )
Estimate the cost of a memory move.  Use machine dependent
   word size and take possible memcpy call into account.   

References HOST_WIDE_INT, int_size_in_bytes(), and targetm.

Referenced by consider_split(), estimate_local_effects(), estimate_num_insns(), gather_context_independent_values(), and ipa_populate_param_decls().

int estimate_num_insns ( )
int estimate_num_insns_fn ( )
Estimate number of instructions that will be created by expanding
   function FNDECL.  WEIGHTS contains weights attributed to various
   constructs.   

References function::cfg, estimate_num_insns(), gsi_end_p(), gsi_next(), gsi_start_bb(), and gsi_stmt().

static int estimate_num_insns_seq ( gimple_seq  stmts,
eni_weights weights 
)
static
Estimate number of instructions that will be created by expanding
   the statements in the statement sequence STMTS.
   WEIGHTS contains weights attributed to various constructs.   

References estimate_num_insns(), gsi_end_p(), gsi_next(), and gsi_stmt().

Referenced by estimate_num_insns().

static int estimate_operator_cost ( enum tree_code  code,
eni_weights weights,
tree  op1,
tree  op2 
)
static
Returns cost of operation CODE, according to WEIGHTS   

References eni_weights_d::div_mod_cost, get_gimple_rhs_class(), and GIMPLE_SINGLE_RHS.

Referenced by estimate_num_insns().

static bool expand_call_inline ( )
static
If STMT is a GIMPLE_CALL, replace it with its inline expansion.   

References add_local_variables(), function::after_inlining, copy_body_data::block, cgraph_edge::callee, cgraph_edge::caller, cfun, cgraph_edge(), cgraph_edge_recursive_p(), cgraph_get_body(), cgraph_global_info_ready, cgraph_inline_failed_string(), cgraph_remove_node(), copy_body(), basic_block_def::count, debug_hooks, copy_body_data::debug_map, symtab_node_base::decl, copy_body_data::decl_map, declare_return_variable(), edge_def::dest, copy_body_data::dst_fn, copy_body_data::dst_node, dump_file, dump_flags, error(), gimple_df::escaped, cgraph_edge::frequency, gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_block(), gimple_build_nop(), gimple_build_predict(), gimple_call_lhs(), gimple_call_return_slot_opt_p(), function::gimple_df, gimple_has_body_p(), gimple_location(), gimple_purge_dead_abnormal_call_edges(), gimple_purge_dead_eh_edges(), gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_last_bb(), GSI_NEW_STMT, gsi_remove(), gsi_replace(), gsi_start_bb(), cgraph_edge::indirect_inlining_edge, cgraph_edge::indirect_unknown_callee, initialize_inlined_parameters(), cgraph_edge::inline_failed, input_location, is_gimple_assign(), cgraph_node::local, lookup_attribute(), lookup_stmt_eh_lp(), maybe_clean_or_replace_eh_stmt(), NOT_TAKEN, gcc_debug_hooks::outlining_inline_function, pointer_map_create(), pointer_map_destroy(), prepend_lexical_block(), print_generic_expr(), pt_solution_reset(), cgraph_local_info::redefined_extern_inline, remap_blocks(), remap_blocks_to_null(), remove_edge(), set_ssa_default_def(), si, split_block(), edge_def::src, copy_body_data::src_cfun, copy_body_data::src_fn, ssa_default_def(), cgraph_node::symbol, unlink_stmt_vdef(), verify_cgraph_node(), and warning().

Referenced by gimple_expand_calls_inline().

static void fold_marked_statements ( )
static
static bool function_attribute_inlinable_p ( )
static
Return false if the function FNDECL cannot be inlined on account of its
   attributes, true otherwise.   

References is_attribute_p(), and targetm.

Referenced by tree_inlinable_function_p().

static bool gimple_expand_calls_inline ( )
static
Expand call statements reachable from STMT_P.
   We can only have CALL_EXPRs as the "toplevel" tree code or nested
   in a MODIFY_EXPR.   

References expand_call_inline(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), and is_gimple_call().

Referenced by optimize_inline_calls().

static bool has_abnormal_outgoing_edge_p ( )
inlinestatic
Return true if BB has at least one abnormal outgoing edge.   

References edge_def::flags, and basic_block_def::succs.

static tree has_label_address_in_static_1 ( )
static
Callback through walk_tree.  Determine if a DECL_INITIAL makes reference
   to a local label.   

Referenced by copy_forbidden().

static void initialize_inlined_parameters ( copy_body_data id,
gimple  stmt,
tree  fn,
basic_block  bb 
)
static
static bool inline_forbidden_p ( )
static
static tree inline_forbidden_p_stmt ( gimple_stmt_iterator gsi,
bool *  handled_ops_p,
struct walk_stmt_info wip 
)
static
A callback for walk_gimple_seq to handle statements.  Returns non-null
   iff a function can not be inlined.  Also sets the reason why.  

References BUILT_IN_NORMAL, gimple_alloca_call_p(), gimple_call_alloca_for_var_p(), gimple_call_fndecl(), gimple_goto_dest(), gsi_stmt(), walk_stmt_info::info, inline_forbidden_reason, lookup_attribute(), and setjmp_call_p().

Referenced by inline_forbidden_p().

static void insert_debug_decl_map ( )
static
Insert a tree->tree mapping for ID.  This is only used for
   variables.   

References copy_body_data::debug_map, gimple_in_ssa_p(), pointer_map_create(), pointer_map_insert(), copy_body_data::src_cfun, and target_for_debug_bind().

Referenced by setup_one_parameter().

void insert_decl_map ( )
static gimple insert_init_debug_bind ( copy_body_data id,
basic_block  bb,
tree  var,
tree  value,
gimple  base_stmt 
)
static
Append to BB a debug annotation that binds VAR to VALUE, inheriting
   lexical block and line number information from base_stmt, if given,
   or from the last stmt of the block otherwise.   

References gimple_in_ssa_p(), walk_stmt_info::gsi, gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_last_bb(), GSI_SAME_STMT, gsi_stmt(), copy_body_data::src_cfun, and target_for_debug_bind().

Referenced by insert_init_stmt(), and setup_one_parameter().

static tree mark_local_labels_stmt ( gimple_stmt_iterator gsip,
bool *  handled_ops_p,
struct walk_stmt_info wi 
)
static
Called via walk_gimple_seq.  If *GSIP points to a GIMPLE_LABEL for a local
   label, copies the declaration and enters it in the splay_tree in DATA (which
   is really a 'copy_body_data *'.   

References copy_body_data::copy_decl, gimple_label_label(), gsi_stmt(), walk_stmt_info::info, and insert_decl_map().

Referenced by copy_gimple_seq_and_replace_locals().

tree maybe_inline_call_in_expr ( )
EXP is CALL_EXPR present in a GENERIC expression tree.  Try to integrate
   the callee and return the inlined body on success.   

References CB_CGE_DUPLICATE, copy_decl_no_change(), copy_tree_body(), current_function_decl, first_call_expr_arg(), get_callee_fndecl(), memset(), next_call_expr_arg(), pointer_map_create(), pointer_map_destroy(), and pointer_map_insert().

Referenced by substitute_in_expr().

static void maybe_move_debug_stmts_to_successors ( )
static
static void prepend_lexical_block ( tree  current_block,
tree  new_block 
)
static

Referenced by expand_call_inline(), and remap_blocks().

static void prepend_lexical_block ( )
static
Install new lexical TREE_BLOCK underneath 'current_block'.   

References current_block.

void redirect_all_calls ( )
Call cgraph_redirect_edge_call_stmt_to_callee on all calls in BB  

References cgraph_edge(), cgraph_redirect_edge_call_stmt_to_callee(), copy_body_data::dst_node, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_call(), and si.

Referenced by copy_cfg_body().

static void remap_block ( tree ,
copy_body_data  
)
static
static void remap_block ( )
static
Copy the BLOCK to contain remapped versions of the variables
   therein.  And hook the new block into the block-tree.   

References insert_decl_map(), remap_decls(), copy_body_data::transform_lang_insert_block, and vec_safe_copy().

static tree remap_blocks ( )
static
Copy the whole block tree and root it in id->block.   

References blocks_nreverse(), prepend_lexical_block(), and remap_block().

Referenced by expand_call_inline(), and tree_function_versioning().

static void remap_blocks_to_null ( )
static
Remap the block tree rooted at BLOCK to nothing.   

References insert_decl_map().

Referenced by expand_call_inline().

static tree remap_decl_1 ( )
static
Wrapper for remap_decl so it can be used as a callback.   

References remap_decl().

Referenced by copy_cfg_body().

static int remap_eh_region_nr ( )
static
Helper for remap_gimple_stmt.  Given an EH region number for the
   source function, map that to the duplicate EH region number in
   the destination function.   

References copy_body_data::eh_map, get_eh_region_from_number_fn(), eh_region_d::index, pointer_map_contains(), and copy_body_data::src_cfun.

Referenced by remap_eh_region_tree_nr(), and remap_gimple_stmt().

static tree remap_eh_region_tree_nr ( )
static
Similar, but operate on INTEGER_CSTs.   

References build_int_cst(), remap_eh_region_nr(), and tree_low_cst().

Referenced by remap_gimple_stmt().

static tree remap_gimple_op_r ( )
static
Remap the GIMPLE operand pointed to by *TP.  DATA is really a
   'struct walk_stmt_info *'.  DATA->INFO is a 'copy_body_data *'.
   WALK_SUBTREES is used to indicate walk_gimple_op whether to keep
   recursing into the children nodes of *TP.   

References auto_var_in_fn_p(), build_int_cst_wide(), copy_node(), copy_tree_r(), decl_function_context(), copy_body_data::decl_map, walk_stmt_info::info, is_gimple_min_invariant(), pointer_map_contains(), recompute_tree_invariant_for_addr_expr(), remap_decl(), remap_ssa_name(), remap_type(), copy_body_data::src_fn, and useless_type_conversion_p().

Referenced by copy_debug_stmt(), remap_gimple_stmt(), and tree_function_versioning().

static gimple_seq remap_gimple_seq ( )
static
Create a new gimple_seq by remapping all the statements in BODY
   using the inlining information in ID.   

References gimple_seq_add_stmt(), gsi_end_p(), gsi_next(), gsi_stmt(), remap_gimple_stmt(), and si.

Referenced by copy_gimple_bind(), and remap_gimple_stmt().

static gimple remap_gimple_stmt ( gimple  ,
copy_body_data  
)
static

Referenced by copy_bb(), and remap_gimple_seq().

static gimple remap_gimple_stmt ( )
static
Helper for copy_bb.  Remap statement STMT using the inlining
   information in ID.  Return the new statement copy.   

References auto_var_in_fn_p(), bitmap_bit_p(), copy_body_data::blocks_to_copy, BUILT_IN_NORMAL, copy(), copy_gimple_bind(), copy_body_data::decl_map, copy_body_data::eh_map, gimple_assign_copy_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_block(), gimple_build_catch(), gimple_build_eh_filter(), gimple_build_nop(), gimple_build_omp_critical(), gimple_build_omp_for(), gimple_build_omp_master(), gimple_build_omp_ordered(), gimple_build_omp_parallel(), gimple_build_omp_section(), gimple_build_omp_sections(), gimple_build_omp_single(), gimple_build_omp_task(), gimple_build_transaction(), gimple_build_try(), gimple_build_wce(), gimple_call_arg(), gimple_call_fndecl(), gimple_call_reset_alias_info(), gimple_call_set_arg(), gimple_catch_handler(), gimple_catch_types(), gimple_clobber_p(), gimple_copy(), gimple_debug_bind_get_value(), gimple_debug_bind_get_var(), gimple_debug_bind_p(), gimple_debug_source_bind_get_value(), gimple_debug_source_bind_get_var(), gimple_debug_source_bind_p(), function::gimple_df, gimple_eh_dispatch_region(), gimple_eh_dispatch_set_region(), gimple_eh_filter_failure(), gimple_eh_filter_types(), gimple_has_mem_ops(), gimple_has_substatements(), gimple_omp_body(), gimple_omp_critical_name(), gimple_omp_for_clauses(), gimple_omp_for_collapse(), gimple_omp_for_cond(), gimple_omp_for_final(), gimple_omp_for_incr(), gimple_omp_for_index(), gimple_omp_for_initial(), gimple_omp_for_kind(), gimple_omp_for_pre_body(), gimple_omp_for_set_cond(), gimple_omp_for_set_final(), gimple_omp_for_set_incr(), gimple_omp_for_set_index(), gimple_omp_for_set_initial(), gimple_omp_parallel_child_fn(), gimple_omp_parallel_clauses(), gimple_omp_parallel_data_arg(), gimple_omp_sections_clauses(), gimple_omp_single_clauses(), gimple_omp_task_arg_align(), gimple_omp_task_arg_size(), gimple_omp_task_child_fn(), gimple_omp_task_clauses(), gimple_omp_task_copy_fn(), gimple_omp_task_data_arg(), gimple_op_ptr(), gimple_resx_region(), gimple_resx_set_region(), gimple_return_retval(), gimple_set_block(), gimple_set_vdef(), gimple_set_vuse(), gimple_transaction_body(), gimple_transaction_label(), gimple_transaction_set_subcode(), gimple_transaction_subcode(), gimple_try_cleanup(), gimple_try_eval(), gimple_try_kind(), gimple_wce_cleanup(), walk_stmt_info::info, gimple_df::ipa_pta, memset(), pointer_map_contains(), remap_eh_region_nr(), remap_eh_region_tree_nr(), remap_gimple_op_r(), remap_gimple_seq(), copy_body_data::retvar, copy_body_data::src_cfun, copy_body_data::src_fn, copy_body_data::transform_return_to_modify, and walk_gimple_op().

static void remap_save_expr ( tree ,
void *  ,
int *   
)
static

Referenced by copy_tree_body_r().

static void remap_save_expr ( )
static
The SAVE_EXPR pointed to by TP is being copied.  If ST contains
   information indicating to what new SAVE_EXPR this one should be mapped,
   use that one.  Otherwise, create a new node and enter it in ST.  FN is
   the function into which the copy will be placed.   

References copy_node(), pointer_map_contains(), and pointer_map_insert().

static tree replace_locals_op ( )
static
Called via walk_gimple_seq by copy_gimple_seq_and_replace_local.
   Using the splay_tree pointed to by ST (which is really a `splay_tree'),
   remaps all local declarations to appropriate replacements in gimple
   operands.  

References copy_body_data::decl_map, walk_stmt_info::info, and pointer_map_contains().

Referenced by copy_gimple_seq_and_replace_locals().

static tree replace_locals_stmt ( gimple_stmt_iterator gsip,
bool *  handled_ops_p,
struct walk_stmt_info wi 
)
static
Called via walk_gimple_seq by copy_gimple_seq_and_replace_local.
   Using the splay_tree pointed to by ST (which is really a `splay_tree'),
   remaps all local declarations to appropriate replacements in gimple
   statements.  

References gimple_bind_block(), gimple_bind_set_block(), gimple_bind_set_vars(), gimple_bind_vars(), gsi_stmt(), walk_stmt_info::info, remap_block(), and remap_decls().

Referenced by copy_gimple_seq_and_replace_locals().

static bool self_inlining_addr_expr ( )
static
Return true if VALUE is an ADDR_EXPR of an automatic variable
   defined in function FN, or of a data member thereof.   

References auto_var_in_fn_p(), and get_base_address().

Referenced by setup_one_parameter().

static gimple setup_one_parameter ( copy_body_data id,
tree  p,
tree  value,
tree  fn,
basic_block  bb,
tree vars 
)
static
void tree_function_versioning ( tree  old_decl,
tree  new_decl,
vec< ipa_replace_map_p, va_gc > *  tree_map,
bool  update_clones,
bitmap  args_to_skip,
bool  skip_return,
bitmap  blocks_to_copy,
basic_block  new_entry 
)
Create a copy of a function's tree.
   OLD_DECL and NEW_DECL are FUNCTION_DECL tree nodes
   of the original function and the new copied function
   respectively.  In case we want to replace a DECL
   tree with another tree while duplicating the function's
   body, TREE_MAP represents the mapping between these
   trees. If UPDATE_CLONES is set, the call_stmt fields
   of edges of clones of the function will be updated.  

   If non-NULL ARGS_TO_SKIP determine function parameters to remove
   from new version.
   If SKIP_RETURN is true, the new version will return void.
   If non-NULL BLOCK_TO_COPY determine what basic blocks to copy.
   If non_NULL NEW_ENTRY determine new entry BB of the clone.

References add_local_variables(), cgraph_edge::call_stmt, cgraph_node::callees, CB_CGE_MOVE, CB_CGE_MOVE_CLONES, CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, cgraph_get_node(), cgraph_rebuild_references(), compute_call_stmt_bb_frequency(), copy_arguments_for_versioning(), copy_body(), copy_decl_no_change(), copy_static_chain(), basic_block_def::count, cgraph_node::count, cgraph_edge::count, function::curr_properties, current_function_decl, debug_hooks, decl_debug_args_insert(), decl_debug_args_lookup(), declare_inline_vars(), delete_unreachable_blocks_update_callgraph(), dump_file, lang_hooks::dup_lang_specific_decl, fold_cond_expr_cond(), fold_convertible_p(), fold_marked_statements(), free_dominance_info(), cgraph_edge::frequency, gimple_bb(), gimple_build_nop(), gimple_in_ssa_p(), cgraph_node::indirect_calls, walk_stmt_info::info, initialize_cfun(), insert_decl_map(), insert_init_stmt(), loop_optimizer_init(), loops_for_fn(), make_ssa_name(), memset(), ipa_replace_map::new_tree, cgraph_edge::next_callee, function::nonlocal_goto_save_area, number_blocks(), ipa_replace_map::old_tree, gcc_debug_hooks::outlining_inline_function, ipa_replace_map::parm_num, pointer_map_create(), pointer_map_destroy(), pointer_set_create(), pointer_set_destroy(), pop_cfun(), print_generic_expr(), rebuild_frequencies(), remap_blocks(), remap_decl(), remap_gimple_op_r(), ipa_replace_map::replace_p, function::returns_pcc_struct, function::returns_struct, set_ssa_default_def(), setup_one_parameter(), single_succ_edge(), split_edge(), ssa_default_def(), update_clone_info(), update_ssa(), cgraph_node::used_as_abstract_origin, useless_type_conversion_p(), vec_safe_copy(), and vec_safe_is_empty().

Referenced by cgraph_function_versioning(), cgraph_materialize_clone(), ipa_tm_create_version(), and save_inline_function_body().

bool tree_inlinable_function_p ( )
Returns nonzero if FN is a function that does not have any
   fundamental inline blocking properties.   

References error(), function_attribute_inlinable_p(), inline_forbidden_p(), inline_forbidden_reason, lookup_attribute(), and warning().

Referenced by compute_inline_parameters().

bool tree_versionable_function_p ( )
Return true if the function is allowed to be versioned.
   This is a guard for the versioning functionality.   

References copy_forbidden(), and lookup_attribute().

Referenced by cgraph_create_virtual_clone(), cgraph_function_versioning(), execute_split_functions(), ipa_sra_preliminary_function_checks(), ipa_tm_execute(), and ipcp_generate_summary().

static void update_ssa_across_abnormal_edges ( basic_block  bb,
basic_block  ret_bb,
bool  can_throw,
bool  nonlocal_goto 
)
static
Inserting Single Entry Multiple Exit region in SSA form into code in SSA
   form is quite easy, since dominator relationship for old basic blocks does
   not change.

   There is however exception where inlining might change dominator relation
   across EH edges from basic block within inlined functions destinating
   to landing pads in function we inline into.

   The function fills in PHI_RESULTs of such PHI nodes if they refer
   to gimple regs.  Otherwise, the function mark PHI_RESULT of such
   PHI nodes for renaming.  For non-gimple regs, renaming is safe: the
   EH edges are abnormal and SSA_NAME_OCCURS_IN_ABNORMAL_PHI must be
   set, and this means that there will be no overlapping live ranges
   for the underlying symbol.

   This might change in future if we allow redirecting of EH edges and
   we might want to change way build CFG pre-inlining to include
   all the possible edges then.   

References basic_block_def::aux, edge_def::dest, find_edge(), edge_def::flags, gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), si, and basic_block_def::succs.

Referenced by copy_edges_for_bb().


Variable Documentation

eni_weights eni_size_weights
@verbatim Tree inlining.

Copyright (C) 2001-2013 Free Software Foundation, Inc. Contributed by Alexandre Oliva aoliv.nosp@m.a@re.nosp@m.dhat..nosp@m.com

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 3, 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 COPYING3. If not see http://www.gnu.org/licenses/.

I'm not real happy about this, but we need to handle gimple and
   non-gimple trees.   
Inlining, Cloning, Versioning, Parallelization

   Inlining: a function body is duplicated, but the PARM_DECLs are
   remapped into VAR_DECLs, and non-void RETURN_EXPRs become
   MODIFY_EXPRs that store to a dedicated returned-value variable.
   The duplicated eh_region info of the copy will later be appended
   to the info for the caller; the eh_region info in copied throwing
   statements and RESX statements are adjusted accordingly.

   Cloning: (only in C++) We have one body for a con/de/structor, and
   multiple function decls, each with a unique parameter list.
   Duplicate the body, using the given splay tree; some parameters
   will become constants (like 0 or 1).

   Versioning: a function body is duplicated and the result is a new
   function rather than into blocks of an existing function as with
   inlining.  Some parameters will become constants.

   Parallelization: a region of a function is duplicated resulting in
   a new function.  Variables may be replaced with complex expressions
   to enable shared variable semantics.

   All of these will simultaneously lookup any callgraph edges.  If
   we're going to inline the duplicated function body, and the given
   function has some cloned callgraph nodes (one for each place this
   function will be inlined) those callgraph edges will be duplicated.
   If we're cloning the body, those callgraph edges will be
   updated to point into the new body.  (Note that the original
   callgraph node and edge list will not be altered.)

   See the CALL_EXPR handling case in copy_tree_body_r ().   
To Do:

   o In order to make inlining-on-trees work, we pessimized
     function-local static constants.  In particular, they are now
     always output, even when not addressed.  Fix this by treating
     function-local static constants just like global static
     constants; the back-end already knows not to output them if they
     are not needed.

   o Provide heuristics to clamp inlining of recursive template
     calls?   
Weights that estimate_num_insns uses to estimate the size of the
   produced code.   

Referenced by can_unroll_loop_p(), consider_split(), count_insns(), decide_copy_try_finally(), early_inliner(), estimate_edge_devirt_benefit(), estimate_function_body_sizes(), execute_split_functions(), gimple_account_profile_record(), ipa_make_edge_direct_to_target(), ipa_profile_generate_summary(), loop_prefetch_arrays(), should_duplicate_loop_header_p(), tree_estimate_loop_size(), and tree_ssa_unswitch_loops().

eni_weights eni_time_weights
const char* inline_forbidden_reason
static
int processing_debug_stmt = 0
static
If nonzero, we're remapping the contents of inlined debug
   statements.  If negative, an error has occurred, such as a
   reference to a variable that isn't available in the inlined
   context.   

Referenced by copy_debug_stmt(), remap_decl(), and remap_ssa_name().