GCC Middle and Back End API Reference
ipa_param_adjustments Class Reference

#include <ipa-param-manipulation.h>

Collaboration diagram for ipa_param_adjustments:

Public Member Functions

 ipa_param_adjustments (vec< ipa_adjusted_param, va_gc > *new_params, int always_copy_start, bool skip_return)
 
gcallmodify_call (cgraph_edge *cs, bool update_references, hash_set< tree > *killed_ssas)
 
bool first_param_intact_p ()
 
tree build_new_function_type (tree old_type, bool type_is_original_p)
 
tree adjust_decl (tree orig_decl)
 
void get_surviving_params (vec< bool > *surviving_params)
 
void get_updated_indices (vec< int > *new_indices)
 
int get_original_index (int newidx)
 
void dump (FILE *f)
 
void debug ()
 

Static Public Member Functions

static bool type_attribute_allowed_p (tree)
 

Data Fields

vec< ipa_adjusted_param, va_gc > * m_adj_params
 
int m_always_copy_start
 
bool m_skip_return
 

Private Member Functions

 ipa_param_adjustments ()
 
void init (vec< tree > *cur_params)
 
int get_max_base_index ()
 
bool method2func_p (tree orig_type)
 

Detailed Description

Class used to record planned modifications to parameters of a function and
also to perform necessary modifications at the caller side at the gimple
level.  Used to describe all cgraph node clones that have their parameters
changed, therefore the class should only have a small memory footprint.   

Constructor & Destructor Documentation

◆ ipa_param_adjustments() [1/2]

ipa_param_adjustments::ipa_param_adjustments ( vec< ipa_adjusted_param, va_gc > * new_params,
int always_copy_start,
bool skip_return )
inline

◆ ipa_param_adjustments() [2/2]

ipa_param_adjustments::ipa_param_adjustments ( )
inlineprivate

Member Function Documentation

◆ adjust_decl()

tree ipa_param_adjustments::adjust_decl ( tree orig_decl)
Build variant of function decl ORIG_DECL which has no return value if
M_SKIP_RETURN is true and, if ORIG_DECL's types or parameters is known, has
this type adjusted as indicated in M_ADJ_PARAMS. Arguments from
DECL_ARGUMENTS list are not processed now, since they are linked by
TREE_CHAIN directly and not accessible in LTO during WPA.  The caller is
responsible for eliminating them when clones are properly materialized.   

References build_new_function_type(), copy_node(), DECL_IS_MALLOC, DECL_LANG_SPECIFIC, DECL_VINDEX, DECL_VIRTUAL_P, fndecl_built_in_p(), ggc_alloc(), m_skip_return, method2func_p(), NOT_BUILT_IN, NULL, NULL_TREE, prototype_p(), set_decl_built_in_function(), TREE_TYPE, and VOID_TYPE_P.

Referenced by cgraph_node::create_version_clone_with_body(), and cgraph_node::create_virtual_clone().

◆ build_new_function_type()

tree ipa_param_adjustments::build_new_function_type ( tree old_type,
bool type_original_p )
Given function type OLD_TYPE, return a new type derived from it after
performing all atored modifications.  TYPE_ORIGINAL_P should be true when
OLD_TYPE refers to the type before any IPA transformations, as opposed to a
type that can be an intermediate one in between various IPA
transformations.   

References build_adjusted_function_type(), fill_vector_of_new_param_types(), get_original_index(), ggc_alloc(), m_adj_params, m_always_copy_start, m_skip_return, method2func_p(), NULL, prototype_p(), push_function_arg_types(), TREE_CHAIN, and TYPE_ARG_TYPES.

Referenced by adjust_decl().

◆ debug()

void ipa_param_adjustments::debug ( )
Dump information contained in the object in textual form to stderr.   

References dump(), and ggc_alloc().

◆ dump()

void ipa_param_adjustments::dump ( FILE * f)
Dump information contained in the object in textual form to F.   

References ggc_alloc(), ipa_dump_adjusted_parameters(), m_adj_params, m_always_copy_start, and m_skip_return.

Referenced by debug(), and cgraph_node::materialize_clone().

◆ first_param_intact_p()

bool ipa_param_adjustments::first_param_intact_p ( )
Return true if the first parameter (assuming there was one) survives the
transformation intact and remains the first one.   

References IPA_PARAM_OP_COPY, m_adj_params, and vec_safe_is_empty().

Referenced by clone_of_p(), duplicate_thunk_for_node(), and method2func_p().

◆ get_max_base_index()

int ipa_param_adjustments::get_max_base_index ( )
private
Return the maximum index in any IPA_PARAM_OP_COPY adjustment or -1 if there
is none.   

References ggc_alloc(), i, IPA_PARAM_OP_COPY, m_adj_params, and vec_safe_length().

Referenced by get_surviving_params(), and get_updated_indices().

◆ get_original_index()

int ipa_param_adjustments::get_original_index ( int newidx)
Return the original index for the given new parameter index.  Return a
negative number if not available.   

References ggc_alloc(), and IPA_PARAM_OP_COPY.

