GCC Middle and Back End API Reference
tree-ssa-ter.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "gimple-iterator.h"
#include "dumpfile.h"
#include "tree-ssa-live.h"
#include "tree-ssa-ter.h"
#include "tree-outof-ssa.h"
#include "gimple-walk.h"
Include dependency graph for tree-ssa-ter.cc:

Data Structures

struct  temp_expr_table
 

Macros

#define VIRTUAL_PARTITION(table)   (table->virtual_partition)
 

Functions

void debug_ter (FILE *, temp_expr_table *)
 
static temp_expr_tablenew_temp_expr_table (var_map map)
 
static bitmap free_temp_expr_table (temp_expr_table *t)
 
static bool version_to_be_replaced_p (temp_expr_table *tab, int version)
 
static void make_dependent_on_partition (temp_expr_table *tab, int version, int p)
 
static void add_to_partition_kill_list (temp_expr_table *tab, int p, int ver)
 
static void remove_from_partition_kill_list (temp_expr_table *tab, int p, int version)
 
static void add_dependence (temp_expr_table *tab, int version, tree var)
 
static void finished_with_expr (temp_expr_table *tab, int version, bool free_expr)
 
static bool ter_is_replaceable_p (gimple *stmt)
 
static void process_replaceable (temp_expr_table *tab, gimple *stmt, int call_cnt, int reg_vars_cnt)
 
static void kill_expr (temp_expr_table *tab, int partition)
 
static void kill_virtual_exprs (temp_expr_table *tab)
 
static void mark_replaceable (temp_expr_table *tab, tree var, bool more_replacing)
 
static tree find_ssaname (tree *tp, int *walk_subtrees, void *data)
 
static bool find_ssaname_in_store (gimple *, tree, tree t, void *data)
 
static void find_replaceable_in_bb (temp_expr_table *tab, basic_block bb)
 
bitmap find_replaceable_exprs (var_map map)
 
void dump_replaceable_exprs (FILE *f, bitmap expr)
 

Variables

static bitmap_obstack ter_bitmap_obstack
 

Macro Definition Documentation

◆ VIRTUAL_PARTITION

#define VIRTUAL_PARTITION ( table)    (table->virtual_partition)
Used to indicate a dependency on VDEFs.   

Referenced by debug_ter(), kill_virtual_exprs(), and process_replaceable().

Function Documentation

◆ add_dependence()

static void add_dependence ( temp_expr_table * tab,
int version,
tree var )
static
Add a dependency between the def of ssa VERSION and VAR.  If VAR is
replaceable by an expression, add a dependence each of the elements of the
expression.  These are contained in the new_replaceable list.  TAB is the
expression table.   

References add_to_partition_kill_list(), BITMAP_ALLOC, bitmap_clear(), bitmap_empty_p(), bitmap_ior_into(), EXECUTE_IF_SET_IN_BITMAP, gcc_checking_assert, ggc_alloc(), i, make_dependent_on_partition(), NO_PARTITION, SSA_NAME_VERSION, ter_bitmap_obstack, var_to_partition(), and version_to_be_replaced_p().

Referenced by process_replaceable().

◆ add_to_partition_kill_list()

static void add_to_partition_kill_list ( temp_expr_table * tab,
int p,
int ver )
inlinestatic
Add VER to the kill list for P.  TAB is the expression table  

References BITMAP_ALLOC, bitmap_set_bit, ggc_alloc(), and ter_bitmap_obstack.

Referenced by add_dependence(), and process_replaceable().

◆ debug_ter()

◆ dump_replaceable_exprs()

void dump_replaceable_exprs ( FILE * f,
bitmap expr )
Dump TER expression table EXPR to file F.   

References bitmap_bit_p, ggc_alloc(), num_ssa_names, print_generic_expr(), print_gimple_stmt(), ssa_name, SSA_NAME_DEF_STMT, and TDF_SLIM.

Referenced by debug_ter(), and remove_ssa_form().

◆ find_replaceable_exprs()

bitmap find_replaceable_exprs ( var_map map)
This function is the driver routine for replacement of temporary expressions
in the SSA->normal phase, operating on MAP.  If there are replaceable
expressions, a table is returned which maps SSA versions to the
expressions they should be replaced with.  A NULL_TREE indicates no
replacement should take place.  If there are no replacements at all,
NULL is returned by the function, otherwise an expression vector indexed
by SSA_NAME version numbers.   

References bitmap_empty_p(), bitmap_obstack_initialize(), bitmap_obstack_release(), cfun, find_replaceable_in_bb(), FOR_EACH_BB_FN, free_temp_expr_table(), gcc_checking_assert, ggc_alloc(), map, new_temp_expr_table(), table, and ter_bitmap_obstack.

Referenced by remove_ssa_form().

