GCC Middle and Back End API Reference
gimple-fold.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "predict.h"
#include "ssa.h"
#include "cgraph.h"
#include "gimple-pretty-print.h"
#include "gimple-ssa-warn-access.h"
#include "gimple-ssa-warn-restrict.h"
#include "fold-const.h"
#include "stmt.h"
#include "expr.h"
#include "stor-layout.h"
#include "dumpfile.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "gimplify.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
#include "tree-object-size.h"
#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
#include "ipa-utils.h"
#include "tree-ssa-address.h"
#include "langhooks.h"
#include "gimplify-me.h"
#include "dbgcnt.h"
#include "builtins.h"
#include "tree-eh.h"
#include "gimple-match.h"
#include "gomp-constants.h"
#include "optabs-query.h"
#include "omp-general.h"
#include "tree-cfg.h"
#include "fold-const-call.h"
#include "stringpool.h"
#include "attribs.h"
#include "asan.h"
#include "diagnostic-core.h"
#include "intl.h"
#include "calls.h"
#include "tree-vector-builder.h"
#include "tree-ssa-strlen.h"
#include "varasm.h"
#include "internal-fn.h"
#include "gimple-range.h"

Data Structures

struct  clear_padding_struct
 

Enumerations

enum  strlen_range_kind { SRK_STRLEN , SRK_STRLENMAX , SRK_LENRANGE , SRK_INT_VALUE }
 

Functions

static bool get_range_strlen (tree, bitmap, strlen_range_kind, c_strlen_data *, unsigned)
 
static bool can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
 
tree create_tmp_reg_or_ssa_name (tree type, gimple *stmt)
 
tree canonicalize_constructor_val (tree cval, tree from_decl)
 
tree get_symbol_constant_value (tree sym)
 
static tree maybe_fold_reference (tree expr)
 
bool valid_gimple_rhs_p (tree expr)
 
static tree fold_gimple_assign (gimple_stmt_iterator *si)
 
void gsi_replace_with_seq_vops (gimple_stmt_iterator *si_p, gimple_seq stmts)
 
static void finish_update_gimple_call (gimple_stmt_iterator *si_p, gimple *new_stmt, gimple *stmt)
 
bool update_gimple_call (gimple_stmt_iterator *si_p, tree fn, int nargs,...)
 
static bool valid_gimple_call_p (tree expr)
 
void gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr)
 
void replace_call_with_value (gimple_stmt_iterator *gsi, tree val)
 
static void replace_call_with_call_and_fold (gimple_stmt_iterator *gsi, gimple *repl)
 
static bool var_decl_component_p (tree var)
 
static bool size_must_be_zero_p (tree size)
 
static bool gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, tree dest, tree src, enum built_in_function code)
 
static bool gimple_fold_builtin_bcmp (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_bcopy (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_bzero (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_memset (gimple_stmt_iterator *gsi, tree c, tree len)
 
static bool get_range_strlen_tree (tree arg, bitmap visited, strlen_range_kind rkind, c_strlen_data *pdata, unsigned eltsize)
 
bool get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize)
 
static tree get_maxval_strlen (tree arg, strlen_range_kind rkind, tree *nonstr=NULL)
 
static bool known_lower (gimple *stmt, tree len, tree size, bool strict=false)
 
static bool gimple_fold_builtin_strcpy (gimple_stmt_iterator *gsi, tree dest, tree src)
 
static bool gimple_fold_builtin_strncpy (gimple_stmt_iterator *gsi, tree dest, tree src, tree len)
 
static bool gimple_fold_builtin_strchr (gimple_stmt_iterator *gsi, bool is_strrchr)
 
static bool gimple_fold_builtin_strstr (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_strcat (gimple_stmt_iterator *gsi, tree dst, tree src)
 
static bool gimple_fold_builtin_strcat_chk (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_strncat (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_strncat_chk (gimple_stmt_iterator *gsi)
 
static tree gimple_load_first_char (location_t loc, tree str, gimple_seq *stmts)
 
static bool gimple_fold_builtin_string_compare (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_memchr (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_fputs (gimple_stmt_iterator *gsi, tree arg0, tree arg1, bool unlocked)
 
static bool gimple_fold_builtin_memory_chk (gimple_stmt_iterator *gsi, tree dest, tree src, tree len, tree size, enum built_in_function fcode)
 
static void dump_transformation (gcall *from, gcall *to)
 
static bool gimple_fold_builtin_stxcpy_chk (gimple_stmt_iterator *gsi, tree dest, tree src, tree size, enum built_in_function fcode)
 
static bool gimple_fold_builtin_stxncpy_chk (gimple_stmt_iterator *gsi, tree dest, tree src, tree len, tree size, enum built_in_function fcode)
 
static bool gimple_fold_builtin_stpcpy (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_snprintf_chk (gimple_stmt_iterator *gsi, enum built_in_function fcode)
 
static bool gimple_fold_builtin_sprintf_chk (gimple_stmt_iterator *gsi, enum built_in_function fcode)
 
bool gimple_fold_builtin_sprintf (gimple_stmt_iterator *gsi)
 
bool gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_fprintf (gimple_stmt_iterator *gsi, tree fp, tree fmt, tree arg, enum built_in_function fcode)
 
static bool gimple_fold_builtin_printf (gimple_stmt_iterator *gsi, tree fmt, tree arg, enum built_in_function fcode)
 
static bool gimple_fold_builtin_strlen (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin_acc_on_device (gimple_stmt_iterator *gsi, tree arg0)
 
static bool gimple_fold_builtin_realloc (gimple_stmt_iterator *gsi)
 
static void clear_padding_flush (clear_padding_struct *buf, bool full)
 
static void clear_padding_add_padding (clear_padding_struct *buf, HOST_WIDE_INT padding_bytes)
 
static void clear_padding_type (clear_padding_struct *, tree, HOST_WIDE_INT, bool)
 
static void clear_padding_union (clear_padding_struct *buf, tree type, HOST_WIDE_INT sz, bool for_auto_init)
 
static bool clear_padding_real_needs_padding_p (tree type)
 
static bool clear_padding_bitint_needs_padding_p (tree type)
 
bool clear_padding_type_may_have_padding_p (tree type)
 
static void clear_padding_emit_loop (clear_padding_struct *buf, tree type, tree end, bool for_auto_init)
 
void clear_type_padding_in_mask (tree type, unsigned char *mask)
 
static bool gimple_fold_builtin_clear_padding (gimple_stmt_iterator *gsi)
 
static bool gimple_fold_builtin (gimple_stmt_iterator *gsi)
 
static tree fold_internal_goacc_dim (const gimple *call)
 
bool optimize_atomic_compare_exchange_p (gimple *stmt)
 
void fold_builtin_atomic_compare_exchange (gimple_stmt_iterator *gsi)
 
bool arith_overflowed_p (enum tree_code code, const_tree type, const_tree arg0, const_tree arg1)
 
static tree gimple_fold_partial_load_store_mem_ref (gcall *call, tree vectype, bool mask_p)
 
static bool gimple_fold_partial_load (gimple_stmt_iterator *gsi, gcall *call, bool mask_p)
 
static bool gimple_fold_partial_store (gimple_stmt_iterator *gsi, gcall *call, bool mask_p)
 
static bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
 
static bool has_use_on_stmt (tree name, gimple *stmt)
 
static bool replace_stmt_with_simplification (gimple_stmt_iterator *gsi, gimple_match_op *res_op, gimple_seq *seq, bool inplace)
 
static bool maybe_canonicalize_mem_ref_addr (tree *t, bool is_debug=false)
 
static bool fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree(*valueize)(tree))
 
tree no_follow_ssa_edges (tree)
 
tree follow_single_use_edges (tree val)
 
tree follow_all_ssa_edges (tree val)
 
bool fold_stmt (gimple_stmt_iterator *gsi)
 
bool fold_stmt (gimple_stmt_iterator *gsi, tree(*valueize)(tree))
 
bool fold_stmt_inplace (gimple_stmt_iterator *gsi)
 
static tree canonicalize_bool (tree expr, bool invert)
 
static bool same_bool_comparison_p (const_tree expr, enum tree_code code, const_tree op1, const_tree op2)
 
static bool same_bool_result_p (const_tree op1, const_tree op2)
 
static tree and_comparisons_1 (tree type, enum tree_code code1, tree op1a, tree op1b, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree and_var_with_comparison (tree type, tree var, bool invert, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree and_var_with_comparison_1 (tree type, gimple *stmt, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree or_comparisons_1 (tree, enum tree_code code1, tree op1a, tree op1b, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree or_var_with_comparison (tree, tree var, bool invert, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree or_var_with_comparison_1 (tree, gimple *stmt, enum tree_code code2, tree op2a, tree op2b, basic_block)
 
static tree follow_outer_ssa_edges (tree val)
 
static tree maybe_fold_comparisons_from_match_pd (tree type, enum tree_code code, enum tree_code code1, tree op1a, tree op1b, enum tree_code code2, tree op2a, tree op2b, basic_block outer_cond_bb)
 
tree maybe_fold_and_comparisons (tree type, enum tree_code code1, tree op1a, tree op1b, enum tree_code code2, tree op2a, tree op2b, basic_block outer_cond_bb)
 
tree maybe_fold_or_comparisons (tree type, enum tree_code code1, tree op1a, tree op1b, enum tree_code code2, tree op2a, tree op2b, basic_block outer_cond_bb)
 
tree gimple_fold_stmt_to_constant_1 (gimple *stmt, tree(*valueize)(tree), tree(*gvalueize)(tree))
 
tree gimple_fold_stmt_to_constant (gimple *stmt, tree(*valueize)(tree))
 
static tree get_base_constructor (tree base, poly_int64 *bit_offset, tree(*valueize)(tree))
 
static tree fold_array_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size, tree from_decl, unsigned HOST_WIDE_INT *suboff)
 
static tree fold_nonarray_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size, tree from_decl, unsigned HOST_WIDE_INT *suboff)
 
tree fold_ctor_reference (tree type, tree ctor, const poly_uint64 &poly_offset, const poly_uint64 &poly_size, tree from_decl, unsigned HOST_WIDE_INT *suboff)
 
tree fold_const_aggregate_ref_1 (tree t, tree(*valueize)(tree))
 
tree fold_const_aggregate_ref (tree t)
 
tree gimple_get_virt_method_for_vtable (HOST_WIDE_INT token, tree v, unsigned HOST_WIDE_INT offset, bool *can_refer)
 
tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo, bool *can_refer)
 
tree gimple_fold_indirect_ref (tree t)
 
bool arith_code_with_undefined_signed_overflow (tree_code code)
 
static gimple_seq rewrite_to_defined_overflow (gimple_stmt_iterator *gsi, gimple *stmt, bool in_place)
 
void rewrite_to_defined_overflow (gimple_stmt_iterator *gsi)
 
gimple_seq rewrite_to_defined_overflow (gimple *stmt)
 
static tree gimple_build_valueize (tree op)
 
static void gimple_build_insert_seq (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, gimple_seq seq)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, enum tree_code code, tree type, tree op0)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, enum tree_code code, tree type, tree op0, tree op1)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, enum tree_code code, tree type, tree op0, tree op1, tree op2)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, combined_fn fn, tree type)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, combined_fn fn, tree type, tree arg0)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, combined_fn fn, tree type, tree arg0, tree arg1)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, combined_fn fn, tree type, tree arg0, tree arg1, tree arg2)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, code_helper code, tree type, tree op0)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, code_helper code, tree type, tree op0, tree op1)
 
tree gimple_build (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, code_helper code, tree type, tree op0, tree op1, tree op2)
 
tree gimple_convert (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, tree type, tree op)
 
tree gimple_convert_to_ptrofftype (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, tree op)
 
tree gimple_build_vector_from_val (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, tree type, tree op)
 
tree gimple_build_vector (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, tree_vector_builder *builder)
 
tree gimple_build_round_up (gimple_stmt_iterator *gsi, bool before, gsi_iterator_update update, location_t loc, tree type, tree old_size, unsigned HOST_WIDE_INT align)
 
static bool gimple_assign_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, int depth)
 
static bool gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, int depth)
 
static bool gimple_phi_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, int depth)
 
bool gimple_stmt_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p, int depth)
 
static bool gimple_assign_integer_valued_real_p (gimple *stmt, int depth)
 
