GCC Middle and Back End API Reference
|
#include "partition.h"
Go to the source code of this file.
Data Structures | |
struct | _var_map |
struct | tree_live_info_d |
class | virtual_operand_live |
Macros | |
#define | NO_PARTITION -1 |
#define | LIVEDUMP_ENTRY 0x01 |
#define | LIVEDUMP_EXIT 0x02 |
#define | LIVEDUMP_ALL (LIVEDUMP_ENTRY | LIVEDUMP_EXIT) |
Typedefs | |
typedef struct _var_map * | var_map |
typedef struct tree_live_info_d * | tree_live_info_p |
typedef hash_map< int_hash< unsigned int, -1U >, unsigned int > | live_vars_map |
#define LIVEDUMP_ALL (LIVEDUMP_ENTRY | LIVEDUMP_EXIT) |
#define LIVEDUMP_ENTRY 0x01 |
Referenced by coalesce_ssa_name(), and dump_live_info().
#define LIVEDUMP_EXIT 0x02 |
Referenced by dump_live_info().
#define NO_PARTITION -1 |
Value used to represent no partition number.
Referenced by add_dependence(), adjust_one_expanded_partition_var(), attempt_coalesce(), calculate_live_on_exit(), eliminate_build(), expand_debug_expr(), expand_one_register_var(), expand_one_ssa_partition(), expand_one_stack_var(), find_replaceable_in_bb(), get_rtx_for_ssa_name(), get_undefined_value_partitions(), live_track_clear_var(), live_track_live_p(), live_track_process_def(), live_track_process_use(), new_temp_expr_table(), queue_phi_copy_p(), rewrite_trees(), set_parm_default_def_partition(), set_parm_rtl(), set_rtl(), set_var_live_on_entry(), var_to_partition_to_var(), var_union(), and version_to_var().
typedef hash_map<int_hash <unsigned int, -1U>, unsigned int> live_vars_map |
typedef struct tree_live_info_d * tree_live_info_p |
---------------- live on entry/exit info ------------------------------ This structure is used to represent live range information on SSA based trees. A partition map must be provided, and based on the active partitions, live-on-entry information and live-on-exit information can be calculated. As well, partitions are marked as to whether they are global (live outside the basic block they are defined in). The live-on-entry information is per block. It provide a bitmap for each block which has a bit set for each partition that is live on entry to that block. The live-on-exit information is per block. It provides a bitmap for each block indicating which partitions are live on exit from the block. For the purposes of this implementation, we treat the elements of a PHI as follows: Uses in a PHI are considered LIVE-ON-EXIT to the block from which they originate. They are *NOT* considered live on entry to the block containing the PHI node. The Def of a PHI node is *not* considered live on entry to the block. It is considered to be "define early" in the block. Picture it as each block having a stmt (or block-preheader) before the first real stmt in the block which defines all the variables that are defined by PHIs. -----------------------------------------------------------------------
Routines for liveness in SSA trees. Copyright (C) 2003-2024 Free Software Foundation, Inc. Contributed by 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 <http://www.gnu.org/licenses/>.
Used to create the variable mapping when we go out of SSA form. Mapping from an ssa_name to a partition number is maintained, as well as partition number back to ssa_name. This data structure also supports "views", which work on a subset of all partitions. This allows the coalescer to decide what partitions are interesting to it, and only work with those partitions. Whenever the view is changed, the partition numbers change, but none of the partition groupings change. (ie, it is truly a view since it doesn't change anything) The final component of the data structure is the basevar map. This provides a list of all the different base variables which occur in a partition view, and a unique index for each one. Routines are provided to quickly produce the base variable of a partition. Note that members of a partition MUST all have the same base variable.
|
inline |
Return the index into the basevar table for PARTITION's base in MAP.
References gcc_checking_assert, map, and num_var_partitions().
Referenced by live_track_add_partition(), live_track_live_p(), live_track_process_def(), and live_track_remove_partition().
|
extern |
Given partition map MAP, calculate all the live on entry bitmaps for each partition. Return a new live info object.
References bitmap_obstack_release(), calculate_live_on_exit(), free(), i, live_worklist(), tree_live_info_d::livein, tree_live_info_d::livein_obstack, map, new_tree_live_info(), NULL, NULL_TREE, num_var_partitions(), partition_to_var(), set_var_live_on_entry(), and verify_live_on_entry().
Referenced by coalesce_ssa_name().
|
extern |
For function FN and live_vars_map (hash map from DECL_UIDs to a dense set of indexes of automatic variables VARS, compute which of those variables are (might be) live at the end of each basic block.
References BASIC_BLOCK_FOR_FN, BITMAP_ALLOC, bitmap_default_obstack, BITMAP_FREE, bitmap_initialize(), bitmap_ior_into(), changed, compute_live_vars_1(), free(), i, basic_block_def::index, last_basic_block_for_fn, NULL, and pre_and_rev_post_order_compute_fn().
Referenced by add_clobbers_to_eh_landing_pad(), and find_tail_calls().
|
extern |
Generic dump for the above.
References dump_var_map().
|
extern |
Generic dump for the above.
References dump_live_info().
|
extern |
References debug.
|
extern |
Dump the tree of lexical scopes starting at SCOPE to stderr. FLAGS is as in print_generic_expr.
References dump_scope_block().
|
extern |
Dump the tree of lexical scopes of current_function_decl to stderr. FLAGS is as in print_generic_expr.
References dump_scope_blocks().
|
extern |
Free storage for live range info object LIVE.
References bitmap_obstack_release(), free(), tree_live_info_d::livein, tree_live_info_d::livein_obstack, tree_live_info_d::liveout, tree_live_info_d::liveout_obstack, and tree_live_info_d::work_stack.
Referenced by coalesce_ssa_name().
|
extern |
Free memory associated with MAP.
References BITMAP_FREE, free(), map, and var_map_base_fini().
Referenced by finish_out_of_ssa().
|
extern |
Destroy what compute_live_vars has returned when it is no longer needed.
References bitmap_clear(), and i.
Referenced by add_clobbers_to_eh_landing_pad(), and tree_optimize_tail_calls_1().
|
extern |
Output live range info LIVE to file F, controlled by FLAG.
References cfun, EXECUTE_IF_SET_IN_BITMAP, FOR_EACH_BB_FN, i, basic_block_def::index, LIVEDUMP_ENTRY, LIVEDUMP_EXIT, tree_live_info_d::livein, tree_live_info_d::liveout, map, tree_live_info_d::map, partition_to_var(), print_generic_expr(), and TDF_SLIM.
Referenced by coalesce_ssa_name(), and debug().
|
extern |
Dump the tree of lexical scopes of current_function_decl to FILE. FLAGS is as in print_generic_expr.
References current_function_decl, DECL_INITIAL, and dump_scope_block().
Referenced by debug_scope_blocks(), execute_build_cfg(), and remove_unused_locals().
|
extern |
Output partition map MAP to file F.
References map, NULL, NULL_TREE, num_ssa_names, partition_to_var(), print_generic_expr(), ssa_name, TDF_SLIM, virtual_operand_p(), and y.
Referenced by coalesce_ssa_name(), debug(), gimple_lower_bitint(), and remove_ssa_form().
Create a variable partition map of SIZE for region, initialize and return it. Region is a loop if LOOP is non-NULL, otherwise is the current function. If BITINT is non-NULL, only SSA_NAMEs from that bitmap will be coalesced.
References BITMAP_ALLOC, bitmap_set_bit, cfun, FOR_EACH_BB_FN, free(), get_loop_body_in_dom_order(), i, basic_block_def::index, map, n_basic_blocks_for_fn, NULL, NUM_FIXED_BLOCKS, loop::num_nodes, and vNULL.
Referenced by gimple_lower_bitint(), and remove_ssa_form().
|
inline |
Return the bitmap from LIVE representing the live on entry blocks for partition P.
References cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, gcc_checking_assert, basic_block_def::index, and tree_live_info_d::livein.
Referenced by calculate_live_on_exit(), loe_visit_block(), and verify_live_on_entry().
|
inline |
Return the bitmap from LIVE representing the live on exit partitions from block BB.
References cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, gcc_checking_assert, basic_block_def::index, and tree_live_info_d::liveout.
Referenced by build_ssa_conflict_graph().
|
inline |
Return the partition map which the information in LIVE utilizes.
References tree_live_info_d::map.
Referenced by build_ssa_conflict_graph().
|
extern |
For ACTIVE computed by compute_live_vars, compute a bitmap of variables live after the STOP_AFTER statement and return that bitmap.
References BITMAP_ALLOC, compute_live_vars_1(), gimple_bb(), and NULL.
Referenced by find_tail_calls().
|
inline |
Mark partition P as live on entry to basic block BB in LIVE.
References bitmap_set_bit, basic_block_def::index, and tree_live_info_d::livein.
|
inline |
Return the number of different base variables in MAP.
References map.
Referenced by new_live_track().
|
inline |
Return number of partitions in MAP.
References map.
Referenced by basevar_index(), build_ssa_conflict_graph(), calculate_live_ranges(), coalesce_bitint(), coalesce_ssa_name(), compute_optimized_partition_bases(), debug_ter(), free_temp_expr_table(), gimple_lower_bitint(), new_temp_expr_table(), and verify_live_on_entry().
Given partition index I from MAP, return the variable which represents that partition.
References i, map, and ssa_name.
Referenced by attempt_coalesce(), calculate_live_ranges(), coalesce_bitint(), compute_optimized_partition_bases(), dump_live_info(), dump_part_var_map(), dump_var_map(), elim_create(), expand_used_vars(), insert_part_to_rtx_on_edge(), insert_partition_copy_on_edge(), insert_rtx_to_part_on_edge(), insert_value_copy_on_edge(), var_to_partition_to_var(), verify_live_on_entry(), and version_to_var().
Create a partition view in MAP which includes just partitions which occur in the bitmap ONLY. If WANT_BASES is true, create the base variable map as well.
References BITMAP_ALLOC, bitmap_bit_p, bitmap_set_bit, EXECUTE_IF_SET_IN_BITMAP, gcc_assert, map, NULL, partition_view_fini(), partition_view_init(), and var_map_base_fini().
Referenced by coalesce_ssa_name().
|
extern |
Create a partition view which includes all the used partitions in MAP.
References map, partition_view_fini(), partition_view_init(), and var_map_base_fini().
Referenced by gimple_lower_bitint(), and remove_ssa_form().
|
inline |
Return TRUE if region of the MAP contains basic block BB.
References bitmap_bit_p, ENTRY_BLOCK, EXIT_BLOCK, basic_block_def::index, and map.
Referenced by calculate_live_on_exit(), loe_visit_block(), set_var_live_on_entry(), and verify_live_on_entry().
|
extern |
Remove local variables that are not referenced in the IL.
References b, BITMAP_ALLOC, bitmap_bit_p, BITMAP_FREE, bitmap_set_bit, cfun, clear_unused_block_pointer(), current_function_decl, DECL_HARD_REGISTER, DECL_INITIAL, DECL_P, DECL_UID, dump_file, dump_flags, dump_scope_blocks(), FOR_EACH_BB_FN, FOR_EACH_EDGE, FOR_EACH_PHI_ARG, get_base_address(), gimple_assign_lhs(), gimple_block(), gimple_call_internal_p(), gimple_call_lhs(), gimple_clobber_p(), gimple_debug_bind_get_value(), gimple_debug_bind_get_var(), gimple_debug_bind_p(), gimple_num_ops(), gimple_op_ptr(), gimple_phi_arg_location(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_remove(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), i, is_gimple_debug(), is_global_var(), is_used_p(), LOCATION_BLOCK, mark_all_vars_used(), mark_scope_block_unused(), NULL, NULL_TREE, PHI_ARG_INDEX_FROM_USE, polymorphic_ctor_dtor_p(), release_defs(), release_ssa_name(), remove_unused_scope_block_p(), set_ssa_default_def(), loop::simduid, ssa_default_def(), SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, SSA_OP_ALL_USES, statistics_counter_event(), basic_block_def::succs, TDF_DETAILS, timevar_pop(), timevar_push(), TREE_CODE, TREE_OPERAND, TREE_USED, unlink_stmt_vdef(), USE_FROM_PTR, usedvars, VAR_P, vec_safe_length(), and virtual_operand_p().
Referenced by execute_function_todo().
Given VAR, return the partition number in MAP which contains it. NO_PARTITION is returned if it's not in any partition.
References map, and SSA_NAME_VERSION.
Referenced by add_dependence(), adjust_one_expanded_partition_var(), attempt_coalesce(), calculate_live_on_exit(), coalesce_bitint(), compute_optimized_partition_bases(), dump_part_var_map(), eliminate_build(), expand_debug_expr(), expand_one_register_var(), expand_one_ssa_partition(), expand_one_stack_var(), expand_stack_vars(), find_replaceable_in_bb(), get_undefined_value_partitions(), gimple_lower_bitint(), initialize_conflict_count(), live_track_clear_var(), live_track_live_p(), live_track_process_def(), live_track_process_use(), new_temp_expr_table(), queue_phi_copy_p(), rewrite_trees(), set_parm_default_def_partition(), set_parm_rtl(), set_rtl(), set_var_live_on_entry(), and var_to_partition_to_var().
Given VAR, return the variable which represents the entire partition it is a member of in MAP. NULL is returned if it is not in a partition.
References map, NO_PARTITION, NULL_TREE, partition_to_var(), and var_to_partition().
Referenced by rewrite_trees().
This function will combine the partitions in MAP for VAR1 and VAR2. It Returns the partition which represents the new partition. If the two partitions cannot be combined, NO_PARTITION is returned.
References gcc_assert, map, NO_PARTITION, SSA_NAME_VERSION, and TREE_CODE.
Referenced by attempt_coalesce().
Given ssa_name VERSION, if it has a partition in MAP, return the var it is associated with. Otherwise return NULL.
References map, NO_PARTITION, NULL_TREE, and partition_to_var().
Referenced by dump_part_var_map().