◆ find_replaceable_in_bb()

◆ find_ssaname()

static tree find_ssaname ( tree * tp,
int * walk_subtrees,
void * data )
static
Helper function for find_ssaname_in_stores.  Called via walk_tree to
find a SSA_NAME DATA somewhere in *TP.   

References ggc_alloc(), IS_TYPE_OR_DECL_P, and NULL_TREE.

Referenced by find_ssaname_in_store().

◆ find_ssaname_in_store()

static bool find_ssaname_in_store ( gimple * ,
tree ,
tree t,
void * data )
static
Helper function for find_replaceable_in_bb.  Return true if SSA_NAME DATA
is used somewhere in T, which is a store in the statement.  Called via
walk_stmt_load_store_addr_ops.   

References find_ssaname(), NULL, NULL_TREE, and walk_tree.

Referenced by find_replaceable_in_bb().

◆ finished_with_expr()

static void finished_with_expr ( temp_expr_table * tab,
int version,
bool free_expr )
static
This function will remove the expression for VERSION from replacement
consideration in table TAB.  If FREE_EXPR is true, then remove the
expression from consideration as well by freeing the decl uid bitmap.   

References BITMAP_FREE, EXECUTE_IF_SET_IN_BITMAP, ggc_alloc(), i, and remove_from_partition_kill_list().

Referenced by find_replaceable_in_bb(), kill_expr(), and mark_replaceable().

◆ free_temp_expr_table()

◆ kill_expr()

static void kill_expr ( temp_expr_table * tab,
int partition )
inlinestatic
This function removes any expression in TAB which is dependent on PARTITION
from consideration, making it not replaceable.   

References bitmap_first_set_bit(), finished_with_expr(), gcc_checking_assert, and ggc_alloc().

Referenced by find_replaceable_in_bb(), and kill_virtual_exprs().

◆ kill_virtual_exprs()

static void kill_virtual_exprs ( temp_expr_table * tab)
inlinestatic
This function kills all expressions in TAB which are dependent on virtual
partitions.   

References ggc_alloc(), kill_expr(), and VIRTUAL_PARTITION.

Referenced by find_replaceable_in_bb().

◆ make_dependent_on_partition()

static void make_dependent_on_partition ( temp_expr_table * tab,
int version,
int p )
inlinestatic
Add partition P to the list if partitions VERSION is dependent on.  TAB is
the expression table  

References BITMAP_ALLOC, bitmap_set_bit, ggc_alloc(), and ter_bitmap_obstack.

Referenced by add_dependence(), and process_replaceable().

◆ mark_replaceable()

static void mark_replaceable ( temp_expr_table * tab,
tree var,
bool more_replacing )
static
Mark the expression associated with VAR as replaceable, and enter
the defining stmt into the partition_dependencies table TAB.  If
MORE_REPLACING is true, accumulate the pending partition dependencies.   

References BITMAP_ALLOC, bitmap_ior_into(), bitmap_set_bit, finished_with_expr(), ggc_alloc(), NULL, and SSA_NAME_VERSION.

Referenced by find_replaceable_in_bb().

◆ new_temp_expr_table()

◆ process_replaceable()

◆ remove_from_partition_kill_list()

static void remove_from_partition_kill_list ( temp_expr_table * tab,
int p,
int version )
inlinestatic
Remove VER from the partition kill list for P.  TAB is the expression
table.   

References bitmap_clear_bit(), bitmap_empty_p(), BITMAP_FREE, gcc_checking_assert, and ggc_alloc().

Referenced by finished_with_expr().

◆ ter_is_replaceable_p()

static bool ter_is_replaceable_p ( gimple * stmt)
inlinestatic
Return TRUE if expression STMT is suitable for replacement.
In addition to ssa_is_replaceable_p, require the same bb, and for -O0
same locus and same BLOCK), Considers memory loads as replaceable if aliasing
is available.   

References ggc_alloc(), gimple_bb(), gimple_location(), gimple_phi_arg_location(), LOCATION_BLOCK, LOCATION_LOCUS, NULL_TREE, PHI_ARG_INDEX_FROM_USE, single_imm_use(), SINGLE_SSA_TREE_OPERAND, ssa_is_replaceable_p(), SSA_OP_DEF, and UNKNOWN_LOCATION.

Referenced by find_replaceable_in_bb(), and process_replaceable().

◆ version_to_be_replaced_p()

static bool version_to_be_replaced_p ( temp_expr_table * tab,
int version )
inlinestatic
Return TRUE if VERSION is to be replaced by an expression in TAB.   

References bitmap_bit_p, and ggc_alloc().

Referenced by add_dependence().

Variable Documentation

◆ ter_bitmap_obstack

bitmap_obstack ter_bitmap_obstack
static