static bool gimple_call_integer_valued_real_p (gimple *stmt, int depth)
 
static bool gimple_phi_integer_valued_real_p (gimple *stmt, int depth)
 
bool gimple_stmt_integer_valued_real_p (gimple *stmt, int depth)
 

Variables

static constexpr size_t clear_padding_unit = MAX_BITSIZE_MODE_ANY_MODE / BITS_PER_UNIT
 
static const size_t clear_padding_buf_size = 32 * clear_padding_unit
 
static basic_block fosa_bb
 
static vec< std::pair< tree, flow_sensitive_info_storage > > * fosa_unwind
 

Enumeration Type Documentation

◆ strlen_range_kind

Statement simplification on GIMPLE.
   Copyright (C) 2010-2024 Free Software Foundation, Inc.
   Split out from tree-ssa-ccp.cc.

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/>.   
Enumerator
SRK_STRLEN 
SRK_STRLENMAX 
SRK_LENRANGE 
SRK_INT_VALUE 

Function Documentation

◆ and_comparisons_1()

static tree and_comparisons_1 ( tree type,
enum tree_code code1,
tree op1a,
tree op1b,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Forward declarations for some mutually recursive functions.   
Try to simplify the AND of two comparisons defined by
(OP1A CODE1 OP1B) and (OP2A CODE2 OP2B), respectively.
If this can be done without constructing an intermediate value,
return the resulting tree; otherwise NULL_TREE is returned.
This function is deliberately asymmetric as it recurses on SSA_DEFs
in the first comparison but not the second.   

References and_var_with_comparison(), boolean_false_node, boolean_type_node, CDI_DOMINATORS, combine_comparisons(), dom_info_available_p(), dominated_by_p(), fold_build2, ggc_alloc(), gimple_bb(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), i, integer_nonzerop(), integer_onep(), integer_zerop(), NULL_TREE, operand_equal_p(), same_bool_comparison_p(), same_bool_result_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, swap_tree_comparison(), TREE_CODE, TREE_TYPE, truth_type_for(), and UNKNOWN_LOCATION.

Referenced by and_var_with_comparison_1(), and maybe_fold_and_comparisons().

◆ and_var_with_comparison()

static tree and_var_with_comparison ( tree type,
tree var,
bool invert,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Helper function for and_comparisons_1:  try to simplify the AND of the
ssa variable VAR with the comparison specified by (OP2A CODE2 OP2B).
If INVERT is true, invert the value of the VAR before doing the AND.
Return NULL_EXPR if we can't simplify this to a single expression.   

References and_var_with_comparison_1(), canonicalize_bool(), ggc_alloc(), invert_tree_comparison(), is_gimple_assign(), NULL_TREE, or_var_with_comparison_1(), and SSA_NAME_DEF_STMT.

Referenced by and_comparisons_1(), and and_var_with_comparison_1().

◆ and_var_with_comparison_1()

static tree and_var_with_comparison_1 ( tree type,
gimple * stmt,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Try to simplify the AND of the ssa variable defined by the assignment
STMT with the comparison specified by (OP2A CODE2 OP2B).
Return NULL_EXPR if we can't simplify this to a single expression.   

References and_comparisons_1(), and_var_with_comparison(), boolean_false_node, boolean_true_node, ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), integer_nonzerop(), integer_onep(), integer_zerop(), is_gimple_assign(), maybe_fold_and_comparisons(), NULL_TREE, same_bool_result_p(), SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, and TREE_TYPE.

Referenced by and_var_with_comparison(), and or_var_with_comparison().

◆ arith_code_with_undefined_signed_overflow()

bool arith_code_with_undefined_signed_overflow ( tree_code code)
Return true if CODE is an operation that when operating on signed
integer types involves undefined behavior on overflow and the
operation can be expressed with unsigned arithmetic.   

References ggc_alloc().

Referenced by final_value_replacement_loop(), if_convertible_gimple_assign_stmt_p(), move_computations_worker(), predicate_statements(), split_loop(), and update_range_test().

◆ arith_overflowed_p()

bool arith_overflowed_p ( enum tree_code code,
const_tree type,
const_tree arg0,
const_tree arg1 )
Return true if ARG0 CODE ARG1 in infinite signed precision operation
doesn't fit into TYPE.  The test for overflow should be regardless of
-fwrapv, and even for unsigned types.   

References wi::add(), gcc_unreachable, ggc_alloc(), wi::min_precision(), wi::mul(), wi::neg_p(), wi::sub(), TYPE_PRECISION, TYPE_SIGN, and UNSIGNED.

Referenced by check_for_binary_op_overflow(), fold_builtin_arith_overflow(), fold_const_call(), fold_const_call(), and gimple_fold_call().

◆ can_refer_decl_in_current_unit_p()

static bool can_refer_decl_in_current_unit_p ( tree decl,
tree from_decl )
static
Return true when DECL can be referenced from current unit.
FROM_DECL (if non-null) specify constructor of variable DECL was taken from.
We can get declarations that are not possible to reference for various
reasons:

  1) When analyzing C++ virtual tables.
     C++ virtual tables do have known constructors even
     when they are keyed to other compilation unit.
     Those tables can contain pointers to methods and vars
     in other units.  Those methods have both STATIC and EXTERNAL
     set.
  2) In WHOPR mode devirtualization might lead to reference
     to method that was partitioned elsehwere.
     In this case we have static VAR_DECL or FUNCTION_DECL
     that has no corresponding callgraph/varpool node
     declaring the body.  
  3) COMDAT functions referred by external vtables that
     we devirtualize only during final compilation stage.
     At this time we already decided that we will not output
     the function body and thus we can't reference the symbol
     directly.   

References DECL_ABSTRACT_P, DECL_COMDAT, DECL_EXTERNAL, DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, symbol_table::function_flags_ready, symtab_node::get(), varpool_node::get(), ggc_alloc(), cgraph_node::inlined_to, NULL, symtab, TREE_PUBLIC, TREE_STATIC, VAR_OR_FUNCTION_DECL_P, VAR_P, and VISIBILITY_DEFAULT.

Referenced by canonicalize_constructor_val(), and gimple_get_virt_method_for_vtable().

◆ canonicalize_bool()

static tree canonicalize_bool ( tree expr,
bool invert )
static
Canonicalize and possibly invert the boolean EXPR; return NULL_TREE 
if EXPR is null or we don't know how.
If non-null, the result always has boolean type.   

References boolean_false_node, boolean_true_node, boolean_type_node, build_int_cst(), COMPARISON_CLASS_P, expr, fold_build2, ggc_alloc(), integer_nonzerop(), integer_zerop(), invert_tree_comparison(), NULL_TREE, TREE_CODE, TREE_OPERAND, and TREE_TYPE.

Referenced by and_var_with_comparison(), and or_var_with_comparison().

◆ canonicalize_constructor_val()

tree canonicalize_constructor_val ( tree cval,
tree from_decl )

◆ clear_padding_add_padding()

◆ clear_padding_bitint_needs_padding_p()

static bool clear_padding_bitint_needs_padding_p ( tree type)
static
_BitInt has padding bits if it isn't extended in the ABI and has smaller
precision than bits in limb or corresponding number of limbs.   

References bitint_info::abi_limb_mode, bitint_info::extended, gcc_assert, GET_MODE_PRECISION(), ggc_alloc(), bitint_info::limb_mode, targetm, and TYPE_PRECISION.

Referenced by clear_padding_type_may_have_padding_p().

◆ clear_padding_emit_loop()

◆ clear_padding_flush()

◆ clear_padding_real_needs_padding_p()

static bool clear_padding_real_needs_padding_p ( tree type)
static
The only known floating point formats with padding bits are the
IEEE extended ones.   

References ggc_alloc(), REAL_MODE_FORMAT, and TYPE_MODE.

Referenced by clear_padding_type(), and clear_padding_type_may_have_padding_p().

◆ clear_padding_type()

static void clear_padding_type ( clear_padding_struct * buf,
tree type,
HOST_WIDE_INT sz,
bool for_auto_init )
static
Clear padding bits for TYPE.  Called recursively from
gimple_fold_builtin_clear_padding.  If FOR_AUTO_INIT is true,
the __builtin_clear_padding is not called by the end user,
instead, it's inserted by the compiler to initialize the
paddings of automatic variable.  Therefore, we should not
emit the error messages for flexible array members to confuse
the end user.   

References bitint_info::abi_limb_mode, clear_padding_struct::align, clear_padding_struct::base, bitint_info::big_endian, clear_padding_struct::buf, build_nonstandard_integer_type(), build_pointer_type(), lang_hooks_for_types::classtype_as_base, clear_padding_struct::clear_in_mask, clear_padding_add_padding(), clear_padding_buf_size, clear_padding_emit_loop(), clear_padding_flush(), clear_padding_real_needs_padding_p(), clear_padding_type(), clear_padding_type_may_have_padding_p(), clear_padding_union(), clear_padding_unit, COMPLETE_TYPE_P, create_tmp_var, DECL_BIT_FIELD, DECL_CHAIN, DECL_FIELD_BIT_OFFSET, DECL_PADDING_P, DECL_SIZE_UNIT, end(), error_at(), error_mark_node, bitint_info::extended, g, gcc_assert, GET_MODE_PRECISION(), ggc_alloc(), gimple_build_assign(), gimple_set_location(), clear_padding_struct::gsi, gsi_insert_before(), GSI_SAME_STMT, i, int_byte_position(), int_size_in_bytes(), is_empty_type(), bitint_info::limb_mode, clear_padding_struct::loc, make_ssa_name(), wi::mask(), native_encode_expr(), native_interpret_real(), NULL, NULL_TREE, clear_padding_struct::off, ROUND_UP, clear_padding_struct::size, size_int, sorry_at(), clear_padding_struct::sz, targetm, poly_int< N, C >::to_constant(), TREE_CODE, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_ALIGN, TYPE_FIELDS, TYPE_PRECISION, TYPE_VECTOR_SUBPARTS(), lang_hooks::types, clear_padding_struct::union_ptr, and wide_int_to_tree().

Referenced by clear_padding_emit_loop(), clear_padding_type(), clear_padding_union(), clear_type_padding_in_mask(), and gimple_fold_builtin_clear_padding().

◆ clear_padding_type_may_have_padding_p()

◆ clear_padding_union()

◆ clear_type_padding_in_mask()

◆ create_tmp_reg_or_ssa_name()

tree create_tmp_reg_or_ssa_name ( tree type,
gimple * stmt )
Create a temporary for TYPE for a statement STMT.  If the current function
is in SSA form, a SSA name is created.  Otherwise a temporary register
is made.   

References cfun, create_tmp_reg(), gimple_in_ssa_p(), and make_ssa_name().

Referenced by copy_bb(), gimple_build(), gimple_build(), gimple_build(), gimple_build(), gimple_build(), gimple_build(), gimple_build(), gimple_fold_builtin_memory_op(), gimple_fold_builtin_strcat(), gimple_fold_builtin_strchr(), gimple_fold_builtin_string_compare(), and gimple_load_first_char().

◆ dump_transformation()

static void dump_transformation ( gcall * from,
gcall * to )
static
Print a message in the dump file recording transformation of FROM to TO.   

References dump_enabled_p(), dump_printf_loc(), gimple_call_fn(), and MSG_OPTIMIZED_LOCATIONS.

Referenced by gimple_fold_builtin_stxcpy_chk(), and gimple_fold_builtin_stxncpy_chk().

◆ finish_update_gimple_call()

static void finish_update_gimple_call ( gimple_stmt_iterator * si_p,
gimple * new_stmt,
gimple * stmt )
static
Helper function for update_gimple_call and
gimplify_and_update_call_from_tree.  A GIMPLE_CALL STMT is being replaced
with GIMPLE_CALL NEW_STMT.   

References ggc_alloc(), gimple_block(), gimple_call_lhs(), gimple_call_set_lhs(), gimple_location(), gimple_move_vops(), gimple_set_block(), gimple_set_location(), gsi_replace(), NULL_TREE, SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by gimplify_and_update_call_from_tree(), and update_gimple_call().

◆ fold_array_ctor_reference()

