GCC Middle and Back End API Reference
|
Data Structures | |
struct | coalesce_pair |
struct | coalesce_pair_hasher |
struct | cost_one_pair_d |
struct | coalesce_list_d |
struct | ssa_conflicts_d |
struct | live_track_d |
struct | ssa_name_var_hash |
Typedefs | |
typedef struct coalesce_pair * | coalesce_pair_p |
typedef struct coalesce_pair * | const_coalesce_pair_p |
typedef hash_table < coalesce_pair_hasher > | coalesce_table_type |
typedef coalesce_table_type::iterator | coalesce_iterator_type |
typedef struct cost_one_pair_d * | cost_one_pair_p |
typedef struct coalesce_list_d * | coalesce_list_p |
typedef struct ssa_conflicts_d * | ssa_conflicts_p |
typedef struct live_track_d * | live_track_p |
typedef coalesce_table_type::iterator coalesce_iterator_type |
typedef struct coalesce_list_d * coalesce_list_p |
This structure maintains the list of coalesce pairs.
typedef struct coalesce_pair * coalesce_pair_p |
@verbatim Coalesce SSA_NAMES together for the out-of-ssa pass.
Copyright (C) 2004-2013 Free Software Foundation, Inc. Contributed by Andrew MacLeod amacl eod@ redha t.co m
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/.
This set of routines implements a coalesce_list. This is an object which is used to track pairs of ssa_names which are desirable to coalesce together to avoid copies. Costs are associated with each pair, and when all desired information has been collected, the object can be used to order the pairs for processing.
This structure defines a pair entry.
typedef struct coalesce_pair* const_coalesce_pair_p |
typedef struct cost_one_pair_d * cost_one_pair_p |
typedef struct live_track_d * live_track_p |
This structure is used to efficiently record the current status of live SSA_NAMES when building a conflict graph. LIVE_BASE_VAR has a bit set for each base variable which has at least one ssa version live. LIVE_BASE_PARTITIONS is an array of bitmaps using the basevar table as an index, and is used to track what partitions of each base variable are live. This makes it easy to add conflicts between just live partitions with the same base variable. The values in LIVE_BASE_PARTITIONS are only valid if the base variable is marked as being live. This delays clearing of these bitmaps until they are actually needed again.
typedef struct ssa_conflicts_d * ssa_conflicts_p |
This represents a conflict graph. Implemented as an array of bitmaps. A full matrix is used for conflicts rather than just upper triangular form. this make sit much simpler and faster to perform conflict merges.
|
inlinestatic |
Add a coalesce between P1 and P2 in list CL with a cost of VALUE.
References coalesce_pair::cost, find_coalesce_pair(), and coalesce_list_d::sorted.
Referenced by coalesce_ssa_name(), and create_outofssa_var_map().
|
inlinestatic |
References coalesce_list_d::cost_one_list, cost_one_pair_d::first_element, cost_one_pair_d::next, and cost_one_pair_d::second_element.
Referenced by create_outofssa_var_map().
|
inlinestatic |
Attempt to coalesce ssa versions X and Y together using the partition mapping in MAP and checking conflicts in GRAPH. Output any debug info to DEBUG, if it is nun-NULL.
References partition_to_var(), print_generic_expr(), ssa_conflicts_merge(), ssa_conflicts_test_p(), var_to_partition(), and var_union().
Referenced by coalesce_partitions().
|
static |
Build a conflict graph based on LIVEINFO. Any partitions which are in the partition view of the var_map liveinfo is based on get entries in the conflict graph. Only conflicts between ssa_name partitions with the same base variable are added.
References delete_live_track(), gimple_assign_copy_p(), gimple_assign_lhs(), gimple_assign_rhs1(), graph, gsi_end_p(), gsi_last_bb(), gsi_next(), gsi_prev(), gsi_start_phis(), gsi_stmt(), is_gimple_assign(), is_gimple_debug(), live, live_on_exit(), live_track_clear_base_vars(), live_track_clear_var(), live_track_init(), live_track_live_p(), live_track_process_def(), live_track_process_use(), live_var_map(), map, new_live_track(), num_var_partitions(), and ssa_conflicts_new().
Referenced by coalesce_ssa_name().
|
inlinestatic |
Return cost of execution of copy instruction with FREQUENCY.
References frequency.
Referenced by coalesce_cost_bb(), coalesce_cost_edge(), and create_outofssa_var_map().
|
inlinestatic |
Return the cost of executing a copy instruction in basic block BB.
References coalesce_cost(), basic_block_def::frequency, and optimize_bb_for_size_p().
Referenced by create_outofssa_var_map().
|
inlinestatic |
Return the cost of executing a copy instruction on edge E.
References coalesce_cost(), edge_def::dest, edge_def::flags, mult, optimize_edge_for_size_p(), and basic_block_def::preds.
Referenced by create_outofssa_var_map().
|
static |
Attempt to Coalesce partitions in MAP which occur in the list CL using GRAPH. Debug output is sent to DEBUG if it is non-NULL.
References attempt_coalesce(), edge_def::dest_idx, fail_abnormal_edge_coalesce(), edge_def::flags, gimple_can_coalesce_p(), gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), pop_best_coalesce(), and basic_block_def::preds.
Referenced by coalesce_ssa_name().
var_map coalesce_ssa_name | ( | void | ) |
Reduce the number of copies by coalescing variables in the function. Return a partition map with the resulting coalesces.
References add_coalesce(), bitmap_set_bit(), build_ssa_conflict_graph(), calculate_live_ranges(), coalesce_partitions(), hash_table< Descriptor, Allocator >::create(), create_coalesce_list(), create_outofssa_var_map(), delete_coalesce_list(), delete_tree_live_info(), hash_table< Descriptor, Allocator >::dispose(), dump_coalesce_list(), dump_file, dump_flags, dump_live_info(), dump_var_map(), hash_table< Descriptor, Allocator >::find_slot(), graph, has_zero_uses(), map, num_var_partitions(), partition_view_bitmap(), sort_coalesce_list(), ssa_conflicts_delete(), and ssa_conflicts_dump().
Referenced by remove_ssa_form().
|
static |
Comparison function to allow qsort to sort P1 and P2 in Ascending order.
References coalesce_pair::cost.
Referenced by sort_coalesce_list().
|
inlinestatic |
Create a new empty coalesce list object and return it.
References coalesce_list_d::cost_one_list, hash_table< Descriptor, Allocator >::create(), coalesce_list_d::list, coalesce_list_d::num_sorted, and coalesce_list_d::sorted.
Referenced by coalesce_ssa_name().
|
static |
This function creates a var_map for the current function as well as creating a coalesce list for use later in the out of ssa process.
References add_coalesce(), add_cost_one_coalesce(), bitmap_set_bit(), coalesce_cost(), coalesce_cost_bb(), coalesce_cost_edge(), first, edge_def::flags, gimple_asm_input_op(), gimple_asm_ninputs(), gimple_asm_noutputs(), gimple_asm_output_op(), gimple_assign_copy_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_can_coalesce_p(), gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), has_single_use(), has_zero_uses(), init_var_map(), is_gimple_debug(), map, optimize_bb_for_size_p(), register_ssa_partition(), and virtual_operand_p().
Referenced by coalesce_ssa_name().
|
inlinestatic |
Delete coalesce list CL.
References coalesce_list_d::cost_one_list, hash_table< Descriptor, Allocator >::dispose(), free(), coalesce_list_d::list, coalesce_list_d::num_sorted, and coalesce_list_d::sorted.
Referenced by coalesce_ssa_name().
|
static |
This routine will free the memory associated with PTR.
References bitmap_obstack_release(), free(), live_track_d::live_base_partitions, and live_track_d::obstack.
Referenced by build_ssa_conflict_graph().
|
static |
Send debug info for coalesce list CL to file F.
References coalesce_pair::cost, coalesce_pair::first_element, coalesce_list_d::num_sorted, print_generic_expr(), coalesce_pair::second_element, and coalesce_list_d::sorted.
Referenced by coalesce_ssa_name().
|
inlinestatic |
Print a failure to coalesce a MUST_COALESCE pair X and Y.
References internal_error(), print_generic_expr(), and print_generic_stmt().
Referenced by coalesce_partitions().
|
static |
Find a matching coalesce pair object in CL for the pair P1 and P2. If one isn't found, return NULL if CREATE is false, otherwise create a new coalesce pair object and return it.
References coalesce_pair::cost, hash_table< Descriptor, Allocator >::find_slot_with_hash(), coalesce_pair::first_element, coalesce_pair_hasher::hash(), coalesce_list_d::list, coalesce_pair::second_element, and coalesce_list_d::sorted.
Referenced by add_coalesce().
bool gimple_can_coalesce_p | ( | ) |
Given SSA_NAMEs NAME1 and NAME2, return true if they are candidates for coalescing together, false otherwise. This must stay consistent with var_map_base_init in tree-ssa-live.c.
References types_compatible_p().
|
inlinestatic |
This function will adds PARTITION to the live list in PTR.
References basevar_index(), bitmap_clear(), bitmap_set_bit(), live_track_d::live_base_partitions, live_track_d::live_base_var, and live_track_d::map.
Referenced by live_track_init(), and live_track_process_use().
|
inlinestatic |
This routine will clear all live partitions in PTR.
References bitmap_clear(), and live_track_d::live_base_var.
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
Clear the live bit for VAR in PTR.
References live_track_remove_partition(), live_track_d::map, and var_to_partition().
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
Initialize PTR with the partitions set in INIT.
References live_track_add_partition().
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
Return TRUE if VAR is live in PTR.
References basevar_index(), bitmap_bit_p(), live_track_d::live_base_partitions, live_track_d::live_base_var, live_track_d::map, and var_to_partition().
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
This routine will process a DEF in PTR. DEF will be removed from the live lists, and if there are any other live partitions with the same base variable, conflicts will be added to GRAPH.
References basevar_index(), bitmap_bit_p(), live_track_d::live_base_partitions, live_track_d::live_base_var, live_track_remove_partition(), live_track_d::map, ssa_conflicts_add(), and var_to_partition().
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
This routine will add USE to PTR. USE will be marked as live in both the ssa live map and the live bitmap for the root of USE.
References live_track_add_partition(), live_track_d::map, and var_to_partition().
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
This function will remove PARTITION from the live list in PTR.
References basevar_index(), bitmap_clear_bit(), bitmap_empty_p(), live_track_d::live_base_partitions, live_track_d::live_base_var, and live_track_d::map.
Referenced by live_track_clear_var(), and live_track_process_def().
|
static |
This routine will create a new live track structure based on the partitions in MAP.
References bitmap_obstack_initialize(), live_track_d::live_base_partitions, live_track_d::live_base_var, map, live_track_d::map, num_basevars(), live_track_d::obstack, and _var_map::partition_to_base_index.
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
Return the number of unique coalesce pairs in CL.
References hash_table< Descriptor, Allocator >::elements(), and coalesce_list_d::list.
Referenced by sort_coalesce_list().
|
inlinestatic |
Retrieve the most expensive remaining pair to coalesce from CL. Returns the 2 elements via P1 and P2. Their calculated cost is returned by the function. NO_BEST_COALESCE is returned if the coalesce list is empty.
References coalesce_pair::cost, coalesce_pair::first_element, free(), coalesce_list_d::num_sorted, pop_cost_one_pair(), coalesce_pair::second_element, and coalesce_list_d::sorted.
Referenced by coalesce_partitions().
|
inlinestatic |
Retrieve a pair to coalesce from the cost_one_list in CL. Returns the 2 elements via P1 and P2. 1 is returned by the function if there is a pair, NO_BEST_COALESCE is returned if there aren't any.
References coalesce_list_d::cost_one_list, cost_one_pair_d::first_element, free(), cost_one_pair_d::next, and cost_one_pair_d::second_element.
Referenced by pop_best_coalesce().
|
inlinestatic |
Shortcut routine to print messages to file F of the form: "STR1 EXPR1 STR2 EXPR2 STR3."
References print_generic_expr().
|
static |
Prepare CL for removal of preferred pairs. When finished they are sorted in order from most important coalesce to least important.
References compare_pairs(), coalesce_pair::cost, num_coalesce_pairs(), coalesce_list_d::num_sorted, and coalesce_list_d::sorted.
Referenced by coalesce_ssa_name().
|
inlinestatic |
Add conflicts between X and Y in graph PTR.
References ssa_conflicts_add_one().
Referenced by live_track_process_def().
|
inlinestatic |
Add a conflict with Y to the bitmap for X in graph PTR.
References bitmap_set_bit(), ssa_conflicts_d::conflicts, and ssa_conflicts_d::obstack.
Referenced by ssa_conflicts_add().
|
inlinestatic |
Free storage for conflict graph PTR.
References bitmap_obstack_release(), ssa_conflicts_d::conflicts, free(), and ssa_conflicts_d::obstack.
Referenced by coalesce_ssa_name().
|
static |
Dump a conflicts graph.
References ssa_conflicts_d::conflicts, and dump_bitmap().
Referenced by coalesce_ssa_name().
|
inlinestatic |
Merge all Y's conflict into X in graph PTR.
References bitmap_ior_into(), bitmap_set_bit(), and ssa_conflicts_d::conflicts.
Referenced by attempt_coalesce().
|
inlinestatic |
Return an empty new conflict graph for SIZE elements.
References bitmap_obstack_initialize(), ssa_conflicts_d::conflicts, and ssa_conflicts_d::obstack.
Referenced by build_ssa_conflict_graph().
|
inlinestatic |
Test if elements X and Y conflict in graph PTR.
References bitmap_bit_p(), and ssa_conflicts_d::conflicts.
Referenced by attempt_coalesce().