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 bool range_on_edge (vrange &r, edge, tree expr)
virtual bool range_of_stmt (vrange &r, gimple *, tree name=NULL)
relation_kind query_relation (gimple *s, tree ssa1, tree ssa2, bool get_range=true)
relation_kind query_relation (edge e, tree ssa1, tree ssa2, bool get_range=true)
relation_oracleoracle () const
virtual void dump (FILE *)

Data Fields

bool fold_all_stmts

Protected Member Functions

bool get_tree_range (vrange &v, tree expr, gimple *stmt)
bool get_arith_expr_range (vrange &r, tree expr, gimple *stmt)

Protected Attributes


Constructor & Destructor Documentation

◆ substitute_and_fold_engine()

substitute_and_fold_engine::substitute_and_fold_engine ( bool fold_all_stmts = false)

◆ ~substitute_and_fold_engine()

virtual substitute_and_fold_engine::~substitute_and_fold_engine ( void )

Member Function Documentation

◆ dump()

void range_query::dump ( FILE * )

◆ fold_stmt()

virtual bool substitute_and_fold_engine::fold_stmt ( gimple_stmt_iterator * )

◆ get_arith_expr_range()

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

◆ get_tree_range()

◆ oracle()

◆ post_fold_bb()

virtual void substitute_and_fold_engine::post_fold_bb ( basic_block )

◆ post_new_stmt()

virtual void substitute_and_fold_engine::post_new_stmt ( gimple * )

◆ pre_fold_bb()

virtual void substitute_and_fold_engine::pre_fold_bb ( basic_block )

◆ pre_fold_stmt()

virtual void substitute_and_fold_engine::pre_fold_stmt ( gimple * )

◆ propagate_into_phi_args()

◆ query_relation() [1/2]

◆ query_relation() [2/2]

◆ range_of_expr()

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

Implements range_query.

◆ range_of_stmt()

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

◆ range_on_edge()

bool range_query::range_on_edge ( vrange & r,
edge ,
tree expr )
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
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

Reimplemented in ranger_cache, dom_ranger, and gimple_ranger.

References r, and range_query::range_of_expr().

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

◆ 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, ggc_alloc(), 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().

◆ 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

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, dom_info_state(), dump_file, dump_flags, ENTRY_BLOCK_PTR_FOR_FN, fixup_noreturn_call(), gcc_assert, ggc_alloc(), gimple_purge_all_dead_abnormal_call_edges(), gimple_purge_all_dead_eh_edges(), 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(), statistics_counter_event(), and TDF_DETAILS.

Referenced by ccp_finalize(), 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 )

◆ value_on_edge()

tree substitute_and_fold_engine::value_on_edge ( edge ,
tree expr )

Reimplemented from range_query.

Reimplemented in rvrp_folder, and fvrp_folder.

References value_of_expr().

Referenced by propagate_into_phi_args(), and replace_phi_args_in().

Field Documentation

◆ fold_all_stmts

bool substitute_and_fold_engine::fold_all_stmts

◆ m_oracle

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