GCC Middle and Back End API Reference
tree-ssa-phiprop.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "tree-eh.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "stor-layout.h"
#include "tree-ssa-loop.h"
#include "tree-cfg.h"
#include "tree-ssa-dce.h"
#include "cfgloop.h"
Include dependency graph for tree-ssa-phiprop.cc:

Data Structures

struct  phiprop_d

Functions

static tree phiprop_insert_phi (basic_block bb, gphi *phi, gimple *use_stmt, struct phiprop_d *phivn, size_t n, bitmap dce_ssa_names, tree other_vuse)
static bool chk_uses (tree, tree *idx, void *data)
static tree can_handle_load (gimple *load_stmt, basic_block bb, gphi *vphi, tree up_vuse, bool aggregate)
static bool propagate_with_phi (basic_block bb, gphi *vphi, gphi *phi, struct phiprop_d *phivn, size_t n, bitmap dce_ssa_names)
gimple_opt_passmake_pass_phiprop (gcc::context *ctxt)

Function Documentation

◆ can_handle_load()

tree can_handle_load ( gimple * load_stmt,
basic_block bb,
gphi * vphi,
tree up_vuse,
bool aggregate )
static
Check if we can move the loads from LOAD_STMT.
This is when the virtual use is the same as the
one active at the start of BB which we know either
from its virtual PHI def (VPHI) or from the common
incoming VUSE (up_vuse).  If neither is present
make sure the def stmt of the virtual use is in a
different basic block dominating BB.  When the def
is an edge-inserted one we know it dominates us.
Returns the vuse to use for the inserting.  NULL_TREE
is returned when we can't do the insert.   

References ao_ref_init(), CDI_DOMINATORS, dominated_by_p(), gcc_checking_assert, gimple_assign_rhs1(), gimple_bb(), gimple_clobber_p(), gimple_phi_result(), gimple_vuse(), NULL_TREE, SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and stmt_may_clobber_ref_p_1().

Referenced by propagate_with_phi().

◆ chk_uses()

bool chk_uses ( tree ,
tree * idx,
void * data )
static
Verify if *idx is available at *DATA.   

References CDI_DOMINATORS, dominated_by_p(), gimple_bb(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and TREE_CODE.

Referenced by propagate_with_phi().

◆ make_pass_phiprop()

gimple_opt_pass * make_pass_phiprop ( gcc::context * ctxt)

◆ phiprop_insert_phi()

◆ propagate_with_phi()

bool propagate_with_phi ( basic_block bb,
gphi * vphi,
gphi * phi,
struct phiprop_d * phivn,
size_t n,
bitmap dce_ssa_names )
static
Propagate between the phi node arguments of PHI in BB and phi result
users.  For now this matches
     # p_2 = PHI <&x, &y>
   <Lx>:;
     p_3 = p_2;
     z_2 = *p_3;
and converts it to
     # z_2 = PHI <x, y>
   <Lx>:;
Returns true if a transformation was done and edge insertions
need to be committed.  Global data PHIVN and N is used to track
past transformation results.  VPHI is the virtual PHI node in BB
if there is one.  We need to be especially careful here
with aliasing issues as we are moving memory reads.   

References calculate_dominance_info(), can_handle_load(), CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, changed, chk_uses(), dom_info_available_p(), dominated_by_p(), basic_block_def::flags, flow_loop_nested_p(), FOR_EACH_IMM_USE_FAST, FOR_EACH_IMM_USE_STMT, for_each_index(), FOR_EACH_PHI_ARG, get_immediate_dominator(), gimple_assign_lhs(), gimple_assign_lhs_ptr(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_set_rhs1(), gimple_assign_single_p(), gimple_assign_ssa_name_copy_p(), gimple_bb(), gimple_has_volatile_ops(), gimple_phi_arg_def(), gimple_vdef(), gimple_vuse(), gsi_for_stmt(), gsi_remove(), i, integer_zerop(), is_gimple_assign(), is_gimple_reg_type(), basic_block_def::loop_father, NULL_TREE, phi_arg_index_from_use(), PHI_RESULT, phiprop_insert_phi(), POINTER_TYPE_P, ref_maybe_used_by_stmt_p(), single_imm_use(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VERSION, SSA_OP_USE, stmt_can_throw_internal(), TREE_CODE, tree_could_trap_p(), TREE_OPERAND, TREE_TYPE, TYPE_MODE, types_compatible_p(), ui, unlink_stmt_vdef(), update_stmt(), USE_FROM_PTR, USE_STMT, phiprop_d::value, and phiprop_d::vuse.