GCC Middle and Back End API Reference
|
Data Structures | |
struct | move |
Typedefs | |
typedef void * | void_p |
typedef struct move * | move_t |
Variables | |
ira_emit_data_t | ira_allocno_emit_data |
static vec< void_p > | new_allocno_emit_data_vec |
static move_t * | at_bb_start |
static move_t * | at_bb_end |
static int | max_regno_before_changing |
static bitmap | local_allocno_bitmap |
static bitmap | used_regno_bitmap |
static bitmap | renamed_regno_bitmap |
static move_t | hard_regno_last_set [FIRST_PSEUDO_REGISTER] |
static int | hard_regno_last_set_check [FIRST_PSEUDO_REGISTER] |
static move_t * | allocno_last_set |
static int * | allocno_last_set_check |
static vec< move_t > | move_vec |
static int | curr_tick |
typedef void* void_p |
Definitions for vectors of pointers.
|
static |
Process moves from LIST with execution FREQ to add ranges, copies, and modify costs for allocnos involved in the moves. All regnos living through the list is in LIVE_THROUGH, and the loop tree node used to find corresponding allocnos is NODE.
References allocno_emit_reg(), bitmap_clear_bit(), live_range::finish, ira_allocno_copy::first, move::from, hard_regs_live, move::insn, internal_flag_ira_verbose, ior_hard_reg_conflicts(), ira_add_allocno_copy(), ira_add_live_range_to_object(), ira_allocate_object_conflicts(), ira_dump_file, ira_max_point, move::next, nr, ira_allocno_copy::num, ira_loop_tree_node::regno_allocno_map, ira_allocno_copy::second, live_range::start, move::to, and update_costs().
Referenced by add_ranges_and_copies().
|
static |
Process all move list to add ranges, conflicts, copies, and modify costs for allocnos involved in the moves.
References add_range_and_copies_from_move_list(), edge_def::aux, bitmap_and(), bitmap_copy(), edge_def::dest, df_get_live_in(), df_get_live_out(), basic_block_def::index, ira_allocate_bitmap(), ira_free_bitmap(), ira_loop_tree_node::parent, and basic_block_def::succs.
Referenced by ira_emit().
|
static |
Attach MOVE to the edge E. The move is attached to the head of the list if HEAD_P is TRUE.
References edge_def::aux, last, and move::next.
Referenced by generate_edge_moves().
|
static |
Change (if necessary) pseudo-registers inside loop given by loop tree node NODE.
References ira_loop_tree_node::all_allocnos, allocno_emit_reg(), ira_loop_tree_node::bb, bitmap_and_compl(), bitmap_set_bit(), ira_loop_tree_node::border_allocnos, change_regs(), df_insn_rescan(), df_notes_rescan(), loop::header, basic_block_def::index, internal_flag_ira_verbose, ira_allocnos, ira_create_new_reg(), ira_curr_loop_tree_node, ira_dump_file, ira_equiv_no_lvalue_p(), ira_loop_tree_root, ira_reg_equiv_len, ira_loop_tree_node::loop, ira_loop_tree_node::loop_num, map, ira_loop_tree_node::parent, ira_loop_tree_node::reg_pressure, ira_loop_tree_node::regno_allocno_map, and set_allocno_reg().
Referenced by ira_emit().
|
static |
This recursive function changes pseudo-registers in *LOC if it is necessary. The function returns TRUE if a change was done.
References allocno_emit_reg(), ira_curr_regno_allocno_map, and max_regno_before_changing.
Referenced by change_loop().
|
static |
Return new move of allocnos TO and FROM.
References move::deps, move::deps_num, move::from, move::insn, ira_allocate(), move::next, move::to, and move::visited_p.
Referenced by generate_edge_moves(), and modify_move_list().
|
static |
Create and return a new allocno with given REGNO and LOOP_TREE_NODE. Allocate emit data for it.
References ira_allocate(), ira_create_allocno(), and memset().
Referenced by modify_move_list().
|
static |
Generate RTX move insns from the move list LIST. This updates allocation cost using move execution frequency FREQ.
References allocno_emit_reg(), emit_insn(), emit_move_insn(), end_sequence(), move::from, get_insns(), grow_reg_equivs(), move::insn, ira_init_register_move_cost_if_necessary(), ira_load_cost, ira_overall_cost, ira_reg_equiv_len, ira_shuffle_cost, ira_store_cost, ira_update_equiv_info_by_shuffle_insn(), ira_use_lra_p, move::next, recog_memoized(), reg_equivs, start_sequence(), and move::to.
Referenced by emit_moves().
|
static |
Generate RTX move insns from move lists attached to basic blocks and edges.
References edge_def::aux, control_flow_insn_p(), edge_def::dest, emit_insn_after(), emit_insn_before(), emit_move_list(), edge_def::flags, get_last_insn(), basic_block_def::index, insert_insn_on_edge(), ira_additional_jumps_num, modify_move_list(), basic_block_def::next_bb, edge_def::src, and basic_block_def::succs.
Referenced by ira_emit().
|
static |
Return true if there is an entry to given loop not from its parent (or grandparent) block. For example, it is possible for two adjacent loops inside another loop.
References ira_loop_tree_node::bb, ira_loop_tree_node::children, ira_loop_tree_node::next, ira_loop_tree_node::parent, basic_block_def::preds, and edge_def::src.
Referenced by setup_entered_from_non_parent_p().
|
static |
Return TRUE if move lists on all edges given in vector VEC are equal.
References eq_move_lists_p().
Referenced by unify_moves().
|
static |
Return TRUE if the move list LIST1 and LIST2 are equal (two moves are equal if they involve the same allocnos).
References move::from, move::next, and move::to.
Referenced by eq_edge_move_lists_p().
|
static |
Free memory for MOVE and its dependencies.
References move::deps, and ira_free().
Referenced by free_move_list().
|
static |
Free memory for list of the moves given by its HEAD.
References free_move(), and move::next.
Referenced by ira_emit(), and unify_moves().
|
static |
Generate and attach moves to the edge E. This looks at the final regnos of allocnos living on the edge with the same original regno to figure out when moves should be generated.
References add_to_edge_list(), allocno_emit_reg(), edge_def::aux, bitmap_bit_p(), create_move(), edge_def::dest, df_get_live_in(), df_get_live_out(), internal_flag_ira_verbose, ira_dump_file, ira_loop_tree_node::parent, ira_loop_tree_node::regno_allocno_map, edge_def::src, and store_can_be_removed_p().
Referenced by ira_emit().
rtx ira_create_new_reg | ( | ) |
Create and return new pseudo-register with the same attributes as ORIGINAL_REG.
References gen_reg_rtx(), internal_flag_ira_verbose, ira_dump_file, and ira_expand_reg_equiv().
Referenced by change_loop(), find_moveable_pseudos(), and modify_move_list().
void ira_debug_move_list | ( | move_t | list | ) |
void ira_debug_move_list | ( | ) |
Print move list LIST into stderr.
References print_move_list().
void ira_emit | ( | ) |
The entry function changes code and generates shuffling allocnos on region borders for the regional (LOOPS_P is TRUE in this case) register allocation.
References add_ranges_and_copies(), allocno_last_set_check, edge_def::aux, change_loop(), commit_edge_insertions(), curr_tick, edge_def::dest, emit_moves(), free_move_list(), generate_edge_moves(), hard_regno_last_set_check, basic_block_def::index, ira_allocate(), ira_allocate_bitmap(), ira_allocnos_num, ira_free(), ira_free_bitmap(), ira_loop_tree_root, ira_traverse_loop_tree(), max_reg_num(), max_regno_before_changing, memset(), recog_memoized(), regno_reg_rtx, set_allocno_somewhere_renamed_p(), setup_entered_from_non_parent_p(), basic_block_def::succs, and unify_moves().
Referenced by ira().
void ira_finish_emit_data | ( | void | ) |
void ira_initiate_emit_data | ( | void | ) |
Allocate and initiate the emit data.
References ira_allocate(), ira_allocnos_num, and memset().
Referenced by ira().
|
static |
Remove unnecessary moves in the LIST, makes topological sorting, and removes cycles on hard reg dependencies by introducing new allocnos assigned to memory and additional moves. It returns the result move list.
References allocno_emit_reg(), create_move(), create_new_allocno(), curr_tick, move::deps, move::deps_num, first, move::from, hard_regno_last_set_check, internal_flag_ira_verbose, ira_allocate(), ira_create_allocno_objects(), ira_create_new_reg(), ira_dump_file, ira_move_loops_num, ira_objects_num, ira_set_allocno_class(), last, move::next, move::to, and traverse_moves().
Referenced by emit_moves().
|
static |
Print move list LIST into file F.
References move::from, move::next, and move::to.
Referenced by ira_debug_move_list().
|
static |
Set up member `reg' to REG for allocnos which has the same regno as ALLOCNO and which are inside the loop corresponding to ALLOCNO.
References ira_regno_allocno_map, ira_loop_tree_node::parent, ira_loop_tree_node::regno_allocno_map, and subloop_tree_node_p().
Referenced by change_loop().
|
static |
Process to set up flag somewhere_renamed_p.
References allocno_emit_reg(), and bitmap_bit_p().
Referenced by ira_emit().
|
static |
Set up ENTERED_FROM_NON_PARENT_P for each loop region.
References cfun, ira_loop_tree_node::entered_from_non_parent_p, entered_from_non_parent_p(), get_loops(), and ira_loop_nodes.
Referenced by ira_emit().
|
static |
Return TRUE if move of SRC_ALLOCNO (assigned to hard register) to DEST_ALLOCNO (assigned to memory) can be removed because it does not change value of the destination. One possible reason for this is the situation when SRC_ALLOCNO is not modified in the corresponding loop.
References allocno_emit_reg(), bitmap_bit_p(), ira_loop_tree_node::entered_from_non_parent_p, ira_loop_tree_node::modified_regnos, ira_loop_tree_node::parent, and ira_loop_tree_node::regno_allocno_map.
Referenced by generate_edge_moves().
|
static |
Return TRUE if loop given by SUBNODE inside the loop given by NODE.
References ira_loop_tree_node::parent.
Referenced by set_allocno_reg().
|
static |
This recursive function traverses dependencies of MOVE and produces topological sorting (in depth-first order).
References move::deps, move::deps_num, and move::visited_p.
Referenced by modify_move_list().
|
static |
Look at all entry edges (if START_P) or exit edges of basic block BB and put move lists at the BB start or end if it is possible. In other words, this decreases code duplication of allocno moves.
References edge_def::aux, control_flow_insn_p(), eq_edge_move_lists_p(), free_move_list(), basic_block_def::index, basic_block_def::preds, and basic_block_def::succs.
Referenced by ira_emit().
|
static |
Update costs of A and corresponding allocnos on upper levels on the loop tree from reading (if READ_P) or writing A on an execution path with FREQ.
References ira_loop_tree_node::regno_allocno_map.
Referenced by add_range_and_copies_from_move_list().
|
static |
Last move (in move sequence being processed) setting up the corresponding allocno.
|
static |
If the element value is equal to CURR_TICK then the corresponding element in . `allocno_last_set' is defined and correct.
Referenced by ira_emit().
|
static |
|
static |
Array of moves (indexed by BB index) which should be put at the start/end of the corresponding basic blocks.
|
static |
The variable value is used to check correctness of values of elements of arrays `hard_regno_last_set' and `allocno_last_set_check'.
Referenced by ira_emit(), and modify_move_list().
|
static |
Last move (in move sequence being processed) setting up the corresponding hard register.
|
static |
If the element value is equal to CURR_TICK then the corresponding element in `hard_regno_last_set' is defined and correct.
Referenced by ira_emit(), and modify_move_list().
ira_emit_data_t ira_allocno_emit_data |
@verbatim Integrated Register Allocator. Changing code and generating moves.
Copyright (C) 2006-2013 Free Software Foundation, Inc. Contributed by Vladimir Makarov vmaka. rov@ 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/.
When we have more one region, we need to change the original RTL code after coloring. Let us consider two allocnos representing the same pseudo-register outside and inside a region respectively. They can get different hard-registers. The reload pass works on pseudo registers basis and there is no way to say the reload that pseudo could be in different registers and it is even more difficult to say in what places of the code the pseudo should have particular hard-registers. So in this case IRA has to create and use a new pseudo-register inside the region and adds code to move allocno values on the region's borders. This is done by the code in this file. The code makes top-down traversal of the regions and generate new pseudos and the move code on the region borders. In some complicated cases IRA can create a new pseudo used temporarily to move allocno values when a swap of values stored in two hard-registers is needed (e.g. two allocnos representing different pseudos outside region got respectively hard registers 1 and 2 and the corresponding allocnos inside the region got respectively hard registers 2 and 1). At this stage, the new pseudo is marked as spilled. IRA still creates the pseudo-register and the moves on the region borders even when the both corresponding allocnos were assigned to the same hard-register. It is done because, if the reload pass for some reason spills a pseudo-register representing the original pseudo outside or inside the region, the effect will be smaller because another pseudo will still be in the hard-register. In most cases, this is better then spilling the original pseudo in its whole live-range. If reload does not change the allocation for the two pseudo-registers, the trivial move will be removed by post-reload optimizations. IRA does not generate a new pseudo and moves for the allocno values if the both allocnos representing an original pseudo inside and outside region assigned to the same hard register when the register pressure in the region for the corresponding pressure class is less than number of available hard registers for given pressure class. IRA also does some optimizations to remove redundant moves which is transformed into stores by the reload pass on CFG edges representing exits from the region. IRA tries to reduce duplication of code generated on CFG edges which are enters and exits to/from regions by moving some code to the edge sources or destinations when it is possible.
Data used to emit live range split insns and to flattening IR.
|
static |
Bitmap of allocnos local for the current loop.
|
static |
Max regno before renaming some pseudo-registers. For example, the same pseudo-register can be renamed in a loop if its allocation is different outside the loop.
Referenced by change_regs(), and ira_emit().
Definition of vector of moves.
This vec contains moves sorted topologically (depth-first) on their dependency graph.
Pointers to data allocated for allocnos being created during emitting. Usually there are quite few such allocnos because they are created only for resolving loop in register shuffling.
|
static |
This bitmap contains regnos of allocnos which were renamed locally because the allocnos correspond to disjoint live ranges in loops with a common parent.
|
static |
This bitmap is used to find that we need to generate and to use a new pseudo-register when processing allocnos with the same original regno.