static tree fold_array_ctor_reference ( tree type,
tree ctor,
unsigned HOST_WIDE_INT offset,
unsigned HOST_WIDE_INT size,
tree from_decl,
unsigned HOST_WIDE_INT * suboff )
static
CTOR is a CONSTRUCTOR of an array or vector type.  Fold a reference of SIZE
bits to the memory at bit OFFSET.  If non-null, TYPE is the expected type of
the reference; otherwise the type of the referenced element is used instead.
When SIZE is zero, attempt to fold a reference to the entire element OFFSET
refers to.  Increment *SUBOFF by the bit offset of the accessed element.   

References build_zero_cst(), wi::cmpu(), CONSTANT_CLASS_P, CONSTRUCTOR_ELT, CONSTRUCTOR_NELTS, fold_ctor_reference(), get_array_ctor_element_at_index(), ggc_alloc(), constructor_elt::index, native_encode_expr(), native_interpret_expr(), NULL_TREE, offset, wi::to_offset(), TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_DOMAIN, TYPE_MIN_VALUE, TYPE_SIZE_UNIT, wi::udiv_trunc(), wi::umax(), and constructor_elt::value.

Referenced by fold_ctor_reference().

◆ fold_builtin_atomic_compare_exchange()

◆ fold_const_aggregate_ref()

◆ fold_const_aggregate_ref_1()

◆ fold_ctor_reference()

tree fold_ctor_reference ( tree type,
tree ctor,
const poly_uint64 & poly_offset,
const poly_uint64 & poly_size,
tree from_decl,
unsigned HOST_WIDE_INT * suboff )
CTOR is a value initializing memory.  Fold a reference of TYPE and
bit size POLY_SIZE to the memory at bit POLY_OFFSET.  When POLY_SIZE
is zero, attempt to fold a reference to the entire subobject
which OFFSET refers to.  This is used when folding accesses to
string members of aggregates.  When non-null, set *SUBOFF to
the bit offset of the accessed subobject.   

References AGGREGATE_TYPE_P, can_native_interpret_type_p(), canonicalize_constructor_val(), CONSTANT_CLASS_P, fold_array_ctor_reference(), fold_nonarray_ctor_reference(), fold_unary, ggc_alloc(), INT_MAX, known_eq, native_encode_expr(), native_encode_initializer(), native_interpret_expr(), NULL_TREE, offset, STRIP_USELESS_TYPE_CONVERSION, wi::to_poly_widest(), TREE_CODE, TREE_TYPE, TYPE_REVERSE_STORAGE_ORDER, TYPE_SIZE, unshare_expr(), and useless_type_conversion_p().

Referenced by constant_byte_string(), fold_array_ctor_reference(), fold_const_aggregate_ref_1(), fold_nonarray_ctor_reference(), and fully_constant_vn_reference_p().

◆ fold_gimple_assign()

◆ fold_internal_goacc_dim()

static tree fold_internal_goacc_dim ( const gimple * call)
static
Transform IFN_GOACC_DIM_SIZE and IFN_GOACC_DIM_POS internal
function calls to constants, where possible.   

References build_int_cst(), current_function_decl, ggc_alloc(), gimple_call_internal_fn(), gimple_call_lhs(), NULL_TREE, oacc_get_fn_dim_size(), oacc_get_ifn_dim_arg(), and TREE_TYPE.

Referenced by gimple_fold_call().

◆ fold_nonarray_ctor_reference()

static tree fold_nonarray_ctor_reference ( tree type,
tree ctor,
unsigned HOST_WIDE_INT offset,
unsigned HOST_WIDE_INT size,
tree from_decl,
unsigned HOST_WIDE_INT * suboff )
static
CTOR is a CONSTRUCTOR of a record or union type.  Fold a reference of SIZE
bits to the memory at bit OFFSET.  If non-null, TYPE is the expected type of
the reference; otherwise the type of the referenced member is used instead.
When SIZE is zero, attempt to fold a reference to the entire member OFFSET
refers to.  Increment *SUBOFF by the bit offset of the accessed member.   

References build_zero_cst(), wi::cmps(), CONSTRUCTOR_ELTS, DECL_BIT_FIELD, DECL_FIELD_BIT_OFFSET, DECL_FIELD_OFFSET, DECL_SIZE, fold_ctor_reference(), FOR_EACH_CONSTRUCTOR_ELT, gcc_assert, GET_MODE_BITSIZE(), ggc_alloc(), INTEGRAL_TYPE_P, wi::lts_p(), NULL_TREE, offset, SCALAR_INT_TYPE_MODE, wi::to_offset(), TREE_CODE, TREE_TYPE, and TYPE_SIZE.

Referenced by fold_ctor_reference().

◆ fold_stmt() [1/2]

bool fold_stmt ( gimple_stmt_iterator * gsi)

◆ fold_stmt() [2/2]

bool fold_stmt ( gimple_stmt_iterator * gsi,
tree(*)(tree) valueize )

References fold_stmt_1(), and ggc_alloc().

◆ fold_stmt_1()

static bool fold_stmt_1 ( gimple_stmt_iterator * gsi,
bool inplace,
tree(*)(tree) valueize )
static
Worker for both fold_stmt and fold_stmt_inplace.  The INPLACE argument
distinguishes both cases.   

References associated_internal_fn(), build_int_cst(), changed, commutative_ternary_tree_code(), commutative_tree_code(), first_commutative_argument(), fold_convert, fold_defer_overflow_warnings(), fold_gimple_assign(), fold_undefer_overflow_warnings(), get_gimple_rhs_num_ops(), ggc_alloc(), gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_assign_lhs(), gimple_assign_lhs_ptr(), gimple_assign_rhs1(), gimple_assign_rhs1_ptr(), gimple_assign_rhs2(), gimple_assign_rhs_class(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), gimple_assign_set_rhs2(), gimple_assign_set_rhs_code(), gimple_assign_set_rhs_from_tree(), gimple_assign_set_rhs_with_ops(), gimple_call_arg(), gimple_call_arg_ptr(), gimple_call_combined_fn(), gimple_call_lhs_ptr(), gimple_call_num_args(), gimple_call_set_arg(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_debug_bind_get_value(), gimple_debug_bind_get_value_ptr(), gimple_debug_bind_p(), gimple_debug_bind_set_value(), gimple_fold_call(), gimple_num_ops(), gimple_return_retval(), gimple_return_set_retval(), gimple_seq_discard(), gimple_simplify(), GIMPLE_SINGLE_RHS, gsi_stmt(), i, integer_onep(), integer_zerop(), is_gimple_assign(), may_propagate_copy(), maybe_canonicalize_mem_ref_addr(), maybe_fold_reference(), NULL, REFERENCE_CLASS_P, replace_stmt_with_simplification(), sizetype, swap_tree_comparison(), tcc_comparison, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, tree_swap_operands_p(), TREE_TYPE, TREE_VALUE, TYPE_PRECISION, useless_type_conversion_p(), and warning_suppressed_p().

Referenced by fold_stmt(), fold_stmt(), and fold_stmt_inplace().

◆ fold_stmt_inplace()

bool fold_stmt_inplace ( gimple_stmt_iterator * gsi)
Perform the minimal folding on statement *GSI.  Only operations like
*&x created by constant propagation are handled.  The statement cannot
be replaced with a new one.  Return true if the statement was
changed, false otherwise.
The statement *GSI should be in valid gimple form but may
be in unfolded state as resulting from for example constant propagation
which can produce *&x = 0.   

References changed, fold_stmt_1(), gcc_assert, gsi_stmt(), and no_follow_ssa_edges().

Referenced by create_expression_by_pieces(), forward_propagate_addr_expr_1(), insert_debug_temp_for_var_def(), optimize_recip_sqrt(), replace_reciprocal(), replace_reciprocal_squares(), and update_ops().

◆ follow_all_ssa_edges()

◆ follow_outer_ssa_edges()

◆ follow_single_use_edges()

◆ get_base_constructor()

static tree get_base_constructor ( tree base,
poly_int64 * bit_offset,
tree(*)(tree) valueize )
static
The following set of functions are supposed to fold references using
their constant initializers.   
See if we can find constructor defining value of BASE.
When we know the consructor with constant offset (such as
base is array[40] and we do know constructor of array), then
BIT_OFFSET is adjusted accordingly.

As a special case, return error_mark_node when constructor
is not explicitly available, but it is known to be zero
such as 'static const int a;'.   

References CONSTANT_CLASS_P, ctor_for_folding(), error_mark_node, get_base_constructor(), get_ref_base_and_extent(), ggc_alloc(), mem_ref_offset(), NULL_TREE, TREE_CODE, and TREE_OPERAND.

Referenced by fold_const_aggregate_ref_1(), and get_base_constructor().

◆ get_maxval_strlen()

static tree get_maxval_strlen ( tree arg,
strlen_range_kind rkind,
tree * nonstr = NULL )
static
Return the maximum value for ARG given RKIND (see strlen_range_kind).
For ARG of pointer types, NONSTR indicates if the caller is prepared
to handle unterminated strings.   For integer ARG and when RKIND ==
SRK_INT_VALUE, NONSTR must be null.

If an unterminated array is discovered and our caller handles
unterminated arrays, then bubble up the offending DECL and
return the maximum size.  Otherwise return NULL.   

References gcc_assert, get_range_strlen(), ggc_alloc(), integer_all_onesp(), INTEGRAL_TYPE_P, NULL, NULL_TREE, SRK_INT_VALUE, TREE_TYPE, and visited.

Referenced by gimple_fold_builtin_fputs(), gimple_fold_builtin_memory_chk(), gimple_fold_builtin_snprintf(), gimple_fold_builtin_snprintf_chk(), gimple_fold_builtin_sprintf(), gimple_fold_builtin_strcat(), gimple_fold_builtin_strcpy(), gimple_fold_builtin_strncpy(), gimple_fold_builtin_stxcpy_chk(), and gimple_fold_builtin_stxncpy_chk().

◆ get_range_strlen() [1/2]

bool get_range_strlen ( tree arg,
c_strlen_data * pdata,
unsigned eltsize )
Try to obtain the range of the lengths of the string(s) referenced
by ARG, or the size of the largest array ARG refers to if the range
of lengths cannot be determined, and store all in *PDATA which must
be zero-initialized on input except PDATA->MAXBOUND may be set to
a non-null tree node other than INTEGER_CST to request to have it
set to the length of the longest string in a PHI.  ELTSIZE is
the expected size of the string element in bytes: 1 for char and
some power of 2 for wide characters.
Return true if the range [PDATA->MINLEN, PDATA->MAXLEN] is suitable
for optimization.  Returning false means that a nonzero PDATA->MINLEN
doesn't reflect the true lower bound of the range when PDATA->MAXLEN
is -1 (in that case, the actual range is indeterminate, i.e.,
[0, PTRDIFF_MAX - 2].   

References build_all_ones_cst(), get_range_strlen(), ggc_alloc(), integer_all_onesp(), size_type_node, SRK_LENRANGE, ssize_int, and visited.

◆ get_range_strlen() [2/2]

static bool get_range_strlen ( tree arg,
bitmap visited,
strlen_range_kind rkind,
c_strlen_data * pdata,
unsigned eltsize )
static
For an ARG referencing one or more strings, try to obtain the range
of their lengths, or the size of the largest array ARG referes to if
the range of lengths cannot be determined, and store all in *PDATA.
For an integer ARG (when RKIND == SRK_INT_VALUE), try to determine
the maximum constant value.
If ARG is an SSA_NAME, follow its use-def chains.  When RKIND ==
SRK_STRLEN, then if PDATA->MAXLEN is not equal to the determined
length or if we are unable to determine the length, return false.
VISITED is a bitmap of visited variables.
RKIND determines the kind of value or range to obtain (see
strlen_range_kind).
Set PDATA->DECL if ARG refers to an unterminated constant array.
On input, set ELTSIZE to 1 for normal single byte character strings,
and either 2 or 4 for wide characer strings (the size of wchar_t).
Return true if *PDATA was successfully populated and false otherwise.   

References bitmap_set_bit, build_all_ones_cst(), get_range_strlen(), get_range_strlen_tree(), ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_assign_unary_nop_p(), gimple_phi_arg(), gimple_phi_num_args(), gimple_phi_result(), i, name_registered_for_update_p(), size_type_node, SRK_LENRANGE, SSA_NAME_DEF_STMT, SSA_NAME_VERSION, TREE_CODE, and visited.

Referenced by check_access(), check_strncat_sizes(), get_maxval_strlen(), get_range_strlen(), get_range_strlen(), get_range_strlen_dynamic(), get_range_strlen_tree(), gimple_fold_builtin_strlen(), maybe_diag_stxncpy_trunc(), maybe_trim_memstar_call(), and maybe_warn_nonstring_arg().

◆ get_range_strlen_tree()

◆ get_symbol_constant_value()

tree get_symbol_constant_value ( tree sym)

◆ gimple_assign_integer_valued_real_p()

static bool gimple_assign_integer_valued_real_p ( gimple * stmt,
int depth )
static
Return true if the floating-point value computed by assignment STMT
is known to have an integer value.  We also allow +Inf, -Inf and NaN
to be considered integer values. Return false for signaling NaN.

DEPTH is the current nesting depth of the query.   

References gcc_unreachable, get_gimple_rhs_class(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, GIMPLE_INVALID_RHS, GIMPLE_SINGLE_RHS, GIMPLE_TERNARY_RHS, GIMPLE_UNARY_RHS, integer_valued_real_binary_p(), integer_valued_real_single_p(), and integer_valued_real_unary_p().

Referenced by gimple_stmt_integer_valued_real_p().

◆ gimple_assign_nonnegative_warnv_p()

static bool gimple_assign_nonnegative_warnv_p ( gimple * stmt,
bool * strict_overflow_p,
int depth )
static
Return true if the result of assignment STMT is known to be non-negative.
If the return value is based on the assumption that signed overflow is
undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P.  DEPTH is the current nesting depth of the query.   

References gcc_unreachable, get_gimple_rhs_class(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, GIMPLE_INVALID_RHS, GIMPLE_SINGLE_RHS, GIMPLE_TERNARY_RHS, GIMPLE_UNARY_RHS, tree_binary_nonnegative_warnv_p(), tree_single_nonnegative_warnv_p(), TREE_TYPE, and tree_unary_nonnegative_warnv_p().

Referenced by gimple_stmt_nonnegative_warnv_p().

◆ gimple_build() [1/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
code_helper code,
tree type,
tree op0 )
Build CODE (OP0) with a result of type TYPE (or no result if TYPE is
void) with location LOC, simplifying it first if possible.  Returns the
built expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References ggc_alloc(), gimple_build(), and code_helper::is_tree_code().

◆ gimple_build() [2/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
code_helper code,
tree type,
tree op0,
tree op1 )
Build CODE (OP0, OP1) with a result of type TYPE (or no result if TYPE is
void) with location LOC, simplifying it first if possible.  Returns the
built expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References ggc_alloc(), gimple_build(), and code_helper::is_tree_code().

◆ gimple_build() [3/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
code_helper code,
tree type,
tree op0,
tree op1,
tree op2 )
Build CODE (OP0, OP1, OP2) with a result of type TYPE (or no result if TYPE
is void) with location LOC, simplifying it first if possible.  Returns the
built expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References ggc_alloc(), gimple_build(), and code_helper::is_tree_code().

◆ gimple_build() [4/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
combined_fn fn,
tree type )
Build the call FN () with a result of type TYPE (or no result if TYPE is
void) with a location LOC.  Returns the built expression value (or NULL_TREE
if TYPE is void) inserting any new statements at GSI honoring BEFORE
and UPDATE.   

References as_builtin_fn(), as_internal_fn(), builtin_decl_implicit(), create_tmp_reg_or_ssa_name(), ggc_alloc(), gimple_build_call(), gimple_build_call_internal(), gimple_build_insert_seq(), gimple_call_set_lhs(), gimple_seq_add_stmt_without_update(), gimple_set_location(), internal_fn_p(), NULL, NULL_TREE, and VOID_TYPE_P.

◆ gimple_build() [5/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
combined_fn fn,
tree type,
tree arg0 )
Build the call FN (ARG0) with a result of type TYPE
(or no result if TYPE is void) with location LOC,
simplifying it first if possible.  Returns the built
expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References as_builtin_fn(), as_internal_fn(), builtin_decl_implicit(), create_tmp_reg_or_ssa_name(), ggc_alloc(), gimple_build_call(), gimple_build_call_internal(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_call_set_lhs(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), internal_fn_p(), NULL, and VOID_TYPE_P.

◆ gimple_build() [6/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
combined_fn fn,
tree type,
tree arg0,
tree arg1 )
Build the call FN (ARG0, ARG1) with a result of type TYPE
(or no result if TYPE is void) with location LOC,
simplifying it first if possible.  Returns the built
expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References as_builtin_fn(), as_internal_fn(), builtin_decl_implicit(), create_tmp_reg_or_ssa_name(), ggc_alloc(), gimple_build_call(), gimple_build_call_internal(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_call_set_lhs(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), internal_fn_p(), NULL, and VOID_TYPE_P.

◆ gimple_build() [7/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
combined_fn fn,
tree type,
tree arg0,
tree arg1,
tree arg2 )
Build the call FN (ARG0, ARG1, ARG2) with a result of type TYPE
(or no result if TYPE is void) with location LOC,
simplifying it first if possible.  Returns the built
expression value (or NULL_TREE if TYPE is void) inserting any new
statements at GSI honoring BEFORE and UPDATE.   

References as_builtin_fn(), as_internal_fn(), builtin_decl_implicit(), create_tmp_reg_or_ssa_name(), ggc_alloc(), gimple_build_call(), gimple_build_call_internal(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_call_set_lhs(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), internal_fn_p(), NULL, and VOID_TYPE_P.

◆ gimple_build() [8/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
enum tree_code code,
tree type,
tree op0 )
Build the expression CODE OP0 of type TYPE with location LOC,
simplifying it first if possible.  Returns the built
expression value and inserts statements possibly defining it
before GSI if BEFORE is true or after GSI if false and advance
the iterator accordingly.
If gsi refers to a basic block simplifying is allowed to look
at all SSA defs while when it does not it is restricted to
SSA defs that are not associated with a basic block yet,
indicating they belong to the currently building sequence.   

References gimple_stmt_iterator::bb, build1(), create_tmp_reg_or_ssa_name(), follow_all_ssa_edges(), ggc_alloc(), gimple_build_assign(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), and NULL.

Referenced by asan_expand_mark_ifn(), tree_switch_conversion::switch_conversion::build_one_array(), compute_new_first_bound(), convert_mult_to_fma_1(), convert_scalar_cond_reduction(), create_expression_by_pieces(), duplicate_and_interleave(), eliminate_dom_walker::eliminate_insert(), tree_switch_conversion::jump_table_cluster::emit(), expand_complex_addition(), expand_complex_comparison(), expand_complex_conjugate(), expand_complex_div_straight(), expand_complex_div_wide(), expand_complex_division(), expand_complex_multiplication(), expand_complex_multiplication_components(), expand_complex_negation(), generate_range_test(), get_initial_def_for_reduction(), get_initial_defs_for_reduction(), gimple_build(), gimple_build(), gimple_build(), gimple_build_round_up(), gimple_build_vector_from_val(), gimple_convert(), gimple_expand_vec_cond_expr(), gimple_fold_builtin_memory_chk(), gimple_fold_builtin_memory_op(), gimple_fold_builtin_stpcpy(), gimple_fold_builtin_stxcpy_chk(), gimplify_build1(), gimplify_build2(), gimplify_build3(), handle_builtin_alloca(), minmax_replacement(), optimize_atomic_bit_test_and(), predicate_statements(), simplify_using_ranges::simplify(), simplify_vector_constructor(), ubsan_expand_ptr_ifn(), vect_adjust_loop_lens_control(), vect_create_epilog_for_reduction(), vect_create_nonlinear_iv_init(), vect_create_nonlinear_iv_step(), vect_create_partial_epilog(), vect_gen_len(), vect_gen_while_not(), vect_get_loop_len(), vect_get_loop_mask(), vect_init_vector(), vect_peel_nonlinear_iv_init(), vect_recog_bit_insert_pattern(), vect_set_loop_condition_normal(), vect_set_loop_condition_partial_vectors(), vect_set_loop_condition_partial_vectors_avx512(), vect_set_loop_controls_directly(), vect_update_nonlinear_iv(), vectorizable_condition(), vectorizable_induction(), vectorizable_live_operation_1(), vectorizable_load(), vectorizable_store(), and vectorize_slp_instance_root_stmt().

◆ gimple_build() [9/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
enum tree_code code,
tree type,
tree op0,
tree op1 )
Build the expression OP0 CODE OP1 of type TYPE with location LOC,
simplifying it first if possible.  Returns the built
expression value inserting any new statements at GSI honoring BEFORE
and UPDATE.   

References gimple_stmt_iterator::bb, create_tmp_reg_or_ssa_name(), follow_all_ssa_edges(), ggc_alloc(), gimple_build_assign(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), and NULL.

◆ gimple_build() [10/10]

tree gimple_build ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
enum tree_code code,
tree type,
tree op0,
tree op1,
tree op2 )
Build the expression (CODE OP0 OP1 OP2) of type TYPE with location LOC,
simplifying it first if possible.  Returns the built
expression value inserting any new statements at GSI honoring BEFORE
and UPDATE.   

References gimple_stmt_iterator::bb, build3(), create_tmp_reg_or_ssa_name(), follow_all_ssa_edges(), ggc_alloc(), gimple_build_assign(), gimple_build_insert_seq(), gimple_build_valueize(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gimple_simplify(), and NULL.

◆ gimple_build_insert_seq()

◆ gimple_build_round_up()

tree gimple_build_round_up ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
tree type,
tree old_size,
unsigned HOST_WIDE_INT align )
Emit gimple statements into &stmts that take a value given in OLD_SIZE
and generate a value guaranteed to be rounded upwards to ALIGN.

Return the tree node representing this size, it is of TREE_TYPE TYPE.   

References build_int_cst(), gcc_assert, ggc_alloc(), gimple_build(), and INTEGRAL_TYPE_P.

Referenced by asan_expand_mark_ifn(), and handle_builtin_alloca().

◆ gimple_build_valueize()

static tree gimple_build_valueize ( tree op)
static
The valueization hook we use for the gimple_build API simplification.
This makes us match fold_buildN behavior by only combining with
statements in the sequence(s) we are currently building.   

References gimple_bb(), NULL, NULL_TREE, and SSA_NAME_DEF_STMT.

Referenced by gimple_build(), gimple_build(), gimple_build(), gimple_build(), gimple_build(), and gimple_build().

◆ gimple_build_vector()

tree gimple_build_vector ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
tree_vector_builder * builder )
Build a vector from BUILDER, handling the case in which some elements
are non-constant.  Return a gimple value for the result, inserting
any new instructions to GSI honoring BEFORE and UPDATE.

BUILDER must not have a stepped encoding on entry.  This is because
the function is not geared up to handle the arithmetic that would
be needed in the variable case, and any code building a vector that
is known to be constant should use BUILDER->build () directly.   

References build_constructor(), cfun, CONSTANT_CLASS_P, CONSTRUCTOR_APPEND_ELT, create_tmp_reg(), gcc_assert, ggc_alloc(), gimple_build_assign(), gimple_build_insert_seq(), gimple_in_ssa_p(), gimple_seq_add_stmt_without_update(), gimple_set_location(), i, make_ssa_name(), NULL, NULL_TREE, poly_int< N, C >::to_constant(), TYPE_VECTOR_SUBPARTS(), and vec_alloc().

Referenced by duplicate_and_interleave(), get_initial_def_for_reduction(), get_initial_defs_for_reduction(), vect_create_constant_vectors(), vect_create_nonlinear_iv_init(), and vectorizable_induction().

◆ gimple_build_vector_from_val()

◆ gimple_call_integer_valued_real_p()

static bool gimple_call_integer_valued_real_p ( gimple * stmt,
int depth )
static
Return true if the floating-point value computed by call STMT is known
to have an integer value.  We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.

DEPTH is the current nesting depth of the query.   

References ggc_alloc(), gimple_call_arg(), gimple_call_combined_fn(), gimple_call_num_args(), integer_valued_real_call_p(), and NULL_TREE.

Referenced by gimple_stmt_integer_valued_real_p().

◆ gimple_call_nonnegative_warnv_p()

static bool gimple_call_nonnegative_warnv_p ( gimple * stmt,
bool * strict_overflow_p,
int depth )
static
Return true if return value of call STMT is known to be non-negative.
If the return value is based on the assumption that signed overflow is
undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P.  DEPTH is the current nesting depth of the query.   

References ggc_alloc(), gimple_call_arg(), gimple_call_combined_fn(), gimple_call_lhs(), gimple_call_num_args(), NULL_TREE, tree_call_nonnegative_warnv_p(), and TREE_TYPE.

Referenced by gimple_stmt_nonnegative_warnv_p().

◆ gimple_convert()

◆ gimple_convert_to_ptrofftype()

tree gimple_convert_to_ptrofftype ( gimple_stmt_iterator * gsi,
bool before,
gsi_iterator_update update,
location_t loc,
tree op )
Build the conversion (ptrofftype) OP with a result of a type
compatible with ptrofftype with location LOC if such conversion
is neccesary in GIMPLE, simplifying it first.
Returns the built expression value inserting any new statements
at GSI honoring BEFORE and UPDATE.   

References ggc_alloc(), gimple_convert(), ptrofftype_p(), sizetype, and TREE_TYPE.

Referenced by gimple_fold_builtin_memory_chk(), and gimple_fold_builtin_memory_op().

◆ gimple_fold_builtin()

◆ gimple_fold_builtin_acc_on_device()

◆ gimple_fold_builtin_bcmp()

static bool gimple_fold_builtin_bcmp ( gimple_stmt_iterator * gsi)
static
Transform a call to built-in bcmp(a, b, len) at *GSI into one
to built-in memcmp (a, b, len).   

References a, b, builtin_decl_implicit(), ggc_alloc(), gimple_build_call(), gimple_call_arg(), gsi_stmt(), and replace_call_with_call_and_fold().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_bcopy()

static bool gimple_fold_builtin_bcopy ( gimple_stmt_iterator * gsi)
static
Transform a call to built-in bcopy (src, dest, len) at *GSI into one
to built-in memmove (dest, src, len).   

References builtin_decl_implicit(), ggc_alloc(), gimple_build_call(), gimple_call_arg(), gimple_call_set_fntype(), gsi_stmt(), replace_call_with_call_and_fold(), and TREE_TYPE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_bzero()

static bool gimple_fold_builtin_bzero ( gimple_stmt_iterator * gsi)
static
Transform a call to built-in bzero (dest, len) at *GSI into one
to built-in memset (dest, 0, len).   

References builtin_decl_implicit(), fold_stmt(), ggc_alloc(), gimple_build_call(), gimple_call_arg(), gimple_seq_add_stmt_without_update(), gsi_replace_with_seq_vops(), gsi_stmt(), integer_zero_node, and NULL.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_clear_padding()

◆ gimple_fold_builtin_fprintf()

static bool gimple_fold_builtin_fprintf ( gimple_stmt_iterator * gsi,
tree fp,
tree fmt,
tree arg,
enum built_in_function fcode )
static
Fold a call to the {,v}fprintf{,_unlocked} and __{,v}printf_chk builtins.
FP, FMT, and ARG are the arguments to the call.  We don't fold calls with
more than 3 arguments, and ARG may be null in the 2-argument case.

Return NULL_TREE if no simplification was possible, otherwise return the
simplified form of the call as a tree.  FCODE is the BUILT_IN_*
code of the function to be simplified.   

References builtin_decl_explicit(), builtin_decl_implicit(), c_getstr(), ggc_alloc(), gimple_build_call(), gimple_call_lhs(), gsi_stmt(), init_target_chars(), integer_type_node, NULL, NULL_TREE, POINTER_TYPE_P, replace_call_with_call_and_fold(), replace_call_with_value(), target_percent, target_percent_c, target_percent_s, TREE_TYPE, and useless_type_conversion_p().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_fputs()

static bool gimple_fold_builtin_fputs ( gimple_stmt_iterator * gsi,
tree arg0,
tree arg1,
bool unlocked )
static
Fold a call to the fputs builtin.  ARG0 and ARG1 are the arguments
to the call.  IGNORE is true if the value returned
by the builtin will be ignored.  UNLOCKED is true is true if this
actually a call to fputs_unlocked.  If LEN in non-NULL, it represents
the known length of the string.  Return NULL_TREE if no simplification
was possible.   

References build_int_cst(), builtin_decl_explicit(), builtin_decl_implicit(), c_getstr(), cfun, compare_tree_int(), fold_convert, gcc_unreachable, get_maxval_strlen(), ggc_alloc(), gimple_build_call(), gimple_call_lhs(), gsi_stmt(), integer_type_node, integer_zero_node, NULL, optimize_function_for_size_p(), replace_call_with_call_and_fold(), replace_call_with_value(), size_one_node, size_type_node, SRK_STRLEN, and TREE_CODE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_memchr()

◆ gimple_fold_builtin_memory_chk()

static bool gimple_fold_builtin_memory_chk ( gimple_stmt_iterator * gsi,
tree dest,
tree src,
tree len,
tree size,
enum built_in_function fcode )
static
Fold a call to the __mem{cpy,pcpy,move,set}_chk builtin.
DEST, SRC, LEN, and SIZE are the arguments to the call.
IGNORE is true, if return value can be ignored.  FCODE is the BUILT_IN_*
code of the builtin.  If MAXLEN is not NULL, it is maximum length
passed as third argument.   

References builtin_decl_explicit(), get_maxval_strlen(), ggc_alloc(), gimple_build(), gimple_build_call(), gimple_call_lhs(), gimple_convert_to_ptrofftype(), gimple_location(), gsi_insert_seq_before(), GSI_SAME_STMT, gsi_stmt(), integer_all_onesp(), known_lower(), NULL, NULL_TREE, operand_equal_p(), replace_call_with_call_and_fold(), replace_call_with_value(), SRK_INT_VALUE, and TREE_TYPE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_memory_op()

static bool gimple_fold_builtin_memory_op ( gimple_stmt_iterator * gsi,
tree dest,
tree src,
enum built_in_function code )
static
Fold function call to builtin mem{{,p}cpy,move}.  Try to detect and
diagnose (otherwise undefined) overlapping copies without preventing
folding.  When folded, GCC guarantees that overlapping memcpy has
the same semantics as memmove.  Call to the library memcpy need not
provide the same guarantee.  Return false if no simplification can
be made.   

References AGGREGATE_TYPE_P, ao_ref_init_from_ptr_and_size(), bitwise_mode_for_size(), bitwise_type_for_mode(), build_aligned_type(), build_array_type_nelts(), build_int_cst(), build_pointer_type_for_mode(), builtin_decl_implicit(), c_strlen(), char_type_node, check_bounds_or_overlap(), compare_tree_int(), create_tmp_reg_or_ssa_name(), FLOAT_MODE_P, fold_build2, fold_const_aggregate_ref(), fold_stmt(), gcc_unreachable, get_addr_base_and_unit_offset(), GET_MODE_ALIGNMENT, GET_MODE_BITSIZE(), get_pointer_alignment(), getbyterep(), ggc_alloc(), gimple_assign_set_lhs(), gimple_build(), gimple_build_assign(), gimple_build_nop(), gimple_call_alloca_for_var_p(), gimple_call_arg(), gimple_call_lhs(), gimple_call_set_arg(), gimple_call_set_fndecl(), gimple_convert_to_ptrofftype(), gimple_location(), gimple_move_vops(), gimple_set_location(), gimple_set_vuse(), gimple_vdef(), gimple_vuse(), gsi_insert_before(), gsi_insert_seq_before(), gsi_replace(), GSI_SAME_STMT, gsi_stmt(), int_mode_for_size(), integer_zerop(), is_gimple_min_invariant(), is_gimple_reg_type(), known_eq, mem_ref_offset(), MIN, NULL, NULL_TREE, operand_equal_p(), optab_handler(), POINTER_TYPE_P, poly_int_tree_p(), pow2p_hwi(), ptr_mode, readonly_data_expr(), refs_may_alias_p_1(), release_ssa_name(), size_must_be_zero_p(), SSA_VAR_P, string_constant(), targetm, TREE_ADDRESSABLE, TREE_CODE, tree_fits_shwi_p(), tree_fits_uhwi_p(), tree_int_cst_equal(), TREE_OPERAND, tree_to_uhwi(), TREE_TYPE, type(), TYPE_ALIGN, TYPE_MAIN_VARIANT, TYPE_MODE, TYPE_REVERSE_STORAGE_ORDER, TYPE_SIZE_UNIT, unlink_stmt_vdef(), unsigned_char_type_node, var_decl_component_p(), and warning().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_memset()

◆ gimple_fold_builtin_printf()

static bool gimple_fold_builtin_printf ( gimple_stmt_iterator * gsi,
tree fmt,
tree arg,
enum built_in_function fcode )
static
Fold a call to the {,v}printf{,_unlocked} and __{,v}printf_chk builtins.
FMT and ARG are the arguments to the call; we don't fold cases with
more than 2 arguments, and ARG may be null if this is a 1-argument case.

Return NULL_TREE if no simplification was possible, otherwise return the
simplified form of the call as a tree.  FCODE is the BUILT_IN_*
code of the function to be simplified.   

References build_int_cst(), build_string_literal(), builtin_decl_explicit(), builtin_decl_implicit(), c_getstr(), free(), ggc_alloc(), gimple_build_call(), gimple_call_lhs(), gsi_stmt(), init_target_chars(), integer_type_node, NULL, NULL_TREE, POINTER_TYPE_P, replace_call_with_call_and_fold(), replace_call_with_value(), target_newline, target_percent, target_percent_c, target_percent_s, target_percent_s_newline, TREE_TYPE, and useless_type_conversion_p().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_realloc()

◆ gimple_fold_builtin_snprintf()

bool gimple_fold_builtin_snprintf ( gimple_stmt_iterator * gsi)
Simplify a call to the snprintf builtin with arguments DEST, DESTSIZE,
FMT, and ORIG.  ORIG may be null if this is a 3-argument call.  We don't
attempt to simplify calls with more than 4 arguments.

Return true if simplification was possible, otherwise false.   

References build_int_cstu(), builtin_decl_implicit(), c_getstr(), fold_convert, fold_stmt(), get_maxval_strlen(), ggc_alloc(), gimple_build_assign(), gimple_build_call(), gimple_call_arg(), gimple_call_lhs(), gimple_call_num_args(), gimple_seq_add_stmt_without_update(), gsi_prev(), gsi_replace_with_seq_vops(), gsi_stmt(), init_target_chars(), known_lower(), NULL, NULL_TREE, SRK_STRLEN, target_percent, target_percent_s, TREE_TYPE, and useless_type_conversion_p().

◆ gimple_fold_builtin_snprintf_chk()

static bool gimple_fold_builtin_snprintf_chk ( gimple_stmt_iterator * gsi,
enum built_in_function fcode )
static
Fold a call EXP to {,v}snprintf having NARGS passed as ARGS.  Return
NULL_TREE if a normal call should be emitted rather than expanding
the function inline.  FCODE is either BUILT_IN_SNPRINTF_CHK or
BUILT_IN_VSNPRINTF_CHK.  If MAXLEN is not NULL, it is maximum length
passed as second argument.   

References builtin_decl_explicit(), c_getstr(), fold_stmt(), get_maxval_strlen(), ggc_alloc(), gimple_call_arg(), gimple_call_num_args(), gimple_call_set_arg(), gimple_call_set_fndecl(), gimple_call_set_fntype(), gimple_num_ops(), gimple_set_num_ops(), gsi_stmt(), i, init_target_chars(), integer_all_onesp(), integer_zerop(), known_lower(), NULL, SRK_INT_VALUE, target_percent, target_percent_s, and TREE_TYPE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_sprintf()

bool gimple_fold_builtin_sprintf ( gimple_stmt_iterator * gsi)
Simplify a call to the sprintf builtin with arguments DEST, FMT, and ORIG.
ORIG may be null if this is a 2-argument call.  We don't attempt to
simplify calls with more than 3 arguments.

Return true if simplification was possible, otherwise false.   

References build_int_cst(), builtin_decl_implicit(), c_getstr(), copy_warning(), fold_convert, fold_stmt(), get_maxval_strlen(), ggc_alloc(), gimple_build_assign(), gimple_build_call(), gimple_call_arg(), gimple_call_lhs(), gimple_call_num_args(), gimple_seq_add_stmt_without_update(), gsi_prev(), gsi_replace_with_seq_vops(), gsi_stmt(), init_target_chars(), NULL, NULL_TREE, POINTER_TYPE_P, SRK_STRLEN, target_percent, target_percent_s, TREE_TYPE, and useless_type_conversion_p().

◆ gimple_fold_builtin_sprintf_chk()

static bool gimple_fold_builtin_sprintf_chk ( gimple_stmt_iterator * gsi,
enum built_in_function fcode )
static
Fold a call EXP to __{,v}sprintf_chk having NARGS passed as ARGS.
Return NULL_TREE if a normal call should be emitted rather than
expanding the function inline.  FCODE is either BUILT_IN_SPRINTF_CHK
or BUILT_IN_VSPRINTF_CHK.   

References build_int_cstu(), builtin_decl_explicit(), c_getstr(), c_strlen(), fold_stmt(), ggc_alloc(), gimple_call_arg(), gimple_call_num_args(), gimple_call_set_arg(), gimple_call_set_fndecl(), gimple_call_set_fntype(), gimple_num_ops(), gimple_set_num_ops(), gsi_stmt(), i, init_target_chars(), integer_all_onesp(), integer_zerop(), known_lower(), NULL, NULL_TREE, POINTER_TYPE_P, size_type_node, target_percent, target_percent_s, and TREE_TYPE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_stpcpy()

◆ gimple_fold_builtin_strcat()

static bool gimple_fold_builtin_strcat ( gimple_stmt_iterator * gsi,
tree dst,
tree src )
static
Simplify a call to the strcat builtin.  DST and SRC are the arguments
to the call.

Return NULL_TREE if no simplification was possible, otherwise return the
simplified form of the call as a tree.

The simplified form may be a constant or other expression which
computes the same value, but in a more efficient manner (including
calls to other builtin functions).

The call may contain arguments which need to be evaluated, but
which are not useful to determine the result of the call.  In
this case we return a chain of COMPOUND_EXPRs.  The LHS of each
COMPOUND_EXPR will be an argument which must be evaluated.
COMPOUND_EXPRs are chained through their RHS.  The RHS of the last
COMPOUND_EXPR in the chain will contain the tree for the simplified
form of the builtin function call.   

References build_int_cst(), builtin_decl_implicit(), c_getstr(), create_tmp_reg_or_ssa_name(), fold_build_pointer_plus_loc(), fold_convert_loc(), fold_stmt(), force_gimple_operand(), get_maxval_strlen(), ggc_alloc(), gimple_bb(), gimple_build_assign(), gimple_build_call(), gimple_call_lhs(), gimple_call_set_lhs(), gimple_location(), gimple_seq_add_seq_without_update(), gimple_seq_add_stmt_without_update(), gimple_set_location(), gsi_prev(), gsi_replace_with_seq_vops(), gsi_stmt(), NULL, NULL_TREE, optimize_bb_for_speed_p(), replace_call_with_value(), size_binop_loc(), size_type_node, and SRK_STRLEN.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_strcat_chk()

static bool gimple_fold_builtin_strcat_chk ( gimple_stmt_iterator * gsi)
static
Fold a call to the __strcat_chk builtin FNDECL.  DEST, SRC, and SIZE
are the arguments to the call.   

References builtin_decl_explicit(), c_getstr(), ggc_alloc(), gimple_build_call(), gimple_call_arg(), gsi_stmt(), integer_all_onesp(), replace_call_with_call_and_fold(), replace_call_with_value(), and tree_fits_uhwi_p().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_strchr()

static bool gimple_fold_builtin_strchr ( gimple_stmt_iterator * gsi,
bool is_strrchr )
static

◆ gimple_fold_builtin_strcpy()

static bool gimple_fold_builtin_strcpy ( gimple_stmt_iterator * gsi,
tree dest,
tree src )
static

◆ gimple_fold_builtin_string_compare()

◆ gimple_fold_builtin_strlen()

◆ gimple_fold_builtin_strncat()

◆ gimple_fold_builtin_strncat_chk()

static bool gimple_fold_builtin_strncat_chk ( gimple_stmt_iterator * gsi)
static

◆ gimple_fold_builtin_strncpy()

static bool gimple_fold_builtin_strncpy ( gimple_stmt_iterator * gsi,
tree dest,
tree src,
tree len )
static

◆ gimple_fold_builtin_strstr()

static bool gimple_fold_builtin_strstr ( gimple_stmt_iterator * gsi)
static
Fold function call to builtin strstr.
If both arguments are constant, evaluate and fold the result,
additionally fold strstr (x, "") into x and strstr (x, "c")
into strchr (x, 'c').   

References build_int_cst(), builtin_decl_implicit(), c_getstr(), check_nul_terminated_array(), ggc_alloc(), gimple_build_assign(), gimple_build_call(), gimple_call_arg(), gimple_call_lhs(), gimple_seq_add_stmt_without_update(), gsi_replace_with_seq_vops(), gsi_stmt(), integer_type_node, integer_zero_node, NULL, NULL_TREE, r, replace_call_with_call_and_fold(), replace_call_with_value(), and size_type_node.

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_stxcpy_chk()

static bool gimple_fold_builtin_stxcpy_chk ( gimple_stmt_iterator * gsi,
tree dest,
tree src,
tree size,
enum built_in_function fcode )
static
Fold a call to the __st[rp]cpy_chk builtin.
DEST, SRC, and SIZE are the arguments to the call.
IGNORE is true if return value can be ignored.  FCODE is the BUILT_IN_*
code of the builtin.  If MAXLEN is not NULL, it is maximum length of
strings passed as second argument.   

References build_int_cst(), builtin_decl_explicit(), c_strlen(), dump_transformation(), force_gimple_operand(), get_maxval_strlen(), ggc_alloc(), gimple_build(), gimple_build_call(), gimple_call_fndecl(), gimple_call_lhs(), gimple_convert(), gimple_location(), gsi_insert_seq_before(), GSI_SAME_STMT, gsi_stmt(), integer_all_onesp(), integer_zerop(), known_lower(), NULL, NULL_TREE, operand_equal_p(), replace_call_with_call_and_fold(), replace_call_with_value(), size_type_node, SRK_STRLENMAX, TREE_SIDE_EFFECTS, warning_at(), and warning_suppressed_p().

Referenced by gimple_fold_builtin().

◆ gimple_fold_builtin_stxncpy_chk()

static bool gimple_fold_builtin_stxncpy_chk ( gimple_stmt_iterator * gsi,
tree dest,
tree src,
tree len,
tree size,
enum built_in_function fcode )
static
Fold a call to the __st{r,p}ncpy_chk builtin.  DEST, SRC, LEN, and SIZE
are the arguments to the call.  If MAXLEN is not NULL, it is maximum
length passed as third argument. IGNORE is true if return value can be
ignored. FCODE is the BUILT_IN_* code of the builtin.  

References builtin_decl_explicit(), dump_transformation(), get_maxval_strlen(), ggc_alloc(), gimple_build_call(), gimple_call_lhs(), gsi_stmt(), integer_all_onesp(), known_lower(), NULL_TREE, replace_call_with_call_and_fold(), and SRK_INT_VALUE.

Referenced by gimple_fold_builtin().

◆ gimple_fold_call()

static bool gimple_fold_call ( gimple_stmt_iterator * gsi,
bool inplace )
static
Attempt to fold a call statement referenced by the statement iterator GSI.
The statement may be replaced by another statement, e.g., if the call
simplifies to a constant value. Return true if any changes were made.
It is assumed that the operands have been previously folded.   

References arith_overflowed_p(), build2_loc(), build_complex(), build_complex_type(), build_one_cst(), build_zero_cst(), BUILT_IN_MD, BUILT_IN_NORMAL, cfun, changed, create_tmp_var, dbg_cnt(), DECL_STATIC_CHAIN, drop_tree_overflow(), dump_enabled_p(), dump_file, dump_printf_loc(), fold_builtin_expect(), fold_convert, fold_internal_goacc_dim(), cgraph_node::get(), get_or_create_ssa_default_def(), ggc_alloc(), gimple_build_assign(), gimple_build_builtin_unreachable(), gimple_build_nop(), gimple_call_addr_fndecl(), gimple_call_arg(), gimple_call_builtin_p(), gimple_call_chain(), gimple_call_fn(), gimple_call_fndecl(), gimple_call_fntype(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_lhs(), gimple_call_noreturn_p(), gimple_call_set_chain(), gimple_call_set_ctrl_altering(), gimple_call_set_fn(), gimple_call_set_fndecl(), gimple_call_set_fntype(), gimple_call_set_lhs(), gimple_fold_builtin(), gimple_fold_partial_load(), gimple_fold_partial_store(), gimple_location(), gimple_move_vops(), gimplify_and_update_call_from_tree(), gsi_insert_before(), gsi_replace(), GSI_SAME_STMT, gsi_stmt(), integer_all_onesp(), integer_onep(), integer_zero_node, integer_zerop(), maybe_remove_unused_call_args(), MSG_OPTIMIZED_LOCATIONS, NULL, NULL_TREE, OBJ_TYPE_REF_EXPR, offset, operand_equal_p(), possible_polymorphic_call_target_p(), possible_polymorphic_call_targets(), print_generic_expr(), print_gimple_stmt(), replace_call_with_value(), set_ssa_default_def(), SET_SSA_NAME_VAR_OR_IDENTIFIER, should_remove_lhs_p(), SSA_NAME_DEF_STMT, targetm, TDF_SLIM, TREE_CODE, tree_int_cst_le(), tree_int_cst_lt(), TREE_OVERFLOW, TREE_TYPE, TREE_VALUE, TYPE_ARG_TYPES, TYPE_PRECISION, TYPE_UNSIGNED, virtual_method_call_p(), void_type_node, and VOID_TYPE_P.

Referenced by fold_stmt_1().

◆ gimple_fold_indirect_ref()

tree gimple_fold_indirect_ref ( tree t)
Given a pointer value T, return a simplified version of an
indirection through T, or NULL_TREE if no simplification is
possible.  Note that the resulting type may be different from
the type pointed to in the sense that it is still compatible
from the langhooks point of view.  

References bitsize_int, build1(), build4(), DECL_P, fold_build1, fold_build2, fold_build3, ggc_alloc(), gimple_fold_indirect_ref(), known_lt, NULL_TREE, offset, POINTER_TYPE_P, size_zero_node, STRIP_NOPS, wi::to_wide(), TREE_CODE, tree_fits_uhwi_p(), tree_int_cst_equal(), TREE_OPERAND, tree_to_shwi(), tree_to_uhwi(), TREE_TYPE, TYPE_DOMAIN, TYPE_MIN_VALUE, TYPE_REF_CAN_ALIAS_ALL, TYPE_SIZE, TYPE_SIZE_UNIT, TYPE_VECTOR_SUBPARTS(), useless_type_conversion_p(), and wide_int_to_tree().

Referenced by copy_tree_body_r(), expand_thunk(), gimple_fold_indirect_ref(), gimple_fold_indirect_ref_rhs(), and maybe_make_indirect().

◆ gimple_fold_partial_load()

static bool gimple_fold_partial_load ( gimple_stmt_iterator * gsi,
gcall * call,
bool mask_p )
static
Try to fold IFN_{MASK,LEN}_LOAD call CALL.  Return true on success.
MASK_P indicates it's for MASK if true, otherwise it's for LEN.   

References ggc_alloc(), gimple_build_assign(), gimple_call_lhs(), gimple_fold_partial_load_store_mem_ref(), gimple_location(), gimple_move_vops(), gimple_set_location(), gsi_replace(), and TREE_TYPE.

Referenced by gimple_fold_call().

◆ gimple_fold_partial_load_store_mem_ref()

static tree gimple_fold_partial_load_store_mem_ref ( gcall * call,
tree vectype,
bool mask_p )
static
If IFN_{MASK,LEN,MASK_LEN}_LOAD/STORE call CALL is unconditional,
return a MEM_REF for the memory it references, otherwise return null.
VECTYPE is the type of the memory vector.  MASK_P indicates it's for
MASK if true, otherwise it's for LEN.   

References build_aligned_type(), build_zero_cst(), fold_build2, gcc_assert, GET_MODE_NUNITS(), ggc_alloc(), gimple_call_arg(), gimple_call_internal_fn(), integer_all_onesp(), internal_fn_len_index(), internal_fn_mask_index(), NULL_TREE, offset, poly_int_tree_p(), wi::to_poly_widest(), wi::to_widest(), TREE_CODE, tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, TYPE_ALIGN, and TYPE_MODE.

Referenced by gimple_fold_partial_load(), and gimple_fold_partial_store().

◆ gimple_fold_partial_store()

static bool gimple_fold_partial_store ( gimple_stmt_iterator * gsi,
gcall * call,
bool mask_p )
static
Try to fold IFN_{MASK,LEN}_STORE call CALL.  Return true on success.
MASK_P indicates it's for MASK if true, otherwise it's for LEN.   

References ggc_alloc(), gimple_build_assign(), gimple_call_arg(), gimple_call_internal_fn(), gimple_fold_partial_load_store_mem_ref(), gimple_location(), gimple_move_vops(), gimple_set_location(), gsi_replace(), internal_fn_stored_value_index(), and TREE_TYPE.

Referenced by gimple_fold_call().

◆ gimple_fold_stmt_to_constant()

tree gimple_fold_stmt_to_constant ( gimple * stmt,
tree(*)(tree) valueize )
Fold STMT to a constant using VALUEIZE to valueize SSA names.
Returns NULL_TREE if folding to a constant is not possible, otherwise
returns a constant according to is_gimple_min_invariant.   

References ggc_alloc(), gimple_fold_stmt_to_constant_1(), is_gimple_min_invariant(), and NULL_TREE.

Referenced by object_sizes_execute().

◆ gimple_fold_stmt_to_constant_1()

tree gimple_fold_stmt_to_constant_1 ( gimple * stmt,
tree(*)(tree) valueize,
tree(*)(tree) gvalueize )
Fold STMT to a constant using VALUEIZE to valueize SSA names.

Either NULL_TREE, a simplified but non-constant or a constant
is returned.

???  This should go into a gimple-fold-inline.h file to be eventually
privatized with the single valueize function used in the various TUs
to avoid the indirect function call overhead.   

References build1_loc(), build_invariant_address(), build_zero_cst(), CONSTANT_CLASS_P, CONSTRUCTOR_ELTS, CONSTRUCTOR_NELTS, decl_address_invariant_p(), dump_file, dump_flags, EXPR_LOCATION, fndecl_built_in_p(), fold_binary_loc(), fold_build2, fold_builtin_call_array(), fold_const_aggregate_ref_1(), fold_convert, fold_ternary_loc(), fold_unary_loc(), FOR_EACH_CONSTRUCTOR_VALUE, gcc_unreachable, get_addr_base_and_unit_offset_1(), get_gimple_rhs_class(), get_symbol_constant_value(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs3(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, gimple_builtin_call_types_compatible_p(), gimple_call_arg(), gimple_call_fn(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_num_args(), gimple_call_return_type(), gimple_location(), gimple_simplified_result_is_gimple_val(), gimple_simplify(), GIMPLE_SINGLE_RHS, GIMPLE_TERNARY_RHS, GIMPLE_UNARY_RHS, i, integer_onep(), integer_zerop(), is_gimple_min_invariant(), known_eq, mprts_hook, NULL, NULL_TREE, OBJ_TYPE_REF_EXPR, offset, operand_equal_p(), print_generic_expr(), print_gimple_expr(), ptr_type_node, STRIP_NOPS, tcc_declaration, tcc_reference, TDF_DETAILS, TDF_SLIM, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, TREE_OVERFLOW, TREE_TYPE, TYPE_VECTOR_SUBPARTS(), unshare_expr(), and useless_type_conversion_p().

Referenced by back_propagate_equivalences(), ccp_fold(), copy_prop_visit_assignment(), gimple_fold_stmt_to_constant(), jt_state::register_equivs_stmt(), try_to_simplify(), pointer_equiv_analyzer::visit_stmt(), and visit_stmt().

◆ gimple_get_virt_method_for_binfo()

tree gimple_get_virt_method_for_binfo ( HOST_WIDE_INT token,
tree known_binfo,
bool * can_refer )
Return a declaration of a function which an OBJ_TYPE_REF references. TOKEN
is integer form of OBJ_TYPE_REF_TOKEN of the reference expression.
KNOWN_BINFO carries the binfo describing the true type of
OBJ_TYPE_REF_OBJECT(REF).
Set CAN_REFER if non-NULL to false if method
is not referable or if the virtual table is ill-formed (such as rewriten
by non-C++ produced symbol). Otherwise just return NULL in that calse.   

References BINFO_VTABLE, ggc_alloc(), gimple_get_virt_method_for_vtable(), NULL_TREE, offset, and vtable_pointer_value_to_vtable().

Referenced by possible_polymorphic_call_targets(), record_target_from_binfo(), and record_targets_from_bases().

◆ gimple_get_virt_method_for_vtable()

tree gimple_get_virt_method_for_vtable ( HOST_WIDE_INT token,
tree v,
unsigned HOST_WIDE_INT offset,
bool * can_refer )
Lookup virtual method with index TOKEN in a virtual table V
at OFFSET.  
Set CAN_REFER if non-NULL to false if method
is not referable or if the virtual table is ill-formed (such as rewriten
by non-C++ produced symbol). Otherwise just return NULL in that calse.   

References builtin_decl_unreachable(), can_refer_decl_in_current_unit_p(), CONSTRUCTOR_ELT, CONSTRUCTOR_NELTS, ctor_for_folding(), DECL_VIRTUAL_P, error_mark_node, gcc_assert, gcc_checking_assert, cgraph_node::get_create(), ggc_alloc(), integer_zerop(), NULL, NULL_TREE, offset, STRIP_NOPS, TREE_CODE, TREE_OPERAND, tree_to_uhwi(), TREE_TYPE, TYPE_DOMAIN, TYPE_MIN_VALUE, TYPE_SIZE, TYPE_SIZE_UNIT, and VAR_P.

Referenced by gimple_get_virt_method_for_binfo(), ipa_get_indirect_edge_target_1(), and try_make_edge_direct_virtual_call().

◆ gimple_load_first_char()

static tree gimple_load_first_char ( location_t loc,
tree str,
gimple_seq * stmts )
static
Build and append gimple statements to STMTS that would load a first
character of a memory location identified by STR.  LOC is location
of the statement.   

References build_int_cst(), build_pointer_type_for_mode(), build_type_variant, create_tmp_reg_or_ssa_name(), fold_build2_loc(), ggc_alloc(), gimple_assign_set_lhs(), gimple_build_assign(), gimple_seq_add_stmt_without_update(), NULL_TREE, ptr_mode, and unsigned_char_type_node.

Referenced by gimple_fold_builtin_string_compare().

◆ gimple_phi_integer_valued_real_p()

static bool gimple_phi_integer_valued_real_p ( gimple * stmt,
int depth )
static
Return true if the floating-point result of phi STMT is known to have
an integer value.  We also allow +Inf, -Inf and NaN to be considered
integer values. Return false for signaling NaN.

DEPTH is the current nesting depth of the query.   

References gimple_phi_arg_def(), gimple_phi_num_args(), i, and integer_valued_real_single_p().

Referenced by gimple_stmt_integer_valued_real_p().

◆ gimple_phi_nonnegative_warnv_p()

static bool gimple_phi_nonnegative_warnv_p ( gimple * stmt,
bool * strict_overflow_p,
int depth )
static
Return true if return value of call STMT is known to be non-negative.
If the return value is based on the assumption that signed overflow is
undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P.  DEPTH is the current nesting depth of the query.   

References gimple_phi_arg_def(), gimple_phi_num_args(), i, and tree_single_nonnegative_warnv_p().

Referenced by gimple_stmt_nonnegative_warnv_p().

◆ gimple_stmt_integer_valued_real_p()

bool gimple_stmt_integer_valued_real_p ( gimple * stmt,
int depth )
Return true if the floating-point value computed by STMT is known
to have an integer value.  We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.

DEPTH is the current nesting depth of the query.   

References ggc_alloc(), gimple_assign_integer_valued_real_p(), gimple_call_integer_valued_real_p(), and gimple_phi_integer_valued_real_p().

Referenced by integer_valued_real_single_p().

◆ gimple_stmt_nonnegative_warnv_p()

bool gimple_stmt_nonnegative_warnv_p ( gimple * stmt,
bool * strict_overflow_p,
int depth )
Return true if STMT is known to compute a non-negative value.
If the return value is based on the assumption that signed overflow is
undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P.  DEPTH is the current nesting depth of the query.   

References get_global_range_query(), ggc_alloc(), gimple_assign_nonnegative_warnv_p(), gimple_call_nonnegative_warnv_p(), gimple_phi_nonnegative_warnv_p(), gimple_range_type(), r, and frange::supports_p().

Referenced by fold_using_range::fold_stmt(), fold_using_range::range_of_call(), and tree_single_nonnegative_warnv_p().

◆ gimplify_and_update_call_from_tree()

void gimplify_and_update_call_from_tree ( gimple_stmt_iterator * si_p,
tree expr )
Convert EXPR into a GIMPLE value suitable for substitution on the
RHS of an assignment.  Insert the necessary statements before
iterator *SI_P.  The statement at *SI_P, which must be a GIMPLE_CALL
is replaced.  If the call is expected to produces a result, then it
is replaced by an assignment of the new RHS to the result variable.
If the result is to be ignored, then the call is replaced by a
GIMPLE_NOP.  A proper VDEF chain is retained by making the first
VUSE and the last VDEF of the whole sequence be the same as the replaced
statement and using new SSA names for stores in between.   

References CALL_EXPR_ARG, CALL_EXPR_FN, call_expr_nargs, cfun, finish_update_gimple_call(), force_gimple_operand(), gcc_assert, ggc_alloc(), gimple_build_assign(), gimple_build_call_vec(), gimple_build_nop(), gimple_call_lhs(), gimple_in_ssa_p(), gimple_seq_empty_p(), gimplify_and_add(), GSI_CONTINUE_LINKING, gsi_insert_after_without_update(), gsi_last(), gsi_replace(), gsi_replace_with_seq_vops(), gsi_stmt(), i, is_gimple_call(), NULL, NULL_TREE, pop_gimplify_context(), push_gimplify_context(), release_defs(), unlink_stmt_vdef(), valid_gimple_call_p(), and vNULL.

Referenced by dynamic_object_sizes_execute_one(), ccp_folder::fold_stmt(), gimple_fold_builtin(), gimple_fold_call(), strlen_pass::handle_builtin_memcmp(), strlen_pass::handle_builtin_strchr(), strlen_pass::handle_builtin_strlen(), maybe_optimize_arith_overflow(), and simplify_builtin_call().

◆ gsi_replace_with_seq_vops()

◆ has_use_on_stmt()

static bool has_use_on_stmt ( tree name,
gimple * stmt )
static
Return true whether NAME has a use on STMT.  Note this can return
false even though there's a use on STMT if SSA operands are not
up-to-date.   

References FOR_EACH_SSA_TREE_OPERAND, and SSA_OP_USE.

Referenced by replace_stmt_with_simplification().

◆ known_lower()

static bool known_lower ( gimple * stmt,
tree len,
tree size,
bool strict = false )
static
Return true if LEN is known to be less than or equal to (or if STRICT is
true, strictly less than) the lower bound of SIZE at compile time and false
otherwise.   

References get_range(), ggc_alloc(), wi::leu_p(), wi::ltu_p(), and NULL_TREE.

Referenced by gimple_fold_builtin_memory_chk(), gimple_fold_builtin_snprintf(), gimple_fold_builtin_snprintf_chk(), gimple_fold_builtin_sprintf_chk(), gimple_fold_builtin_strncat(), gimple_fold_builtin_strncat_chk(), gimple_fold_builtin_stxcpy_chk(), and gimple_fold_builtin_stxncpy_chk().

◆ maybe_canonicalize_mem_ref_addr()

◆ maybe_fold_and_comparisons()

tree maybe_fold_and_comparisons ( tree type,
enum tree_code code1,
tree op1a,
tree op1b,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
Try to simplify the AND of two comparisons, specified by
(OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively.
If this can be simplified to a single expression (without requiring
introducing more SSA variables to hold intermediate values),
return the resulting tree.  Otherwise return NULL_TREE.
If the result expression is non-null, it has boolean type.   

References and_comparisons_1(), ggc_alloc(), maybe_fold_comparisons_from_match_pd(), and NULL_TREE.

Referenced by and_var_with_comparison_1(), eliminate_redundant_comparison(), ifcombine_ifandif(), optimize_vec_cond_expr(), and simplify_1b().

◆ maybe_fold_comparisons_from_match_pd()

static tree maybe_fold_comparisons_from_match_pd ( tree type,
enum tree_code code,
enum tree_code code1,
tree op1a,
tree op1b,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Helper function for maybe_fold_and_comparisons and maybe_fold_or_comparisons
: try to simplify the AND/OR of the ssa variable VAR with the comparison
specified by (OP2A CODE2 OP2B) from match.pd.  Return NULL_EXPR if we can't
simplify this to a single expression.  As we are going to lower the cost
of building SSA names / gimple stmts significantly, we need to allocate
them ont the stack.  This will cause the code to be a bit ugly.   

References build2(), gimple_match_op::code, follow_all_ssa_edges(), follow_outer_ssa_edges(), fosa_bb, fosa_unwind, ggc_alloc(), gimple_assign_lhs(), gimple_assign_set_lhs(), gimple_assign_set_rhs1(), gimple_assign_set_rhs2(), gimple_assign_set_rhs_code(), gimple_init(), gimple_set_bb(), gimple_simplified_result_is_gimple_val(), gimple_size(), init_ssa_name_imm_use(), code_helper::is_tree_code(), NULL, NULL_TREE, gimple_match_op::ops, gimple_match_op::resimplify(), tcc_comparison, TREE_CODE_CLASS, TREE_SET_CODE, TREE_TYPE, type(), gimple_match_op::type, and gimple_match_cond::UNCOND.

Referenced by maybe_fold_and_comparisons(), and maybe_fold_or_comparisons().

◆ maybe_fold_or_comparisons()

tree maybe_fold_or_comparisons ( tree type,
enum tree_code code1,
tree op1a,
tree op1b,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
Try to simplify the OR of two comparisons, specified by
(OP1A CODE1 OP1B) and (OP2B CODE2 OP2B), respectively.
If this can be simplified to a single expression (without requiring
introducing more SSA variables to hold intermediate values),
return the resulting tree.  Otherwise return NULL_TREE.
If the result expression is non-null, it has boolean type.   

References ggc_alloc(), maybe_fold_comparisons_from_match_pd(), NULL_TREE, and or_comparisons_1().

Referenced by eliminate_redundant_comparison(), fold_or_predicates(), optimize_vec_cond_expr(), and or_var_with_comparison_1().

◆ maybe_fold_reference()

static tree maybe_fold_reference ( tree expr)
static
Subroutine of fold_stmt.  We perform constant folding of the
memory reference tree EXPR.   

References CONSTANT_CLASS_P, EXPR_LOCATION, fold_const_aggregate_ref(), fold_ternary_loc(), fold_unary_loc(), ggc_alloc(), is_gimple_min_invariant(), NULL_TREE, TREE_CODE, TREE_OPERAND, and TREE_TYPE.

Referenced by fold_gimple_assign(), and fold_stmt_1().

◆ no_follow_ssa_edges()

tree no_follow_ssa_edges ( tree )
Valueziation callback that ends up not following SSA edges.   

References NULL_TREE.

Referenced by back_propagate_equivalences(), cleanup_control_expr_graph(), fold_stmt(), and fold_stmt_inplace().

◆ optimize_atomic_compare_exchange_p()

◆ or_comparisons_1()

static tree or_comparisons_1 ( tree type,
enum tree_code code1,
tree op1a,
tree op1b,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Try to simplify the OR of two comparisons defined by
(OP1A CODE1 OP1B) and (OP2A CODE2 OP2B), respectively.
If this can be done without constructing an intermediate value,
return the resulting tree; otherwise NULL_TREE is returned.
This function is deliberately asymmetric as it recurses on SSA_DEFs
in the first comparison but not the second.   

References boolean_true_node, boolean_type_node, CDI_DOMINATORS, combine_comparisons(), dom_info_available_p(), dominated_by_p(), fold_build2, ggc_alloc(), gimple_bb(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), i, integer_nonzerop(), integer_onep(), integer_zerop(), NULL_TREE, operand_equal_p(), or_var_with_comparison(), same_bool_comparison_p(), same_bool_result_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, swap_tree_comparison(), TREE_CODE, TREE_TYPE, truth_type_for(), and UNKNOWN_LOCATION.

Referenced by maybe_fold_or_comparisons(), and or_var_with_comparison_1().

◆ or_var_with_comparison()

static tree or_var_with_comparison ( tree type,
tree var,
bool invert,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Helper function for or_comparisons_1:  try to simplify the OR of the
ssa variable VAR with the comparison specified by (OP2A CODE2 OP2B).
If INVERT is true, invert the value of VAR before doing the OR.
Return NULL_EXPR if we can't simplify this to a single expression.   

References and_var_with_comparison_1(), canonicalize_bool(), ggc_alloc(), invert_tree_comparison(), is_gimple_assign(), NULL_TREE, or_var_with_comparison_1(), and SSA_NAME_DEF_STMT.

Referenced by or_comparisons_1(), and or_var_with_comparison_1().

◆ or_var_with_comparison_1()

static tree or_var_with_comparison_1 ( tree type,
gimple * stmt,
enum tree_code code2,
tree op2a,
tree op2b,
basic_block outer_cond_bb )
static
Try to simplify the OR of the ssa variable defined by the assignment
STMT with the comparison specified by (OP2A CODE2 OP2B).
Return NULL_EXPR if we can't simplify this to a single expression.   

References boolean_false_node, boolean_true_node, ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), integer_nonzerop(), integer_onep(), integer_zerop(), is_gimple_assign(), maybe_fold_or_comparisons(), NULL_TREE, or_comparisons_1(), or_var_with_comparison(), same_bool_result_p(), SSA_NAME_DEF_STMT, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, and TREE_TYPE.

Referenced by and_var_with_comparison(), and or_var_with_comparison().

◆ replace_call_with_call_and_fold()

◆ replace_call_with_value()

◆ replace_stmt_with_simplification()

◆ rewrite_to_defined_overflow() [1/3]

gimple_seq rewrite_to_defined_overflow ( gimple * stmt)

◆ rewrite_to_defined_overflow() [2/3]

void rewrite_to_defined_overflow ( gimple_stmt_iterator * gsi)

◆ rewrite_to_defined_overflow() [3/3]

static gimple_seq rewrite_to_defined_overflow ( gimple_stmt_iterator * gsi,
gimple * stmt,
bool in_place )
static
Rewrite STMT, an assignment with a signed integer or pointer arithmetic
operation that can be transformed to unsigned arithmetic by converting
its operand, carrying out the operation in the corresponding unsigned
type and converting the result back to the original type.

If IN_PLACE is true, *GSI points to STMT, adjust the stmt in place and
return NULL.
Otherwise returns a sequence of statements that replace STMT and also
contain a modified form of STMT itself.   

References dump_file, dump_flags, ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs_code(), gimple_assign_set_lhs(), gimple_assign_set_rhs_code(), gimple_build_assign(), gimple_convert(), gimple_num_ops(), gimple_op(), gimple_seq_add_stmt(), gimple_set_modified(), gimple_set_op(), gsi_insert_after(), gsi_insert_seq_before(), GSI_SAME_STMT, i, make_ssa_name(), NULL, print_gimple_stmt(), TDF_DETAILS, TDF_SLIM, TREE_TYPE, unsigned_type_for(), and update_stmt().

Referenced by final_value_replacement_loop(), move_computations_worker(), predicate_statements(), rewrite_to_defined_overflow(), rewrite_to_defined_overflow(), split_loop(), and update_range_test().

◆ same_bool_comparison_p()

static bool same_bool_comparison_p ( const_tree expr,
enum tree_code code,
const_tree op1,
const_tree op2 )
static

◆ same_bool_result_p()

static bool same_bool_result_p ( const_tree op1,
const_tree op2 )
static
Check to see if two boolean expressions OP1 and OP2 are logically
equivalent.   

References COMPARISON_CLASS_P, operand_equal_p(), same_bool_comparison_p(), TREE_CODE, and TREE_OPERAND.

Referenced by and_comparisons_1(), and_var_with_comparison_1(), or_comparisons_1(), and or_var_with_comparison_1().

◆ size_must_be_zero_p()

static bool size_must_be_zero_p ( tree size)
static
Return TRUE if the SIZE argument, representing the size of an
object, is in a range of values of which exactly zero is valid.   

References cfun, get_range_query(), ggc_alloc(), integer_zerop(), INTEGRAL_TYPE_P, irange::intersect(), wi::lshift(), wi::one(), path_range_query::range_of_expr(), irange::set_varying(), TREE_CODE, TREE_TYPE, TYPE_PRECISION, vrange::undefined_p(), wi::zero(), and irange::zero_p().

Referenced by gimple_fold_builtin_memory_op().

◆ update_gimple_call()

bool update_gimple_call ( gimple_stmt_iterator * si_p,
tree fn,
int nargs,
... )
Update a GIMPLE_CALL statement at iterator *SI_P to call to FN
with number of arguments NARGS, where the arguments in GIMPLE form
follow NARGS argument.   

References ap, finish_update_gimple_call(), gcc_assert, ggc_alloc(), gimple_build_call_valist(), gsi_stmt(), and is_gimple_call().

Referenced by strlen_pass::handle_builtin_memset(), strlen_pass::handle_builtin_strcat(), strlen_pass::handle_builtin_strcpy(), strlen_pass::handle_builtin_string_cmp(), and instrument_builtin_call().

◆ valid_gimple_call_p()

static bool valid_gimple_call_p ( tree expr)
static
Return true if EXPR is a CALL_EXPR suitable for representation
as a single GIMPLE_CALL statement.  If the arguments require
further gimplification, return false.   

References CALL_EXPR_ARG, call_expr_nargs, ggc_alloc(), i, is_gimple_lvalue(), is_gimple_reg_type(), is_gimple_val(), TREE_CODE, and TREE_TYPE.

Referenced by gimplify_and_update_call_from_tree().

◆ valid_gimple_rhs_p()

bool valid_gimple_rhs_p ( tree expr)
Return true if EXPR is an acceptable right-hand-side for a
GIMPLE assignment.  We validate the entire tree, not just
the root node, thus catching expressions that embed complex
operands that are not permitted in GIMPLE.  This function
is needed because the folding routines in fold-const.cc
may return such expressions in some cases, e.g., an array
access with an embedded index addition.  It may make more
sense to have folding routines that are sensitive to the
constraints on GIMPLE operands, rather than abandoning any
any attempt to fold if the usual folding turns out to be too
aggressive.   

References CONSTRUCTOR_ELTS, FOR_EACH_CONSTRUCTOR_VALUE, get_gimple_rhs_class(), ggc_alloc(), GIMPLE_TERNARY_RHS, handled_component_p(), i, INTEGRAL_TYPE_P, is_gimple_id(), is_gimple_min_invariant(), is_gimple_val(), is_gimple_variable(), tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, tcc_unary, tcc_vl_exp, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, TREE_TYPE, TYPE_PRECISION, and VECTOR_TYPE_P.

Referenced by fold_gimple_assign().

◆ var_decl_component_p()

static bool var_decl_component_p ( tree var)
static
Return true if VAR is a VAR_DECL or a component thereof.   

References DECL_P, ggc_alloc(), handled_component_p(), TREE_CODE, and TREE_OPERAND.

Referenced by gimple_fold_builtin_memory_op(), and gimple_fold_builtin_memset().

Variable Documentation

◆ clear_padding_buf_size

const size_t clear_padding_buf_size = 32 * clear_padding_unit
static
Buffer size on which __builtin_clear_padding folding code works.   

Referenced by clear_padding_add_padding(), clear_padding_type(), and clear_padding_union().

◆ clear_padding_unit

constexpr size_t clear_padding_unit = MAX_BITSIZE_MODE_ANY_MODE / BITS_PER_UNIT
staticconstexpr
Number of bytes into which any type but aggregate, vector or
_BitInt types should fit.   

Referenced by clear_padding_flush(), and clear_padding_type().

◆ fosa_bb

◆ fosa_unwind