Referenced by build_new_function_type(), and ipcp_get_parm_bits().

◆ get_surviving_params()

void ipa_param_adjustments::get_surviving_params ( vec< bool > * surviving_params)
Fill SURVIVING_PARAMS with an array of bools where each one says whether a
parameter that originally was at that position still survives in the given
clone or is removed/replaced.  If the final array is smaller than an index
of an original parameter, that parameter also did not survive.  That a
parameter survives does not mean it has the same index as before.   

References get_max_base_index(), ggc_alloc(), i, IPA_PARAM_OP_COPY, m_adj_params, and vec_safe_length().

Referenced by initialize_node_lattices(), and want_remove_some_param_p().

◆ get_updated_indices()

void ipa_param_adjustments::get_updated_indices ( vec< int > * new_indices)
Fill NEW_INDICES with new indices of each surviving parameter or -1 for
those which do not survive.  Any parameter outside of lenght of the vector
does not survive.  There is currently no support for a parameter to be
copied to two distinct new parameters.   

References get_max_base_index(), ggc_alloc(), i, IPA_PARAM_OP_COPY, m_adj_params, and vec_safe_length().

Referenced by adjust_agg_replacement_values(), ipa_param_body_adjustments::common_initialization(), and ipcp_update_vr().

◆ init()

void ipa_param_adjustments::init ( vec< tree > * cur_params)
private

◆ method2func_p()

bool ipa_param_adjustments::method2func_p ( tree orig_type)
private
Return true if we have to change what has formerly been a method into a
function.   

References first_param_intact_p(), ggc_alloc(), and TREE_CODE.

Referenced by adjust_decl(), and build_new_function_type().

◆ modify_call()

gcall * ipa_param_adjustments::modify_call ( cgraph_edge * cs,
bool update_references,
hash_set< tree > * killed_ssas )
Modify actual arguments of a function call in statement currently belonging
to CS, and make it call CS->callee->decl.  Return the new statement that
replaced the old one.  When invoked, cfun and current_function_decl have to
be set to the caller.  When called from within tree-inline, KILLED_SSAs has
to contain the pointer to killed_new_ssa_names within the copy_body_data
structure and SSAs discovered to be useless (if LHS is removed) will be
added to it, otherwise it needs to be NULL.   

References build_aligned_type(), build_debug_expr_decl(), build_fold_addr_expr, build_int_cst(), cgraph_edge::call_stmt, cgraph_edge::callee, cfun, create_tmp_reg(), current_function_decl, symtab_node::decl, DECL_ARGUMENTS, DECL_CHAIN, decl_debug_args_insert(), DECL_MODE, DECL_ORIGIN, symbol_table::dump_file, dump_file, dump_flags, fold_build2_loc(), fold_convert_loc(), fold_convertible_p(), force_gimple_operand_gsi(), force_value_to_type(), gcc_assert, cgraph_node::get(), get_addr_base_and_unit_offset(), get_pointer_alignment_1(), ggc_alloc(), gimple_assign_cast_p(), gimple_assign_rhs1(), gimple_assign_set_lhs(), gimple_block(), gimple_build_assign(), gimple_build_call_vec(), gimple_build_debug_bind(), gimple_call_arg(), gimple_call_chain(), gimple_call_copy_flags(), gimple_call_fndecl(), gimple_call_lhs(), gimple_call_num_args(), gimple_call_set_chain(), gimple_call_set_lhs(), gimple_has_location(), gimple_in_ssa_p(), gimple_location(), gimple_move_vops(), gimple_set_block(), gimple_set_location(), gimple_set_vuse(), gimple_vuse(), gsi_for_stmt(), gsi_insert_before(), gsi_prev(), gsi_replace(), GSI_SAME_STMT, gsi_stmt(), i, int_const_binop(), ipa_edge_modifications, IPA_PARAM_OP_COPY, IPA_PARAM_OP_SPLIT, ipa_release_ssas_in_hash(), is_gimple_reg(), is_gimple_reg_type(), least_bit_hwi(), m_adj_params, m_always_copy_start, m_skip_return, make_ssa_name(), MAY_HAVE_DEBUG_BIND_STMTS, NULL, NULL_TREE, POINTER_TYPE_P, print_gimple_stmt(), ptr_type_node, purge_all_uses(), REF_REVERSE_STORAGE_ORDER, SET_DECL_MODE, SIGNED, SSA_NAME_DEF_STMT, symtab, TDF_DETAILS, wi::to_wide(), TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_ALIGN, unshare_expr(), useless_type_conversion_p(), vec_safe_iterate(), vec_safe_length(), and vec_safe_push().

◆ type_attribute_allowed_p()

bool ipa_param_adjustments::type_attribute_allowed_p ( tree name)
static
Return false if given attribute should prevent type adjustments.   

References ggc_alloc(), and is_attribute_p().

Referenced by compute_fn_summary().

Field Documentation

◆ m_adj_params

◆ m_always_copy_start

int ipa_param_adjustments::m_always_copy_start

◆ m_skip_return


The documentation for this class was generated from the following files: