GCC Middle and Back End API Reference
substitute_and_fold_engine Class Referenceabstract

#include <tree-ssa-propagate.h>

Inheritance diagram for substitute_and_fold_engine:
Collaboration diagram for substitute_and_fold_engine:

Public Member Functions

 substitute_and_fold_engine (bool fold_all_stmts=false)
 
virtual tree value_of_expr (tree expr, gimple *=NULL)=0
 
virtual tree value_on_edge (edge, tree expr) override
 
virtual tree value_of_stmt (gimple *, tree name=NULL) override
 
virtual bool range_of_expr (vrange &r, tree expr, gimple *=NULL)
 
virtual ~substitute_and_fold_engine (void)
 
virtual bool fold_stmt (gimple_stmt_iterator *)
 
bool substitute_and_fold (basic_block=NULL)
 
bool replace_uses_in (gimple *)
 
bool replace_phi_args_in (gphi *)
 
virtual void pre_fold_bb (basic_block)
 
virtual void post_fold_bb (basic_block)
 
virtual void pre_fold_stmt (gimple *)
 
virtual void post_new_stmt (gimple *)
 
bool propagate_into_phi_args (basic_block)
 
virtual tree value_on_entry (basic_block, tree expr)
 
virtual tree value_on_exit (basic_block, tree expr)
 
virtual bool range_on_edge (vrange &r, edge, tree expr)
 
virtual bool range_of_stmt (vrange &r, gimple *, tree name=NULL)
 
virtual bool range_on_entry (vrange &r, basic_block bb, tree expr)
 
virtual bool range_on_exit (vrange &r, basic_block bb, tree expr)
 
class relation_oraclerelation () const
 
void create_relation_oracle (bool do_trans_p=true)
 
void destroy_relation_oracle ()
 
class infer_range_oracleinfer_oracle () const
 
void create_infer_oracle (bool do_search=TRUE)
 
void destroy_infer_oracle ()
 
class gimple_outgoing_rangegori () const
 
class gori_mapgori_ssa () const
 
void create_gori (int not_executable_flag=0, int sw_max_edges=INT_MAX)
 
void destroy_gori ()
 
virtual void dump (FILE *)
 

Data Fields

bool fold_all_stmts
 

Protected Member Functions

bool get_tree_range (vrange &v, tree expr, gimple *stmt, basic_block bbentry=NULL, basic_block bbexit=NULL)
 
bool invoke_range_of_expr (vrange &v, tree expr, gimple *stmt, basic_block bbentry, basic_block bbexit)
 
bool get_arith_expr_range (vrange &r, tree expr, gimple *stmt)
 
void share_query (range_query &q)
 

Protected Attributes

relation_oraclem_relation
 
infer_range_oraclem_infer
 
gimple_outgoing_rangem_gori
 
gori_mapm_map
 
bool m_shared_copy_p
 

Constructor & Destructor Documentation

◆ substitute_and_fold_engine()

substitute_and_fold_engine::substitute_and_fold_engine ( bool fold_all_stmts = false)
inline

◆ ~substitute_and_fold_engine()

virtual substitute_and_fold_engine::~substitute_and_fold_engine ( void )
inlinevirtual

Member Function Documentation

◆ create_gori()

void range_query::create_gori ( int not_executable_flag = 0,
int sw_max_edges = INT_MAX )
inherited

◆ create_infer_oracle()

void range_query::create_infer_oracle ( bool do_search = TRUE)
inherited

◆ create_relation_oracle()

void range_query::create_relation_oracle ( bool do_trans_p = true)
inherited

◆ destroy_gori()

void range_query::destroy_gori ( )
inherited

◆ destroy_infer_oracle()

void range_query::destroy_infer_oracle ( )
inherited

◆ destroy_relation_oracle()

void range_query::destroy_relation_oracle ( )
inherited

◆ dump()

void range_query::dump ( FILE * )
virtualinherited

◆ fold_stmt()

virtual bool substitute_and_fold_engine::fold_stmt ( gimple_stmt_iterator * )
inlinevirtual

◆ get_arith_expr_range()

bool range_query::get_arith_expr_range ( vrange & r,
tree expr,
gimple * stmt )
protectedinherited

◆ get_tree_range()

◆ gori()

◆ gori_ssa()

◆ infer_oracle()

◆ invoke_range_of_expr()

bool range_query::invoke_range_of_expr ( vrange & v,
tree expr,
gimple * stmt,
basic_block bbentry,
basic_block bbexit )
protectedinherited

◆ post_fold_bb()

virtual void substitute_and_fold_engine::post_fold_bb ( basic_block )
inlinevirtual

◆ post_new_stmt()

virtual void substitute_and_fold_engine::post_new_stmt ( gimple * )
inlinevirtual

◆ pre_fold_bb()

virtual void substitute_and_fold_engine::pre_fold_bb ( basic_block )
inlinevirtual

◆ pre_fold_stmt()

virtual void substitute_and_fold_engine::pre_fold_stmt ( gimple * )
inlinevirtual

◆ propagate_into_phi_args()

◆ range_of_expr()

bool substitute_and_fold_engine::range_of_expr ( vrange & r,
tree expr,
gimple * = NULL )
virtual

Implements range_query.

◆ range_of_stmt()

bool range_query::range_of_stmt ( vrange & r,
gimple * stmt,
tree name = NULL )
virtualinherited

◆ range_on_edge()

bool range_query::range_on_edge ( vrange & r,
edge ,
tree expr )
virtualinherited
Support routines for value queries.
   Copyright (C) 2020-2024 Free Software Foundation, Inc.
   Contributed by Aldy Hernandez <aldyh@redhat.com> and
   Andrew MacLeod <amacleod@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/>.   

Reimplemented in dom_ranger, gimple_ranger, and ranger_cache.

References r, and range_query::range_of_expr().

Referenced by fur_edge::get_operand(), fur_edge::get_phi_operand(), fur_source::get_phi_operand(), phi_analyzer::process_phi(), and range_query::value_on_edge().

◆ range_on_entry()

◆ range_on_exit()

bool range_query::range_on_exit ( vrange & r,
basic_block bb,
tree expr )
virtualinherited

◆ relation()

◆ replace_phi_args_in()

◆ replace_uses_in()

bool substitute_and_fold_engine::replace_uses_in ( gimple * stmt)
Replace USE references in statement STMT with the values stored in
PROP_VALUE. Return true if at least one reference was replaced.   

References FOR_EACH_SSA_USE_OPERAND, may_propagate_copy(), may_propagate_copy_into_asm(), NULL_TREE, prop_stats_d::num_const_prop, prop_stats_d::num_copy_prop, prop_stats, propagate_value(), SSA_OP_USE, TREE_CODE, USE_FROM_PTR, and value_of_expr().

Referenced by substitute_and_fold_dom_walker::before_dom_children().

◆ share_query()

◆ substitute_and_fold()

bool substitute_and_fold_engine::substitute_and_fold ( basic_block block = NULL)
Perform final substitution and folding of propagated values.
Process the whole function if BLOCK is null, otherwise only
process the blocks that BLOCK dominates.  In the latter case,
it is the caller's responsibility to ensure that dominator
information is available and up-to-date.

PROP_VALUE[I] contains the single value that should be substituted
at every use of SSA name N_I.  If PROP_VALUE is NULL, no values are
substituted.

If FOLD_FN is non-NULL the function will be invoked on all statements
before propagating values for pass specific simplification.

DO_DCE is true if trivially dead stmts can be removed.

If DO_DCE is true, the statements within a BB are walked from
last to first element.  Otherwise we scan from first to last element.

Return TRUE when something changed.   

References bitmap_empty_p(), calculate_dominance_info(), CDI_DOMINATORS, cfun, substitute_and_fold_dom_walker::dceworklist, dom_info_state(), dump_file, dump_flags, ENTRY_BLOCK_PTR_FOR_FN, fixup_noreturn_call(), gcc_assert, gimple_purge_all_dead_abnormal_call_edges(), gimple_purge_all_dead_eh_edges(), substitute_and_fold_dom_walker::need_ab_cleanup, substitute_and_fold_dom_walker::need_eh_cleanup, prop_stats_d::num_const_prop, prop_stats_d::num_copy_prop, prop_stats_d::num_stmts_folded, print_gimple_stmt(), prop_stats, simple_dce_from_worklist(), substitute_and_fold_dom_walker::something_changed, statistics_counter_event(), substitute_and_fold_dom_walker::stmts_to_fixup, TDF_DETAILS, and dom_walker::walk().

Referenced by ccp_finalize(), execute_fast_vrp(), execute_ranger_vrp(), and fini_copy_prop().

◆ value_of_expr()

virtual tree substitute_and_fold_engine::value_of_expr ( tree expr,
gimple * = NULL )
pure virtual

◆ value_of_stmt()

tree substitute_and_fold_engine::value_of_stmt ( gimple * stmt,
tree name = NULL )
overridevirtual

◆ value_on_edge()

tree substitute_and_fold_engine::value_on_edge ( edge ,
tree expr )
overridevirtual

Reimplemented from range_query.

Reimplemented in fvrp_folder, and rvrp_folder.

References value_of_expr().

Referenced by propagate_into_phi_args(), and replace_phi_args_in().

◆ value_on_entry()

tree range_query::value_on_entry ( basic_block bb,
tree expr )
virtualinherited

◆ value_on_exit()

tree range_query::value_on_exit ( basic_block bb,
tree expr )
virtualinherited

Field Documentation

◆ fold_all_stmts

bool substitute_and_fold_engine::fold_all_stmts

◆ m_gori

◆ m_infer

◆ m_map

◆ m_relation

◆ m_shared_copy_p

bool range_query::m_shared_copy_p
protectedinherited

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