GCC Middle and Back End API Reference
|
Data Structures | |
struct | costs |
struct | cost_classes |
struct | cost_classes_hasher |
Typedefs | |
typedef struct cost_classes * | cost_classes_t |
typedef struct cost_classes * | const_cost_classes_t |
Variables | |
static bool | pseudo_classes_defined_p = false |
static bool | allocno_p |
static int | cost_elements_num |
static struct costs * | costs |
static struct costs * | total_allocno_costs |
static int | struct_costs_size |
static enum reg_class * | pref |
static enum reg_class * | pref_buffer |
static enum reg_class * | regno_aclass |
static int * | regno_equiv_gains |
static int | frequency |
static cost_classes_t * | regno_cost_classes |
static hash_table < cost_classes_hasher > | cost_classes_htab |
static cost_classes_t | cost_classes_aclass_cache [N_REG_CLASSES] |
static cost_classes_t | cost_classes_mode_cache [MAX_MACHINE_MODE] |
typedef struct cost_classes* const_cost_classes_t |
typedef struct cost_classes* cost_classes_t |
Types of pointers to the structure above.
|
static |
Compute the cost of loading X into (if TO_P is TRUE) or from (if TO_P is FALSE) a register of class RCLASS in mode MODE. X must not be a pseudo register.
References secondary_reload_info::extra_cost, ira_init_register_move_cost_if_necessary(), secondary_reload_info::prev_sri, and targetm.
Referenced by record_reg_classes().
|
static |
Find costs of register classes and memory for allocnos or pseudos and their best costs. Set up preferred, alternative and allocno classes for pseudos.
References add_cost(), allocno_p, bitmap_bit_p(), cost_classes::classes, cost_elements_num, first_moveable_pseudo, HOST_BITS_PER_INT, basic_block_def::index, init_recog(), internal_flag_ira_verbose, invalid_mode_change_p(), ira_allocate(), ira_allocnos_num, ira_free(), ira_loop_tree_root, IRA_REGION_ALL, IRA_REGION_MIXED, ira_regno_allocno_map, ira_traverse_loop_tree(), last_moveable_pseudo, max_reg_num(), costs::mem_cost, memcpy(), memset(), cost_classes::num, pref, pref_buffer, print_allocno_costs(), print_pseudo_costs(), process_bb_for_costs(), process_bb_node_for_costs(), pseudo_classes_defined_p, reg_class_names, reg_preferred_class(), regno_aclass, ira_loop_tree_node::regno_allocno_map, regno_equiv_gains, regno_reg_rtx, resize_reg_info(), setup_reg_classes(), setup_regno_cost_classes_by_aclass(), setup_regno_cost_classes_by_mode(), and struct_costs_size.
Referenced by ira_costs(), and ira_set_pseudo_classes().
|
static |
Common finalization function for ira_costs and ira_set_pseudo_classes.
References finish_subregs_of_mode(), ira_free(), pref_buffer, regno_aclass, and regno_equiv_gains.
Referenced by ira_costs(), and ira_set_pseudo_classes().
|
static |
Finilize info about the cost classes for each pseudo.
References hash_table< Descriptor, Allocator >::dispose(), and ira_free().
Referenced by ira_costs(), and ira_set_pseudo_classes().
|
static |
Free allocated temporary cost vectors.
References free(), and init_cost().
Referenced by ira_finish_costs_once(), and ira_init_costs().
|
static |
Common initialization function for ira_costs and ira_set_pseudo_classes.
References cost_elements_num, init_subregs_of_mode(), ira_allocate(), max_reg_num(), memset(), pref_buffer, regno_aclass, and regno_equiv_gains.
Referenced by ira_costs(), and ira_set_pseudo_classes().
|
static |
Initialize info about the cost classes for each pseudo.
References hash_table< Descriptor, Allocator >::create(), ira_allocate(), max_reg_num(), and memset().
Referenced by ira_costs(), and ira_set_pseudo_classes().
void ira_adjust_equiv_reg_cost | ( | ) |
Add COST to the estimated gain for eliminating REGNO with its equivalence. If COST is zero, record that no such elimination is possible.
References costs::cost, and regno_equiv_gains.
Referenced by calculate_elim_costs_all_insns(), and note_reg_elim_costly().
void ira_costs | ( | void | ) |
Entry function which defines register class, memory and hard register costs for each allocno.
References allocno_p, calculate_elim_costs_all_insns(), cost_elements_num, find_costs_and_classes(), finish_costs(), finish_regno_cost_classes(), init_costs(), initiate_regno_cost_classes(), ira_allocate(), ira_allocnos_num, ira_dump_file, ira_free(), and setup_allocno_class_and_costs().
Referenced by ira_build().
void ira_finish_costs_once | ( | void | ) |
Function called once at the end of compiler work.
References free_ira_costs().
Referenced by ira_finish_once().
void ira_init_costs | ( | void | ) |
This is called each time register related information is changed.
References costs::cost, free_ira_costs(), init_cost(), and costs::mem_cost.
Referenced by ira_init().
void ira_init_costs_once | ( | void | ) |
void ira_set_pseudo_classes | ( | ) |
Entry function which defines classes for pseudos. Set pseudo_classes_defined_p only if DEFINE_PSEUDO_CLASSES is true.
References allocno_p, cost_elements_num, find_costs_and_classes(), finish_costs(), finish_regno_cost_classes(), init_costs(), initiate_regno_cost_classes(), internal_flag_ira_verbose, max_reg_num(), and pseudo_classes_defined_p.
Referenced by ira(), move_loop_invariants(), one_code_hoisting_pass(), regmove_optimize(), and sched_init().
void ira_tune_allocno_costs | ( | void | ) |
Change hard register costs for allocnos which lives through function calls. This is called only when we found all intersected calls during building allocno live ranges.
References costs::cost, ira_allocate_and_set_costs(), and ira_hard_reg_set_intersection_p().
Referenced by ira_build().
|
inlinestatic |
A version of regno_ok_for_base_p for use here, when all pseudo-registers should count as OK. Arguments as for regno_ok_for_base_p.
References ok_for_base_p_1().
Referenced by record_address_regs().
|
inlinestatic |
Wrapper around REGNO_OK_FOR_INDEX_P, to allow pseudo registers.
Referenced by record_address_regs().
|
static |
Print allocnos costs to file F.
References allocno_p, cost_classes::classes, costs::cost, basic_block_def::index, invalid_mode_change_p(), IRA_REGION_ALL, IRA_REGION_MIXED, costs::mem_cost, cost_classes::num, and reg_class_names.
Referenced by find_costs_and_classes().
|
static |
Print pseudo costs to file F.
References allocno_p, cost_classes::classes, costs::cost, invalid_mode_change_p(), max_reg_num(), costs::mem_cost, cost_classes::num, reg_class_names, and REG_N_REFS().
Referenced by find_costs_and_classes().
|
static |
Traverse the BB represented by LOOP_TREE_NODE to update the allocno costs.
References frequency, and scan_one_insn().
Referenced by find_costs_and_classes(), and process_bb_node_for_costs().
|
static |
Traverse the BB represented by LOOP_TREE_NODE to update the allocno costs.
References ira_loop_tree_node::bb, and process_bb_for_costs().
Referenced by find_costs_and_classes().
|
static |
Process moves involving hard regs to modify allocno hard register costs. We can do this only after determining allocno class. If a hard register forms a register class, than moves with the hard register are already taken into account in class costs for the allocno.
References ira_loop_tree_node::bb, costs::cost, ira_allocate_and_set_costs(), ira_curr_regno_allocno_map, and ira_init_register_move_cost_if_necessary().
Referenced by setup_allocno_class_and_costs().
|
static |
Record the pseudo registers we must reload into hard registers in a subexpression of a memory address, X. If CONTEXT is 0, we are looking at the base part of an address, otherwise we are looking at the index part. MODE and AS are the mode and address space of the memory reference; OUTER_CODE and INDEX_CODE give the context that the rtx appears in. These four arguments are passed down to base_reg_class. SCALE is twice the amount to multiply the cost by (it is twice so we can represent half-cost adjustments).
References add_cost(), allocno_p, base_reg_class(), cost_classes::classes, costs::cost, ira_curr_regno_allocno_map, ira_init_register_move_cost_if_necessary(), costs::mem_cost, cost_classes::num, ok_for_base_p_nonstrict(), and ok_for_index_p_nonstrict().
Referenced by record_operand_costs(), and scan_one_insn().
|
static |
Calculate the costs of insn operands.
References recog_data_d::constraints, constraints, frequency, init_cost(), memcpy(), modes, recog_data_d::n_alternatives, recog_data_d::n_operands, recog_data_d::operand, recog_data_d::operand_mode, recog_data, record_address_regs(), record_reg_classes(), and struct_costs_size.
Referenced by scan_one_insn().
|
static |
Record the cost of using memory or hard registers of various classes for the operands in INSN. N_ALTS is the number of alternatives. N_OPS is the number of operands. OPS is an array of the operands. MODES are the modes of the operands, in case any are VOIDmode. CONSTRAINTS are the constraints to use for the operands. This array is modified by this procedure. This procedure works alternative by alternative. For each alternative we assume that we will be able to allocate all allocnos to their ideal register class and calculate the cost of using that alternative. Then we compute, for each operand that is a pseudo-register, the cost of having the allocno allocated to each register class and using it in that alternative. To this cost is added the cost of the alternative. The cost of each class for this insn is its lowest cost among all the alternatives.
References address_operand(), allocno_p, recog_data_d::alternative_enabled_p, base_reg_class(), cost_classes::classes, copy_cost(), costs::cost, find_reg_note(), find_regno_note(), frequency, ira_curr_regno_allocno_map, ira_init_register_move_cost_if_necessary(), costs::mem_cost, memset(), recog_data_d::n_operands, nr, cost_classes::num, OP_IN, OP_INOUT, OP_OUT, recog_data_d::operand_type, recog_data, reg_fits_class_p(), rtx_equal_p(), skip_alternative(), and struct_costs_size.
Referenced by record_operand_costs().
|
static |
Process one insn INSN. Scan it and record each time it would save code to put a certain allocnos in a certain class. Return the last insn processed, so that the scan can be continued from there.
References add_cost(), costs::cost, extract_insn(), find_reg_note(), frequency, general_operand(), costs::mem_cost, recog_data_d::n_operands, cost_classes::num, recog_data_d::operand, pref, recog_data, record_address_regs(), record_operand_costs(), REG_N_SETS(), side_effects_p(), and targetm.
Referenced by process_bb_for_costs().
|
static |
After we find hard register and memory costs for allocnos, define its class and modify hard register cost because insns moving allocno to/from hard registers.
References allocno_p, cost_classes::hard_regno_index, cost_classes::index, ira_allocate_cost_vector(), ira_loop_tree_root, ira_set_allocno_class(), ira_traverse_loop_tree(), pref, process_bb_node_for_hard_reg_moves(), and regno_aclass.
Referenced by ira_costs().
|
static |
Create new cost classes from cost classes FROM and set up members index and hard_regno_index. Return the new classes. The function implements some common code of two functions setup_regno_cost_classes_by_aclass and setup_regno_cost_classes_by_mode.
References cost_classes::classes, cost_classes::hard_regno_index, cost_classes::index, ira_allocate(), and cost_classes::num.
Referenced by setup_regno_cost_classes_by_aclass(), and setup_regno_cost_classes_by_mode().
|
static |
Setup cost classes for pseudo REGNO whose allocno class is ACLASS. This function is used when we know an initial approximation of allocno class of the pseudo already, e.g. on the second iteration of class cost calculation or after class cost calculation in register-pressure sensitive insn scheduling or register-pressure sensitive loop-invariant motion.
References cost_classes::classes, hash_table< Descriptor, Allocator >::find_slot(), hard_reg_set_subset_p(), cost_classes::num, and setup_cost_classes().
Referenced by find_costs_and_classes().
|
static |
Setup cost classes for pseudo REGNO with MODE. Usage of MODE can decrease number of cost classes for the pseudo, if hard registers of some important classes can not hold a value of MODE. So the pseudo can not get hard register of some important classes and cost calculation for such important classes is only waisting CPU time.
References cost_classes::classes, hash_table< Descriptor, Allocator >::find_slot(), hard_reg_set_subset_p(), cost_classes::num, and setup_cost_classes().
Referenced by find_costs_and_classes().
|
static |
TRUE if we work with allocnos. Otherwise we work with pseudos.
Referenced by find_costs_and_classes(), ira_costs(), ira_set_pseudo_classes(), print_allocno_costs(), print_pseudo_costs(), record_address_regs(), record_reg_classes(), and setup_allocno_class_and_costs().
|
static |
Map allocno class -> cost classes for pseudo of given allocno class.
|
static |
Hash table of unique cost classes.
|
static |
Map mode -> cost classes for pseudo of give mode.
|
static |
Number of elements in array `costs'.
Referenced by find_costs_and_classes(), init_costs(), ira_costs(), and ira_set_pseudo_classes().
Costs of each class for each allocno or pseudo.
Referenced by setup_profitable_hard_regs().
|
static |
Execution frequency of the current insn.
Referenced by cgraph_update_edges_for_call_stmt_node(), coalesce_cost(), consider_split(), copy_bb(), decrease_profile(), estimate_bb_frequencies(), lra_coalesce(), lra_constraints(), maybe_hot_frequency_p(), param_change_prob(), process_bb_for_costs(), propagate_freq(), record_operand_costs(), record_reg_classes(), scale_bbs_frequencies_gcov_type(), scale_bbs_frequencies_int(), and scan_one_insn().
|
static |
Record register class preferences of each allocno or pseudo. Null value means no preferences. It happens on the 1st iteration of the cost calculation.
Referenced by alloc_anon(), find_costs_and_classes(), ira_bad_reload_regno_1(), iv_ca_dump(), rest_of_clean_state(), scan_one_insn(), setup_allocno_class_and_costs(), try_move_mult_to_index(), and update_conflict_hard_reg_costs().
|
static |
Allocated buffers for pref.
Referenced by find_costs_and_classes(), finish_costs(), and init_costs().
|
static |
@verbatim IRA hard register and memory cost calculation for allocnos or pseudos.
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/.
The flags is set up every time when we calculate pseudo register classes through function ira_set_pseudo_classes.
Referenced by find_costs_and_classes(), and ira_set_pseudo_classes().
|
static |
Record allocno class of each allocno with the same regno.
Referenced by find_costs_and_classes(), finish_costs(), init_costs(), and setup_allocno_class_and_costs().
|
static |
Info about cost classes for each pseudo.
|
static |
Record cost gains for not allocating a register with an invariant equivalence.
Referenced by find_costs_and_classes(), finish_costs(), init_costs(), and ira_adjust_equiv_reg_cost().
|
static |
It is the current size of struct costs.
Referenced by find_costs_and_classes(), record_operand_costs(), and record_reg_classes().
|
static |
Accumulated costs of each class for each allocno.