GCC Middle and Back End API 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"
Data Structures | |
struct | temp_expr_table |
Macros | |
#define | VIRTUAL_PARTITION(table) |
Variables | |
static bitmap_obstack | ter_bitmap_obstack |
#define VIRTUAL_PARTITION | ( | table | ) |
Used to indicate a dependency on VDEFs.
Referenced by debug_ter(), kill_virtual_exprs(), and process_replaceable().
|
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, i, make_dependent_on_partition(), temp_expr_table::map, temp_expr_table::new_replaceable_dependencies, NO_PARTITION, temp_expr_table::num_in_part, temp_expr_table::partition_dependencies, temp_expr_table::partition_in_use, SSA_NAME_VERSION, ter_bitmap_obstack, var_to_partition(), and version_to_be_replaced_p().
Referenced by process_replaceable().
|
inlinestatic |
Add VER to the kill list for P. TAB is the expression table
References BITMAP_ALLOC, bitmap_set_bit, temp_expr_table::kill_list, temp_expr_table::partition_in_use, and ter_bitmap_obstack.
Referenced by add_dependence(), and process_replaceable().
|
extern |
Dump the status of the various tables in the expression table. This is used exclusively to debug TER. F is the place to send debug info and T is the table being debugged.
References bitmap_empty_p(), bitmap_print(), temp_expr_table::call_cnt, dump_replaceable_exprs(), EXECUTE_IF_SET_IN_BITMAP, temp_expr_table::expr_decl_uids, temp_expr_table::kill_list, temp_expr_table::map, num_ssa_names, num_var_partitions(), temp_expr_table::partition_dependencies, temp_expr_table::partition_in_use, print_generic_expr(), temp_expr_table::replaceable_expressions, ssa_name, TDF_SLIM, VIRTUAL_PARTITION, and y.
void dump_replaceable_exprs | ( | FILE * | f, |
bitmap | expr ) |
Dump TER expression table EXPR to file F.
References bitmap_bit_p, 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().
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, map, new_temp_expr_table(), table, and ter_bitmap_obstack.
Referenced by remove_ssa_form().
|
static |
This function processes basic block BB, and looks for variables which can be replaced by their expressions. Results are stored in the table TAB.
References bitmap_bit_p, bitmap_clear(), bitmap_empty_p(), temp_expr_table::call_cnt, DECL_HARD_REGISTER, DECL_UID, temp_expr_table::expr_decl_uids, find_ssaname_in_store(), finished_with_expr(), fndecl_built_in_p(), FOR_EACH_SSA_TREE_OPERAND, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_call_fndecl(), gimple_could_trap_p(), gimple_has_volatile_ops(), gimple_vdef(), gimple_vuse(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_assign(), is_gimple_call(), is_gimple_debug(), kill_expr(), temp_expr_table::kill_list, kill_virtual_exprs(), map, temp_expr_table::map, mark_replaceable(), temp_expr_table::new_replaceable_dependencies, NO_PARTITION, NULL, NULL_USE_OPERAND_P, process_replaceable(), temp_expr_table::reg_vars_cnt, SINGLE_SSA_USE_OPERAND, SSA_NAME_DEF_STMT, SSA_NAME_VAR, SSA_NAME_VERSION, SSA_OP_DEF, SSA_OP_USE, stmt_may_clobber_ref_p(), ter_is_replaceable_p(), VAR_P, var_to_partition(), and walk_stmt_load_store_ops().
Referenced by find_replaceable_exprs().
Helper function for find_ssaname_in_stores. Called via walk_tree to find a SSA_NAME DATA somewhere in *TP.
References IS_TYPE_OR_DECL_P, and NULL_TREE.
Referenced by find_ssaname_in_store().
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().
|
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, temp_expr_table::expr_decl_uids, i, temp_expr_table::partition_dependencies, and remove_from_partition_kill_list().
Referenced by find_replaceable_in_bb(), kill_expr(), and mark_replaceable().
|
static |
Free TER table T. If there are valid replacements, return the expression vector.
References BITMAP_FREE, temp_expr_table::call_cnt, temp_expr_table::expr_decl_uids, free(), gcc_assert, temp_expr_table::kill_list, temp_expr_table::map, temp_expr_table::new_replaceable_dependencies, NULL, temp_expr_table::num_in_part, num_ssa_names, num_var_partitions(), temp_expr_table::partition_dependencies, temp_expr_table::partition_in_use, temp_expr_table::reg_vars_cnt, and temp_expr_table::replaceable_expressions.
Referenced by find_replaceable_exprs().
|
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 temp_expr_table::kill_list.
Referenced by find_replaceable_in_bb(), and kill_virtual_exprs().
|
inlinestatic |
This function kills all expressions in TAB which are dependent on virtual partitions.
References kill_expr(), and VIRTUAL_PARTITION.
Referenced by find_replaceable_in_bb().
|
inlinestatic |
Add partition P to the list if partitions VERSION is dependent on. TAB is the expression table
References BITMAP_ALLOC, bitmap_set_bit, temp_expr_table::partition_dependencies, and ter_bitmap_obstack.
Referenced by add_dependence(), and process_replaceable().
|
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(), temp_expr_table::new_replaceable_dependencies, NULL, temp_expr_table::partition_dependencies, temp_expr_table::replaceable_expressions, and SSA_NAME_VERSION.
Referenced by find_replaceable_in_bb().
|
static |
Create a new TER table for MAP.
References BITMAP_ALLOC, temp_expr_table::call_cnt, cfun, temp_expr_table::expr_decl_uids, FOR_EACH_SSA_NAME, temp_expr_table::kill_list, map, temp_expr_table::map, temp_expr_table::new_replaceable_dependencies, NO_PARTITION, NULL, temp_expr_table::num_in_part, num_ssa_names, num_var_partitions(), temp_expr_table::partition_dependencies, temp_expr_table::partition_in_use, temp_expr_table::reg_vars_cnt, temp_expr_table::replaceable_expressions, ter_bitmap_obstack, var_to_partition(), and temp_expr_table::virtual_partition.
Referenced by find_replaceable_exprs().
|
static |
Create an expression entry for a replaceable expression.
References add_dependence(), add_to_partition_kill_list(), BITMAP_ALLOC, BITMAP_FREE, bitmap_ior_into(), bitmap_set_bit, temp_expr_table::call_cnt, DECL_UID, temp_expr_table::expr_decl_uids, FOR_EACH_SSA_TREE_OPERAND, gcc_checking_assert, gimple_vuse(), make_dependent_on_partition(), temp_expr_table::reg_vars_cnt, SINGLE_SSA_TREE_OPERAND, SSA_NAME_VAR, SSA_NAME_VERSION, SSA_OP_DEF, SSA_OP_USE, ter_bitmap_obstack, ter_is_replaceable_p(), and VIRTUAL_PARTITION.
Referenced by find_replaceable_in_bb().
|
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, temp_expr_table::kill_list, and temp_expr_table::partition_in_use.
Referenced by finished_with_expr().
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 dyn_cast(), 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().
|
inlinestatic |
Return TRUE if VERSION is to be replaced by an expression in TAB.
References bitmap_bit_p, and temp_expr_table::replaceable_expressions.
Referenced by add_dependence().
|
static |
A place for the many, many bitmaps we create.
Referenced by add_dependence(), add_to_partition_kill_list(), find_replaceable_exprs(), make_dependent_on_partition(), new_temp_expr_table(), and process_replaceable().