GCC Middle and Back End API Reference
tree-ssa-propagate.h File Reference
#include "value-query.h"
Include dependency graph for tree-ssa-propagate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  ssa_propagation_engine
 
class  substitute_and_fold_engine
 

Enumerations

enum  ssa_prop_result { SSA_PROP_NOT_INTERESTING , SSA_PROP_INTERESTING , SSA_PROP_VARYING }
 

Functions

void prop_set_simulate_again (gimple *s, bool visit_p)
 
bool prop_simulate_again_p (gimple *s)
 
void move_ssa_defining_stmt_for_defs (gimple *, gimple *)
 
bool stmt_makes_single_store (gimple *)
 
bool may_propagate_copy (tree, tree, bool=false)
 
bool may_propagate_copy_into_stmt (gimple *, tree)
 
bool may_propagate_copy_into_asm (tree)
 
void propagate_value (use_operand_p, tree)
 
void replace_exp (use_operand_p, tree)
 
void propagate_tree_value (tree *, tree)
 
void propagate_tree_value_into_stmt (gimple_stmt_iterator *, tree)
 

Enumeration Type Documentation

◆ ssa_prop_result

Lattice values used for propagation purposes.  Specific instances
of a propagation engine must return these values from the statement
and PHI visit functions to direct the engine.   
Enumerator
SSA_PROP_NOT_INTERESTING 
SSA_PROP_INTERESTING 
SSA_PROP_VARYING 

Function Documentation

◆ may_propagate_copy()

◆ may_propagate_copy_into_asm()

bool may_propagate_copy_into_asm ( tree dest)
extern
Similarly, but we know that we're propagating into an ASM_EXPR.   

Referenced by cprop_operand(), and substitute_and_fold_engine::replace_uses_in().

◆ may_propagate_copy_into_stmt()

bool may_propagate_copy_into_stmt ( gimple * dest,
tree orig )
extern
Like may_propagate_copy, but use as the destination expression
the principal expression (typically, the RHS) contained in
statement DEST.  This is more efficient when working with the
gimple tuples representation.   

References boolean_type_node, dyn_cast(), gcc_unreachable, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_call_lhs(), gimple_switch_index(), is_gimple_assign(), is_gimple_call(), may_propagate_copy(), NULL_TREE, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, TREE_CODE, TREE_TYPE, and useless_type_conversion_p().

Referenced by eliminate_redundant_computations().

◆ move_ssa_defining_stmt_for_defs()

void move_ssa_defining_stmt_for_defs ( gimple * ,
gimple *  )
extern

◆ prop_set_simulate_again()

void prop_set_simulate_again ( gimple * s,
bool visit_p )
inline
Data structures and function declarations for the SSA value propagation
   engine.
   Copyright (C) 2004-2024 Free Software Foundation, Inc.
   Contributed by Diego Novillo <dnovillo@redhat.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
If SIM_P is true, statement S will be simulated again.   

References gimple_set_visited().

Referenced by ccp_initialize(), init_copy_prop(), init_dont_simulate_again(), and ssa_propagation_engine::simulate_stmt().

◆ prop_simulate_again_p()

bool prop_simulate_again_p ( gimple * s)
inline
Return true if statement T should be simulated again.   

References gimple_visited_p().

Referenced by add_ssa_edge(), evaluate_stmt(), init_copy_prop(), likely_value(), ssa_propagation_engine::simulate_stmt(), and valueize_op_1().

◆ propagate_tree_value()

void propagate_tree_value ( tree * op_p,
tree val )
extern
Propagate the value VAL (assumed to be a constant or another SSA_NAME)
into the tree pointed to by OP_P.

Use this version for const/copy propagation when SSA operands are not
available.  It will perform the additional checks to ensure validity of
the const/copy propagation, but will not update any operand information.
Be sure to mark the stmt as modified.   

References TREE_CODE, and unshare_expr().

Referenced by propagate_tree_value_into_stmt().

◆ propagate_tree_value_into_stmt()

void propagate_tree_value_into_stmt ( gimple_stmt_iterator * gsi,
tree val )
extern
Like propagate_tree_value, but use as the operand to replace
the principal expression (typically, the RHS) contained in the
statement referenced by iterator GSI.  Note that it is not
always possible to update the statement in-place, so a new
statement may be created to replace the original.   

References build_zero_cst(), dyn_cast(), gcc_unreachable, gimple_assign_rhs1(), gimple_assign_set_rhs_from_tree(), gimple_assign_single_p(), gimple_call_lhs(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_switch_index_ptr(), gsi_stmt(), is_gimple_assign(), is_gimple_call(), NULL_TREE, propagate_tree_value(), replace_call_with_value(), and TREE_TYPE.

Referenced by eliminate_redundant_computations(), eliminate_dom_walker::eliminate_stmt(), and dom_opt_dom_walker::optimize_stmt().

◆ propagate_value()

void propagate_value ( use_operand_p op_p,
tree val )
extern
Propagate the value VAL (assumed to be a constant or another SSA_NAME)
into the operand pointed to by OP_P.

Use this version for const/copy propagation as it will perform additional
checks to ensure validity of the const/copy propagation.   

References as_a(), gcc_assert, gimple_phi_arg_edge(), is_a(), may_propagate_copy(), PHI_ARG_INDEX_FROM_USE, replace_exp(), USE_FROM_PTR, and USE_STMT.

Referenced by eliminate_dom_walker::before_dom_children(), cprop_into_successor_phis(), cprop_operand(), eliminate_dom_walker::eliminate_stmt(), process_bb(), substitute_and_fold_engine::propagate_into_phi_args(), substitute_and_fold_engine::replace_phi_args_in(), and substitute_and_fold_engine::replace_uses_in().

◆ replace_exp()

void replace_exp ( use_operand_p op_p,
tree val )
extern
Replace *OP_P with value VAL (assumed to be a constant or another SSA_NAME).

Use this version when not const/copy propagating values.  For example,
PRE uses this version when building expressions as they would appear
in specific blocks taking into account actions of PHI nodes.

The statement in which an expression has been replaced should be
folded using fold_stmt_inplace.   

References CONSTANT_CLASS_P, SET_USE, TREE_CODE, and unshare_expr().

Referenced by propagate_value(), replace_uses_by(), and value_replacement().

◆ stmt_makes_single_store()

bool stmt_makes_single_store ( gimple * stmt)
extern
Return true if STMT is of the form 'mem_ref = RHS', where 'mem_ref'
is a non-volatile pointer dereference, a structure reference or a
reference to a single _DECL.  Ignore volatile memory references
because they are not interesting for the optimizers.   

References DECL_P, gimple_get_lhs(), gimple_vdef(), REFERENCE_CLASS_P, and TREE_THIS_VOLATILE.

Referenced by compute_invariantness().