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

Data Structures

struct  [struct].sink_stats

Functions

static basic_block find_bb_for_arg (gphi *phi, tree def)
static bool all_immediate_uses_same_place (def_operand_p def_p)
static basic_block nearest_common_dominator_of_uses (def_operand_p def_p, bool *debug_stmts)
static bool do_not_sink (gimple *stmt, basic_block early_bb, basic_block best_bb)
static basic_block select_best_block (basic_block early_bb, basic_block late_bb, gimple *stmt)
static bool statement_sink_location (gimple *stmt, basic_block frombb, gimple_stmt_iterator *togsi, bool *zero_uses_p, virtual_operand_live &vop_live)
static unsigned sink_common_stores_to_bb (basic_block bb)
static unsigned sink_code_in_bb (basic_block bb, virtual_operand_live &vop_live)
gimple_opt_passmake_pass_sink_code (gcc::context *ctxt)

Variables

static struct  sink_stats

Function Documentation

◆ all_immediate_uses_same_place()

bool all_immediate_uses_same_place ( def_operand_p def_p)
static
When the first immediate use is in a statement, then return true if all
immediate uses in IMM are in the same statement.
We could also do the case where  the first immediate use is in a phi node,
and all the other uses are in phis in the same basic block, but this
requires some expensive checking later (you have to make sure no def/vdef
in the statement occurs for multiple edges in the various phi nodes it's
used in, so that you only have one place you can sink it to.   

References all_immediate_uses_same_place(), DEF_FROM_PTR, FOR_EACH_IMM_USE_FAST, is_gimple_debug(), NULL, and USE_STMT.

Referenced by all_immediate_uses_same_place(), and statement_sink_location().

◆ do_not_sink()

bool do_not_sink ( gimple * stmt,
basic_block early_bb,
basic_block best_bb )
static

◆ find_bb_for_arg()

basic_block find_bb_for_arg ( gphi * phi,
tree def )
static
Given a PHI, and one of its arguments (DEF), find the edge for
that argument and return it.  If the argument occurs twice in the PHI node,
we return NULL.   

References find_bb_for_arg(), gimple_phi_arg_edge(), gimple_phi_num_args(), i, NULL, and PHI_ARG_DEF.

Referenced by find_bb_for_arg(), and statement_sink_location().

◆ make_pass_sink_code()

gimple_opt_pass * make_pass_sink_code ( gcc::context * ctxt)

◆ nearest_common_dominator_of_uses()

◆ select_best_block()

basic_block select_best_block ( basic_block early_bb,
basic_block late_bb,
gimple * stmt )
static
Given EARLY_BB and LATE_BB, two blocks in a path through the dominator
tree, return the best basic block between them (inclusive) to place
statements.

We want the most control dependent block in the shallowest loop nest.

If the resulting block is in a shallower loop nest, then use it.   

References profile_probability::always(), bb_loop_depth(), CDI_DOMINATORS, CDI_POST_DOMINATORS, do_not_sink(), dominated_by_p(), basic_block_def::flags, gcc_checking_assert, get_immediate_dominator(), select_best_block(), single_pred_edge(), and single_pred_p().

Referenced by select_best_block(), and statement_sink_location().

◆ sink_code_in_bb()

◆ sink_common_stores_to_bb()

◆ statement_sink_location()

bool statement_sink_location ( gimple * stmt,
basic_block frombb,
gimple_stmt_iterator * togsi,
bool * zero_uses_p,
virtual_operand_live & vop_live )
static

Variable Documentation

◆ sink_stats

struct [struct].sink_stats sink_stats