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 )

◆ ipa_param_adjustments() [2/2]

ipa_param_adjustments::ipa_param_adjustments ( )

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(), 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

References build_adjusted_function_type(), fill_vector_of_new_param_types(), get_original_index(), 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().

◆ dump()

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

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

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

◆ 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 ( )
Return the maximum index in any IPA_PARAM_OP_COPY adjustment or -1 if there
is none.   

References ipa_adjusted_param::base_index, i, IPA_PARAM_OP_COPY, m_adj_params, ipa_adjusted_param::op, 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 ipa_adjusted_param::base_index, IPA_PARAM_OP_COPY, and ipa_adjusted_param::op.

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 ipa_adjusted_param::base_index, get_max_base_index(), i, IPA_PARAM_OP_COPY, m_adj_params, ipa_adjusted_param::op, 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 ipa_adjusted_param::base_index, get_max_base_index(), i, IPA_PARAM_OP_COPY, m_adj_params, ipa_adjusted_param::op, and vec_safe_length().

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

◆ init()

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

◆ method2func_p()

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

References first_param_intact_p(), 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 hash_set< KeyId, Lazy, Traits >::add(), ipa_adjusted_param::alias_ptr_type, ipa_edge_modification_info::always_copy_delta, ipa_adjusted_param::base_index, build_aligned_type(), build_debug_expr_decl(), build_fold_addr_expr, build_int_cst(), cgraph_edge::call_stmt, cgraph_edge::callee, cfun, cgraph_node::clone_of, create_tmp_reg(), current_function_decl, symtab_node::decl, DECL_ARGUMENTS, DECL_CHAIN, decl_debug_args_insert(), DECL_MODE, DECL_ORIGIN, dump_file, symbol_table::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(), cgraph_node::get_untransformed_body(), 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, ipa_edge_modification_info::index_map, 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, ipa_adjusted_param::op, ipa_edge_modification_info::pass_through_map, POINTER_TYPE_P, print_gimple_stmt(), ptr_type_node, purge_all_uses(), cgraph_node::record_stmt_references(), REF_REVERSE_STORAGE_ORDER, symtab_node::remove_stmt_references(), ipa_adjusted_param::reverse, SET_DECL_MODE, SIGNED, SSA_NAME_DEF_STMT, symtab, TDF_DETAILS, wi::to_wide(), TREE_CODE, TREE_OPERAND, TREE_TYPE, ipa_adjusted_param::type, TYPE_ALIGN, ipa_adjusted_param::unit_offset, 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)
Return false if given attribute should prevent type adjustments.   

References 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: