GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | common_sched_info_def |
struct | ready_list |
struct | dep_replacement |
struct | _dep |
struct | _dep_link |
struct | _deps_list |
struct | _dep_node |
struct | deps_reg |
struct | deps_desc |
struct | haifa_sched_info |
struct | spec_info_def |
struct | _haifa_deps_insn_data |
struct | reg_pressure_data |
struct | reg_use_data |
struct | reg_set_data |
struct | _haifa_insn_data |
struct | sched_deps_info_def |
struct | region |
struct | _sd_iterator |
Typedefs | |
typedef vec< basic_block > | bb_vec_t |
typedef vec< rtx > | insn_vec_t |
typedef vec< rtx > | rtx_vec_t |
typedef unsigned int | ds_t |
typedef unsigned int | dw_t |
typedef struct _dep | dep_def |
typedef dep_def * | dep_t |
typedef struct _dep_node * | dep_node_t |
typedef struct _dep_link * | dep_link_t |
typedef struct _deps_list * | deps_list_t |
typedef struct deps_desc * | deps_t |
typedef struct spec_info_def * | spec_info_t |
typedef struct _haifa_insn_data | haifa_insn_data_def |
typedef haifa_insn_data_def * | haifa_insn_data_t |
typedef struct _haifa_deps_insn_data | haifa_deps_insn_data_def |
typedef haifa_deps_insn_data_def * | haifa_deps_insn_data_t |
typedef int | sd_list_types_def |
typedef struct _sd_iterator | sd_iterator_def |
typedef vec<basic_block> bb_vec_t |
typedef struct _dep_link* dep_link_t |
typedef struct _dep_node* dep_node_t |
typedef struct _deps_list* deps_list_t |
typedef unsigned int ds_t |
Type to represent status of a dependence.
typedef unsigned int dw_t |
Type to represent weakness of speculative dependence.
typedef struct _haifa_deps_insn_data haifa_deps_insn_data_def |
typedef struct _haifa_insn_data haifa_insn_data_def |
typedef haifa_insn_data_def* haifa_insn_data_t |
typedef vec<rtx> insn_vec_t |
typedef struct _sd_iterator sd_iterator_def |
typedef int sd_list_types_def |
A type to hold above flags.
typedef struct spec_info_def* spec_info_t |
enum DEPS_ADJUST_RESULT |
enum INSN_TRAP_CLASS |
Exception Free Loads: We define five classes of speculative loads: IFREE, IRISKY, PFREE, PRISKY, and MFREE. IFREE loads are loads that are proved to be exception-free, just by examining the load insn. Examples for such loads are loads from TOC and loads of global data. IRISKY loads are loads that are proved to be exception-risky, just by examining the load insn. Examples for such loads are volatile loads and loads from shared memory. PFREE loads are loads for which we can prove, by examining other insns, that they are exception-free. Currently, this class consists of loads for which we are able to find a "similar load", either in the target block, or, if only one split-block exists, in that split block. Load2 is similar to load1 if both have same single base register. We identify only part of the similar loads, by finding an insn upon which both load1 and load2 have a DEF-USE dependence. PRISKY loads are loads for which we can prove, by examining other insns, that they are exception-risky. Currently we have two proofs for such loads. The first proof detects loads that are probably guarded by a test on the memory address. This proof is based on the backward and forward data dependence information for the region. Let load-insn be the examined load. Load-insn is PRISKY iff ALL the following hold: - insn1 is not in the same block as load-insn - there is a DEF-USE dependence chain (insn1, ..., load-insn) - test-insn is either a compare or a branch, not in the same block as load-insn - load-insn is reachable from test-insn - there is a DEF-USE dependence chain (insn1, ..., test-insn) This proof might fail when the compare and the load are fed by an insn not in the region. To solve this, we will add to this group all loads that have no input DEF-USE dependence. The second proof detects loads that are directly or indirectly fed by a speculative load. This proof is affected by the scheduling process. We will use the flag fed_by_spec_load. Initially, all insns have this flag reset. After a speculative motion of an insn, if insn is either a load, or marked as fed_by_spec_load, we will also mark as fed_by_spec_load every insn1 for which a DEF-USE dependence (insn, insn1) exists. A load which is fed_by_spec_load is also PRISKY. MFREE (maybe-free) loads are all the remaining loads. They may be exception-free, but we cannot prove it. Now, all loads in IFREE and PFREE classes are considered exception-free, while all loads in IRISKY and PRISKY classes are considered exception-risky. As for loads in the MFREE class, these are considered either exception-free or exception-risky, depending on whether we are pessimistic or optimistic. We have to take the pessimistic approach to assure the safety of speculative scheduling, but we can take the optimistic approach by invoking the -fsched_spec_load_dangerous option.
enum post_call_group |
enum SCHED_FLAGS |
enum sched_pass_id_t |
enum SPEC_SCHED_FLAGS |
enum SPEC_TYPES_OFFSETS |
void add_block | ( | basic_block | , |
basic_block | |||
) |
Referenced by set_var_live_on_entry().
void add_delay_dependencies | ( | rtx | ) |
void advance_state | ( | state_t | ) |
rtx bb_note | ( | basic_block | ) |
void compute_priorities | ( | void | ) |
Compute insn priority for a current region.
References current_nr_blocks, current_sched_info, get_ebb_head_tail(), no_real_insns_p(), rgn_n_insns, haifa_sched_info::sched_max_insns_priority, and set_priorities().
Referenced by schedule_region(), and sel_compute_priorities().
Print dependencies information for instructions between HEAD and TAIL. ??? This function would probably fit best in haifa-sched.c.
References insn_cost(), recog_memoized(), sched_dump, sched_emulate_haifa_p, sd_lists_size(), and sel_sched_p().
Referenced by debug_ebb_dependencies(), and debug_rgn_dependencies().
void debug_ds | ( | ds_t | ) |
void debug_region | ( | int | ) |
void debug_regions | ( | void | ) |
Functions for the construction of regions.
Print the regions, for debugging purposes. Callable from debugger.
References current_blocks, nr_regions, rgn_bb_table, region::rgn_nr_blocks, and sched_dump.
Referenced by sched_rgn_init().
void debug_rgn_dependencies | ( | int | ) |
Referenced by init_ready_list(), and sel_compute_priorities().
int dep_cost | ( | dep_t | ) |
Referenced by propagate_deps().
bool deps_pools_are_empty_p | ( | void | ) |
Return true if there is no dep_nodes and deps_lists out there. After the region is scheduled all the dependency nodes and lists should [generally] be returned to pool.
References dl_pool_diff, and dn_pool_diff.
Referenced by sched_deps_finish(), schedule_ebb(), and schedule_region().
void discard_delay_pairs_above | ( | int | ) |
ds_t dk_to_ds | ( | enum | reg_note | ) |
void dump_region_dot | ( | FILE * | , |
int | |||
) |
Referenced by dump_region_dot_file().
void dump_region_dot_file | ( | const char * | , |
int | |||
) |
void extend_dependency_caches | ( | int | , |
bool | |||
) |
void extend_regions | ( | void | ) |
Extend internal data structures.
References block_to_bb, containing_rgn, and rgn_bb_table.
Referenced by rgn_add_block(), and sched_rgn_init().
void extend_rgns | ( | int * | , |
int * | , | ||
sbitmap | , | ||
int * | |||
) |
Referenced by haifa_find_rgns().
edge find_fallthru_edge_from | ( | basic_block | ) |
void finish_deps_global | ( | void | ) |
Free everything used by the dependency analysis code.
Referenced by build_intra_loop_deps(), sched_rgn_compute_dependencies(), schedule_ebb(), and sel_region_finish().
void free_delay_pairs | ( | void | ) |
Free all delay_pair structures that were recorded.
References hash_table< Descriptor, Allocator >::empty(), and hash_table< Descriptor, Allocator >::is_created().
void free_deps | ( | struct deps_desc * | ) |
void free_rgn_deps | ( | void | ) |
Free all region dependencies saved in INSN_BACK_DEPS and INSN_RESOLVED_BACK_DEPS. The Haifa scheduler does this on the fly when scheduling, so this function is supposed to be called from the selective scheduling only.
References current_nr_blocks, get_ebb_head_tail(), and sched_free_deps().
Referenced by sel_compute_priorities().
void get_ebb_head_tail | ( | basic_block | , |
basic_block | , | ||
rtx * | , | ||
rtx * | |||
) |
rtx get_ready_element | ( | int | ) |
int get_rgn_sched_max_insns_priority | ( | void | ) |
Returns maximum priority that an insn was assigned to.
References rgn_sched_info, and haifa_sched_info::sched_max_insns_priority.
int haifa_classify_insn | ( | const_rtx | ) |
Functions in haifa-sched.c.
void haifa_finish_h_i_d | ( | void | ) |
Finalize haifa_insn_data.
References free(), _haifa_insn_data::max_reg_pressure, reg_use_data::next_insn_use, _haifa_insn_data::reg_pressure, and _haifa_insn_data::reg_use_list.
Referenced by sched_finish().
void haifa_init_h_i_d | ( | bb_vec_t | ) |
void haifa_note_reg_clobber | ( | int | ) |
void haifa_note_reg_set | ( | int | ) |
void haifa_note_reg_use | ( | int | ) |
void haifa_sched_finish | ( | void | ) |
Finish work with the data specific to the Haifa scheduler.
References current_function_name(), spec_info_def::dump, nr_be_in_control, nr_be_in_data, nr_begin_control, nr_begin_data, reload_completed, sched_create_empty_bb, sched_deps_finish(), sched_finish(), sched_finish_luids(), sched_init_only_bb, and sched_split_block.
Referenced by schedule_ebbs_finish(), schedule_insns(), and sms_schedule().
void haifa_sched_init | ( | void | ) |
Initialize data structures specific to the Haifa scheduler.
References sched_deps_info_def::generate_spec_deps, haifa_init_h_i_d(), haifa_init_only_bb(), haifa_recovery_bb_ever_added_p, modulo_ii, nr_be_in_control, nr_be_in_data, nr_begin_control, nr_begin_data, sched_create_empty_bb, sched_create_empty_bb_1(), sched_deps_info, sched_deps_init(), sched_extend_target(), sched_init(), sched_init_bbs(), sched_init_luids(), sched_init_only_bb, sched_split_block, sched_split_block_1(), setup_sched_dump(), and sched_deps_info_def::use_deps_list.
Referenced by schedule_ebbs_init(), schedule_insns(), and sms_schedule().
void increase_insn_priority | ( | rtx | , |
int | |||
) |
void init_deps | ( | struct deps_desc * | , |
bool | |||
) |
void init_deps_global | ( | void | ) |
Initialize some global variables needed by the dependency analysis code.
References sched_deps_info_def::finish_insn, haifa_finish_insn(), haifa_note_dep(), haifa_note_mem_dep(), haifa_note_reg_clobber(), haifa_note_reg_set(), haifa_note_reg_use(), haifa_start_insn(), implicit_reg_pending_clobbers, implicit_reg_pending_uses, NOT_A_BARRIER, sched_deps_info_def::note_dep, sched_deps_info_def::note_mem_dep, sched_deps_info_def::note_reg_clobber, sched_deps_info_def::note_reg_set, sched_deps_info_def::note_reg_use, reg_obstack, reg_pending_barrier, sched_emulate_haifa_p, sel_sched_p(), and sched_deps_info_def::start_insn.
Referenced by build_intra_loop_deps(), sched_rgn_compute_dependencies(), schedule_ebb(), and sel_region_init().
void init_deps_reg_last | ( | struct deps_desc * | ) |
void init_insn_reg_pressure_info | ( | rtx | ) |
int insn_cost | ( | rtx | ) |
int insn_luid | ( | rtx | ) |
int max_issue | ( | struct ready_list * | ready, |
int | privileged_n, | ||
state_t | state, | ||
bool | first_cycle_insn_p, | ||
int * | index | ||
) |
The following function returns maximal (or close to maximal) number of insns which can be issued on the same cycle and one of which insns is insns with the best rank (the first insn in READY). To make this function tries different samples of ready insns. READY is current queue `ready'. Global array READY_TRY reflects what insns are already issued in this try. The function stops immediately, if it reached the such a solution, that all instruction can be issued. INDEX will contain index of the best insn in READY. The following function is used only for first cycle multipass scheduling. PRIVILEGED_N >= 0 This function expects recognized insns only. All USEs, CLOBBERs, etc must be filtered elsewhere.
References cached_first_cycle_multipass_dfa_lookahead, choice_stack, cycle_issued_insns, dfa_lookahead, dfa_state_size, choice_entry::index, insn_finishes_cycle_p(), issue_rate, max_lookahead_tries, memcpy(), choice_entry::n, ready_list::n_ready, ready_element(), ready_try, choice_entry::rest, choice_entry::state, choice_entry::target_data, and targetm.
Referenced by choose_best_insn(), and choose_ready().
void maybe_extend_reg_info_p | ( | void | ) |
Extends REG_INFO_P if needed.
References max_regno, reg_info_p, reg_info_p_size, reload_completed, sel_sched_p(), and xrecalloc().
Referenced by choose_best_pseudo_reg(), implicit_clobber_conflict_p(), and sched_analyze_reg().
int number_in_ready | ( | void | ) |
Get number of ready insn in the ready list.
References ready_list::n_ready.
rtx ready_element | ( | struct ready_list * | , |
int | |||
) |
rtx* ready_lastpos | ( | struct ready_list * | ) |
void ready_sort | ( | struct ready_list * | ) |
void reemit_notes | ( | rtx | ) |
rtx restore_other_notes | ( | rtx | , |
basic_block | |||
) |
void rgn_make_new_region_out_of_new_block | ( | basic_block | ) |
Referenced by rgn_add_block().
void rgn_setup_common_sched_info | ( | void | ) |
Setup scheduler infos.
References common_sched_info_def::add_block, common_sched_info, common_sched_info_def::estimate_number_of_insns, common_sched_info_def::fix_recovery_cfg, haifa_common_sched_info, memcpy(), rgn_add_block(), rgn_common_sched_info, rgn_estimate_number_of_insns(), rgn_fix_recovery_cfg(), common_sched_info_def::sched_pass_id, and SCHED_RGN_PASS.
Referenced by schedule_insns().
void rgn_setup_region | ( | int | ) |
Referenced by schedule_region(), and sel_region_init().
void rgn_setup_sched_infos | ( | void | ) |
Setup all *_sched_info structures (for the Haifa frontend and for the dependence analysis) in the interblock scheduler.
References current_sched_info, memcpy(), rgn_sched_deps_info, rgn_sched_info, sched_deps_info, and sel_sched_p().
Referenced by schedule_insns(), and sel_region_init().
basic_block sched_create_empty_bb_1 | ( | basic_block | ) |
basic_block sched_create_recovery_block | ( | basic_block * | ) |
void sched_create_recovery_edges | ( | basic_block | first_bb, |
basic_block | rec, | ||
basic_block | second_bb | ||
) |
Create edges: FIRST_BB -> REC; FIRST_BB -> SECOND_BB; REC -> SECOND_BB and emit necessary jumps.
References add_reg_note(), block_label(), CDI_DOMINATORS, dom_info_available_p(), emit_jump_insn_after(), make_edge(), make_single_succ_edge(), and set_immediate_dominator().
Referenced by create_check_block_twin().
void sched_deps_finish | ( | void | ) |
Finalize dependency information for the whole function.
References bitmap_clear(), cache_size, deps_pools_are_empty_p(), free(), free_alloc_pool_if_empty(), sched_deps_info_def::generate_spec_deps, and h_d_i_d.
Referenced by haifa_sched_finish(), and sel_global_finish().
void sched_deps_init | ( | bool | ) |
void sched_extend_luids | ( | void | ) |
Extend data structures for logical insn UID.
References get_max_uid().
Referenced by haifa_init_insn(), sched_init_luids(), schedule_block(), and sel_region_target_finish().
void sched_extend_ready_list | ( | int | ) |
void sched_extend_target | ( | void | ) |
Extend per insn data in the target.
References targetm.
Referenced by extend_h_i_d(), haifa_init_insn(), haifa_sched_init(), and sel_global_init().
void sched_finish | ( | void | ) |
Free global data used during insn scheduling. This function works with the common data shared between the schedulers.
References end_alias_analysis(), free(), haifa_finish_h_i_d(), regstat_free_calls_crossed(), regstat_free_n_sets_and_refs(), regstat_n_sets_and_refs, sched_dump, sched_pressure, SCHED_PRESSURE_NONE, SCHED_PRESSURE_WEIGHTED, sched_regno_pressure_class, sched_verbose, and targetm.
Referenced by haifa_sched_finish(), and sel_global_finish().
void sched_finish_luids | ( | void | ) |
void sched_finish_ready_list | ( | void | ) |
Free per region data structures.
References free(), ready_try, sched_ready_n_insns, targetm, ready_list::vec, and ready_list::veclen.
Referenced by schedule_ebb(), schedule_region(), and sel_region_finish().
void sched_init | ( | void | ) |
Initialize some global state for the scheduler. This function works with the common data shared between all the schedulers. It is called from the scheduler specific initialization routine.
References cached_first_cycle_multipass_dfa_lookahead, cached_issue_rate, spec_info_def::control_weakness_cutoff, spec_info_def::data_weakness_cutoff, df_analyze(), df_chain_add_problem(), df_clear_flags(), DF_DU_CHAIN, DF_LR_RUN_DCE, df_note_add_problem(), df_rd_add_problem(), df_set_flags(), DF_UD_CHAIN, dfa_lookahead, dfa_state_size, get_max_uid(), init_alias_analysis(), ira_set_pseudo_classes(), ira_setup_eliminable_regset(), issue_rate, spec_info_def::mask, max_reg_num(), max_regno, reg_allocno_class(), regstat_compute_calls_crossed(), regstat_init_n_sets_and_refs(), reload_completed, sched_dump, sched_no_dce, common_sched_info_def::sched_pass_id, sched_pressure, SCHED_PRESSURE_NONE, SCHED_PRESSURE_WEIGHTED, sched_regno_pressure_class, SCHED_RGN_PASS, SCHED_SMS_PASS, sched_verbose, spec_info_var, and targetm.
Referenced by haifa_sched_init(), and sel_global_init().
void sched_init_bbs | ( | void | ) |
Init per basic block data structures.
References sched_extend_bb().
Referenced by haifa_init_only_bb(), haifa_sched_init(), and sel_global_init().
void sched_init_insn_luid | ( | rtx | ) |
void sched_init_luids | ( | bb_vec_t | ) |
void sched_init_region_reg_pressure_info | ( | void | ) |
Functions in haifa-sched.c.
Initiate register pressure relative info for scheduling the current region. Currently it is only clearing register mentioned in the current region.
References bitmap_clear().
Referenced by schedule_region().
void sched_insns_finish | ( | void | ) |
void sched_insns_init | ( | rtx | ) |
bool sched_is_disabled_for_current_region_p | ( | void | ) |
Returns true if all the basic blocks of the current region have NOTE_DISABLE_SCHED_OF_BLOCK which means not to schedule that region.
References current_nr_blocks.
Referenced by schedule_region(), and sel_sched_region().
void sched_rgn_compute_dependencies | ( | int | ) |
Referenced by schedule_region(), and sel_compute_priorities().
void sched_rgn_finish | ( | void | ) |
Free data structures for region scheduling.
References block_to_bb, containing_rgn, ebb_head, free(), free_bb_state_array(), nr_inter, nr_regions, nr_spec, reload_completed, reposition_prologue_and_epilogue_notes(), rgn_bb_table, sched_dump, and sched_verbose.
Referenced by schedule_insns(), and sel_global_finish().
void sched_rgn_init | ( | bool | ) |
Referenced by schedule_insns(), and sel_global_init().
void sched_rgn_local_finish | ( | void | ) |
Free data computed for the finished region.
References current_nr_blocks, sched_rgn_local_free(), and sel_sched_p().
Referenced by schedule_region().
void sched_rgn_local_free | ( | void | ) |
Free data computed for the finished region.
References free(), prob, and sbitmap_vector_free().
Referenced by sched_rgn_local_finish().
void sched_rgn_local_init | ( | int | ) |
Referenced by schedule_region().
void sched_setup_bb_reg_pressure_info | ( | basic_block | , |
rtx | |||
) |
basic_block sched_split_block_1 | ( | basic_block | , |
rtx | |||
) |
bool schedule_block | ( | basic_block * | , |
state_t | |||
) |
basic_block schedule_ebb | ( | rtx | , |
rtx | , | ||
bool | |||
) |
Types and functions in sched-ebb.c.
void schedule_ebbs_finish | ( | void | ) |
Perform cleanups after scheduling using schedules_ebbs or schedule_ebb.
References bitmap_clear(), haifa_sched_finish(), reload_completed, and reposition_prologue_and_epilogue_notes().
Referenced by schedule_ebbs().
void schedule_ebbs_init | ( | void | ) |
Perform initializations before running schedule_ebbs or a single schedule_ebb.
References common_sched_info_def::add_block, bitmap_clear(), common_sched_info, compute_bb_for_insn(), current_sched_info, ebb_add_block(), ebb_common_sched_info, ebb_fix_recovery_cfg(), ebb_sched_deps_info, ebb_sched_info, common_sched_info_def::fix_recovery_cfg, haifa_common_sched_info, haifa_sched_init(), memcpy(), sched_deps_info, SCHED_EBB_PASS, and common_sched_info_def::sched_pass_id.
Referenced by schedule_ebbs().
void sd_add_dep | ( | dep_t | , |
bool | |||
) |
enum DEPS_ADJUST_RESULT sd_add_or_update_dep | ( | dep_t | , |
bool | |||
) |
void sd_debug_dep | ( | dep_t | ) |
void sd_debug_lists | ( | rtx | , |
sd_list_types_def | |||
) |
void sd_delete_dep | ( | sd_iterator_def | ) |
void sd_finish_insn | ( | rtx | ) |
void sd_init_insn | ( | rtx | ) |
|
inlinestatic |
Return the current element.
References _sd_iterator::insn, _sd_iterator::linkp, _sd_iterator::resolved_p, sd_next_list(), and _sd_iterator::types.
Referenced by add_to_speculative_block(), create_check_block_twin(), delete_all_dependences(), delete_dep_nodes_in_back_deps(), find_inc(), fix_recovery_deps(), resolve_dependencies(), sched_analyze_insn(), schedule_insn(), undo_all_replacements(), unschedule_insns_until(), and update_insn_after_change().
|
inlinestatic |
Advance iterator.
References _sd_iterator::linkp.
Referenced by add_to_speculative_block(), create_check_block_twin(), find_inc(), fix_recovery_deps(), schedule_insn(), undo_all_replacements(), and update_insn_after_change().
|
inlinestatic |
??? We can move some definitions that are used in below inline functions out of sched-int.h to sched-deps.c provided that the below functions will become global externals. These definitions include: * struct _deps_list: opaque pointer is needed at global scope. * struct _dep_link: opaque pointer is needed at scope of sd_iterator_def. * struct _dep_node: opaque pointer is needed at scope of struct _deps_link.
Return initialized iterator.
References _sd_iterator::insn, _sd_iterator::linkp, _sd_iterator::resolved_p, and _sd_iterator::types.
Referenced by add_to_speculative_block(), create_check_block_twin(), delete_all_dependences(), delete_dep_nodes_in_back_deps(), find_inc(), fix_recovery_deps(), resolve_dependencies(), sched_analyze_insn(), schedule_insn(), undo_all_replacements(), unschedule_insns_until(), and update_insn_after_change().
bool sd_lists_empty_p | ( | const_rtx | , |
sd_list_types_def | |||
) |
int sd_lists_size | ( | const_rtx | , |
sd_list_types_def | |||
) |
void sd_next_list | ( | const_rtx | insn, |
sd_list_types_def * | types_ptr, | ||
deps_list_t * | list_ptr, | ||
bool * | resolved_p_ptr | ||
) |
Initialize LIST_PTR to point to one of the lists present in TYPES_PTR, initialize RESOLVED_P_PTR with true if that list consists of resolved deps, and remove the type of returned [through LIST_PTR] list from TYPES_PTR. This function is used to switch sd_iterator to the next list. !!! For internal use only. Might consider moving it to sched-int.h.
Referenced by sd_iterator_cond(), sd_lists_empty_p(), and sd_lists_size().
void sd_resolve_dep | ( | sd_iterator_def | ) |
void sd_unresolve_dep | ( | sd_iterator_def | ) |
void sel_add_to_insn_priority | ( | rtx | insn, |
int | amount | ||
) |
Increases effective priority for INSN by AMOUNT.
Increase EXPR_PRIORITY_ADJ for INSN by AMOUNT.
References sched_verbose, and sel_print().
Referenced by increase_insn_priority().
void sel_find_rgns | ( | void | ) |
Functions in sel-sched-ir.c.
Referenced by find_rgns().
bool sel_insn_is_speculation_check | ( | rtx | ) |
void sel_mark_hard_insn | ( | rtx | ) |
Referenced by sched_analyze_insn().
|
inlinestatic |
Return true if selective scheduling pass is working.
References common_sched_info_def::sched_pass_id, and SCHED_SEL_PASS.
Referenced by compute_block_dependences(), debug_dependencies(), deps_analyze_insn(), find_rgns(), increase_insn_priority(), init_deps_global(), insn_cost(), maybe_extend_reg_info_p(), priority(), realloc_bb_state_array(), remove_notes(), rgn_setup_sched_infos(), sched_analyze_2(), sched_analyze_insn(), sched_analyze_reg(), sched_deps_init(), sched_rgn_compute_dependencies(), sched_rgn_init(), and sched_rgn_local_finish().
void set_modulo_params | ( | int | , |
int | , | ||
int | , | ||
int | |||
) |
void setup_sched_dump | ( | void | ) |
Set dump and sched_verbose for the desired debugging output. If no dump-file was specified, but -fsched-verbose=N (any N), print to stderr. For -fsched-verbose=N, N>=10, print everything to stderr.
References dump_file, sched_dump, and sched_verbose.
Referenced by haifa_sched_init(), and sel_global_init().
int try_ready | ( | rtx | ) |
void unlink_bb_notes | ( | basic_block | , |
basic_block | |||
) |
void* xrecalloc | ( | void * | , |
size_t | , | ||
size_t | , | ||
size_t | |||
) |
int* block_to_bb |
Topological order of blocks in the region (if b2 is reachable from b1, block_to_bb[b2] > block_to_bb[b1]). Note: A basic block is always referred to by either block or b, while its topological order name (in the region) is referred to by bb.
Referenced by extend_regions(), and sched_rgn_finish().
struct common_sched_info_def* common_sched_info |
This is a placeholder for the scheduler parameters common to all schedulers.
Referenced by haifa_find_rgns(), rgn_setup_common_sched_info(), schedule_ebbs_init(), setup_sched_infos(), and too_large().
int* containing_rgn |
The number of the region containing a block.
Referenced by extend_regions(), and sched_rgn_finish().
state_t curr_state |
Pointer to data describing the current DFA state.
The following variable value refers for all current and future reservations of the processor units.
Referenced by advance_one_cycle(), invoke_aftermath_hooks(), merge_states(), new_ready(), partition_equiv_class(), ps_has_conflicts(), reset_sched_cycles_in_current_ebb(), schedule_region(), and sel_dfa_new_cycle().
int current_blocks |
Referenced by bb_in_region_p(), compute_dom_prob_ps(), debug_region(), debug_regions(), dump_region_dot(), and rgn_setup_region().
int current_nr_blocks |
Blocks of the current region being scheduled.
Referenced by compute_block_dependences(), compute_priorities(), compute_trg_info(), create_block_for_bookkeeping(), current_region_empty_p(), debug_candidates(), debug_rgn_dependencies(), free_pending_lists(), free_rgn_deps(), init_ready_list(), init_seqno(), initiate_bb_reg_pressure_info(), initiate_reg_pressure_info(), rgn_add_block(), rgn_print_insn(), rgn_setup_region(), sched_is_disabled_for_current_region_p(), sched_rgn_compute_dependencies(), sched_rgn_local_finish(), sched_rgn_local_init(), schedule_region(), sel_region_init(), sel_region_target_finish(), sel_sched_region_1(), and simplify_changed_insns().
struct haifa_sched_info* current_sched_info |
Point to state used for the current scheduling pass.
Referenced by add_dependence(), add_deps_for_risky_insns(), ask_dependency_caches(), begin_move_insn(), check_dep(), compute_priorities(), dep_spec_p(), deps_analyze_insn(), dump_dep(), extend_dependency_caches(), find_ebb_boundaries(), haifa_note_mem_dep(), init_dep(), init_ready_list(), put_TImodes(), reset_sched_cycles_in_current_ebb(), rgn_setup_sched_infos(), sched_analyze_insn(), schedule_ebb(), schedule_ebbs_init(), schedule_region(), sd_add_dep(), sd_delete_dep(), sel_region_target_finish(), set_dependency_caches(), setup_sched_infos(), update_dep(), and update_dependency_caches().
int cycle_issued_insns |
The following variable value is number of essential insns issued on the current cycle. An insn is essential one if it changes the processors state.
Referenced by choose_best_insn(), max_issue(), restore_last_backtrack_point(), save_backtrack_point(), and schedule_block().
int dfa_lookahead |
This holds the value of the target dfa_lookahead hook.
Referenced by choose_best_insn(), max_issue(), and sched_init().
size_t dfa_state_size |
The following variable value is size of memory representing all current and future reservations of the processor units.
Referenced by advance_state_on_fence(), debug_state(), early_queue_to_ready(), estimate_insn_cost(), invoke_aftermath_hooks(), max_issue(), prune_ready_list(), realloc_bb_state_array(), reset_sched_cycles_in_current_ebb(), restore_last_backtrack_point(), save_backtrack_point(), sched_extend_ready_list(), sched_init(), schedule_block(), schedule_region(), and sel_dfa_new_cycle().
int* ebb_head |
The mapping from ebb to block.
ebb_head [i] - is index in rgn_bb_table of the head basic block of i'th ebb. Currently we can get a ebb only through splitting of currently scheduling block, therefore, we don't need ebb_head array for every region, hence, its sufficient to hold it for current one only.
Referenced by compute_dom_prob_ps(), rgn_add_block(), rgn_fix_recovery_cfg(), rgn_setup_region(), and sched_rgn_finish().
vec<haifa_deps_insn_data_def> h_d_i_d |
The data is specific to the Haifa scheduler.
Referenced by init_deps_data_vector(), sched_deps_finish(), and sel_region_finish().
vec<haifa_insn_data_def> h_i_d |
Haifa Instruction Data.
struct common_sched_info_def haifa_common_sched_info |
Haifa version of sched_info hooks common to all headers.
Referenced by rgn_setup_common_sched_info(), schedule_ebbs_init(), and setup_sched_infos().
bool haifa_recovery_bb_ever_added_p |
True, if recovery block was added during this scheduling pass. Used to determine if we should have empty memory pools of dependencies after finishing current region.
Referenced by haifa_sched_init(), sched_create_recovery_block(), schedule_ebb(), and schedule_region().
int issue_rate |
@verbatim Instruction scheduling pass.
Copyright (C) 1992-2013 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiema) Enhanced by, and currently maintained by, Jim Wilson ( nn@c ygnus .comwilso) n@cy gnus. 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/.
Instruction scheduling pass. This file, along with sched-deps.c, contains the generic parts. The actual entry point is found for the normal instruction scheduling pass is found in sched-rgn.c. We compute insn priorities based on data dependencies. Flow analysis only creates a fraction of the data-dependencies we must observe: namely, only those dependencies which the combiner can be expected to use. For this pass, we must therefore create the remaining dependencies we need to observe: register dependencies, memory dependencies, dependencies to keep function calls in order, and the dependence between a conditional branch and the setting of condition codes are all dealt with here. The scheduler first traverses the data flow graph, starting with the last instruction, and proceeding to the first, assigning values to insn_priority as it goes. This sorts the instructions topologically by data dependence. Once priorities have been established, we order the insns using list scheduling. This works as follows: starting with a list of all the ready insns, and sorted according to priority number, we schedule the insn from the end of the list by placing its predecessors in the list according to their priority order. We consider this insn scheduled by setting the pointer to the "end" of the list to point to the previous insn. When an insn has no predecessors, we either queue it until sufficient time has elapsed or add it to the ready list. As the instructions are scheduled or when stalls are introduced, the queue advances and dumps insns into the ready list. When all insns down to the lowest priority have been scheduled, the critical path of the basic block has been made as short as possible. The remaining insns are then scheduled in remaining slots. The following list shows the order in which we want to break ties among insns in the ready list: 1. choose insn with the longest path to end of bb, ties broken by 2. choose insn with least contribution to register pressure, ties broken by 3. prefer in-block upon interblock motion, ties broken by 4. prefer useful upon speculative motion, ties broken by 5. choose insn with largest control flow probability, ties broken by 6. choose insn with the least dependences upon the previously scheduled insn, or finally 7 choose the insn which has the most insns dependent on it. 8. choose insn with lowest UID. Memory references complicate matters. Only if we can be certain that memory references are not part of the data dependency graph (via true, anti, or output dependence), can we move operations past memory references. To first approximation, reads can be done independently, while writes introduce dependencies. Better approximations will yield fewer dependencies. Before reload, an extended analysis of interblock data dependences is required for interblock scheduling. This is performed in compute_block_backward_dependences (). Dependencies set up by memory references are treated in exactly the same way as other dependencies, by using insn backward dependences INSN_BACK_DEPS. INSN_BACK_DEPS are translated into forward dependences INSN_FORW_DEPS the purpose of forward list scheduling. Having optimized the critical path, we may have also unduly extended the lifetimes of some registers. If an operation requires that constants be loaded into registers, it is certainly desirable to load those constants as early as necessary, but no earlier. I.e., it will not do to load up a bunch of registers at the beginning of a basic block only to use them at the end, if they could be loaded later, since this may result in excessive register utilization. Note that since branches are never in basic blocks, but only end basic blocks, this pass will not move branches. But that is ok, since we can use GNU's delayed branch scheduling pass to take care of this case. Also note that no further optimizations based on algebraic identities are performed, so this pass would be a good one to perform instruction splitting, such as breaking up a multiply instruction into shifts and adds where that is profitable. Given the memory aliasing analysis that this pass should perform, it should be possible to remove redundant stores to memory, and to load values from registers instead of hitting memory. Before reload, speculative insns are moved only if a 'proof' exists that no exception will be caused by this, and if no live registers exist that inhibit the motion (live registers constraints are not represented by data dependence edges). This pass must update information that subsequent passes expect to be correct. Namely: reg_n_refs, reg_n_sets, reg_n_deaths, reg_n_calls_crossed, and reg_live_length. Also, BB_HEAD, BB_END. The information in the line number notes is carefully retained by this pass. Notes that refer to the starting and ending of exception regions are also carefully retained by this pass. All other NOTE insns are grouped in their same relative order at the beginning of basic blocks and regions that have been scheduled.
issue_rate is the number of insns that can be scheduled in the same machine cycle. It can be defined in the config/mach/mach.h file, otherwise we set it to 1.
rtx note_list |
This list holds ripped off notes from the current block. These notes will be attached to the beginning of the block when its scheduling is finished.
List of important notes we must keep around. This is a pointer to the last element in the list.
Referenced by remove_notes(), and restore_other_notes().
int nr_regions |
Number of regions in the procedure.
Referenced by debug_regions(), extend_rgns(), find_single_block_region(), gather_region_statistics(), haifa_find_rgns(), rgn_add_block(), rgn_make_new_region_out_of_new_block(), run_selective_scheduling(), sched_rgn_finish(), sched_rgn_init(), and schedule_insns().
struct ready_list ready |
The ready list.
Referenced by calculate_privileged_insns(), choose_best_insn(), convert_vec_av_set_to_ready(), fill_ready_list(), find_best_expr(), find_expr_for_ready(), invoke_dfa_lookahead_guard(), and invoke_reorder_hooks().
char* ready_try |
The following array is used to find the best insn from ready when the automaton pipeline interface is used.
Referenced by calculate_privileged_insns(), choose_ready(), convert_vec_av_set_to_ready(), invoke_dfa_lookahead_guard(), max_issue(), sched_extend_ready_list(), and sched_finish_ready_list().
int* rgn_bb_table |
Array of lists of regions' blocks.
Referenced by bb_in_region_p(), debug_region(), debug_regions(), dump_region_dot(), extend_regions(), extend_rgns(), find_single_block_region(), haifa_find_rgns(), rgn_add_block(), rgn_fix_recovery_cfg(), rgn_make_new_region_out_of_new_block(), and sched_rgn_finish().
region* rgn_table |
Table of region descriptions.
basic_block(* sched_create_empty_bb)(basic_block) |
Create empty basic block after the specified block.
Referenced by haifa_sched_finish(), haifa_sched_init(), and init_before_recovery().
struct sched_deps_info_def* sched_deps_info |
Holds current parameters for the dependency analyzer.
Referenced by contributes_to_priority_p(), haifa_sched_init(), haifa_speculate_insn(), new_ready(), rgn_setup_sched_infos(), schedule_ebbs_init(), and setup_sched_infos().
FILE* sched_dump |
Debugging file. All printouts are sent to dump, which is always set, either to stderr, or to the dump listing file (-dRS).
Referenced by add_delay_dependencies(), add_dependence(), advance_one_cycle(), apply_replacement(), attempt_change(), change_queue_index(), choose_ready(), compute_dom_prob_ps(), cond_clobbered_p(), debug_candidate(), debug_candidates(), debug_dependencies(), debug_ebb_dependencies(), debug_ready_list(), debug_regions(), debug_rgn_dependencies(), dump_hard_reg_set(), dump_new_block_header(), early_queue_to_ready(), extend_rgns(), find_inc(), find_mem(), find_modifiable_mems(), get_ebb_head_tail(), invoke_aftermath_hooks(), invoke_reorder_hooks(), model_choose_insn(), model_dump_pressure_points(), model_dump_pressure_summary(), model_excess_cost(), model_promote_predecessors(), model_recompute(), model_record_pressures(), model_set_excess_costs(), model_start_schedule(), print_curr_reg_pressure(), print_region_statistics(), ps_has_conflicts(), queue_insn(), queue_to_ready(), reset_sched_cycles_in_current_ebb(), resolve_dependencies(), restore_dump(), restore_pattern(), sched_finish(), sched_init(), sched_rgn_finish(), schedule_block(), schedule_insn(), schedule_region(), sel_dfa_new_cycle(), sel_print(), sel_print_rtl(), sel_region_init(), sel_region_target_finish(), setup_sched_dump(), switch_dump(), try_ready(), and verify_shadows().
int sched_emulate_haifa_p |
True if during selective scheduling we need to emulate some of haifa scheduler behaviour.
True if/when we want to emulate Haifa scheduler in the common code. This is used in sched_rgn_local_init and in various places in sched-deps.c.
Referenced by debug_dependencies(), init_deps_global(), sched_analyze_insn(), and sched_rgn_compute_dependencies().
void(* sched_init_only_bb)(basic_block, basic_block) |
Referenced by begin_move_insn(), create_check_block_twin(), haifa_sched_finish(), haifa_sched_init(), and init_before_recovery().
vec<int> sched_luids |
Mapping from INSN_UID to INSN_LUID. In the end all other per insn data structures should be indexed by luid.
Mapping from instruction UID to its Logical UID.
Referenced by sel_dump_cfg_insn().
int sched_max_luid |
The highest INSN_LUID.
Next LUID to assign to an instruction.
Referenced by init_deps_data_vector(), init_seqno(), model_start_schedule(), sched_deps_init(), sched_finish_luids(), sched_init_insn_luid(), and sched_rgn_compute_dependencies().
bool sched_no_dce |
This can be set to true by a backend if the scheduler should not enable a DCE pass.
Referenced by sched_init().
enum sched_pressure_algorithm sched_pressure |
Do register pressure sensitive insn scheduling if the flag is set up.
Referenced by debug_ready_list(), fix_tick_ready(), haifa_init_insn(), init_insn_reg_pressure_info(), initiate_reg_pressure_info(), prune_ready_list(), queue_to_ready(), rank_for_schedule(), ready_sort(), sched_analyze_insn(), sched_finish(), sched_init(), sched_setup_bb_reg_pressure_info(), schedule_block(), schedule_insn(), and schedule_region().
enum reg_class* sched_regno_pressure_class |
Map regno -> its pressure class. The map defined only when SCHED_PRESSURE_P is true.
Map regno -> its pressure class. The map defined only when SCHED_PRESSURE != SCHED_PRESSURE_NONE.
Referenced by mark_hard_regno_death(), mark_insn_hard_regno_birth(), mark_insn_pseudo_birth(), mark_pseudo_death(), mark_regno_birth_or_death(), sched_finish(), and sched_init().
basic_block(* sched_split_block)(basic_block, rtx) |
Split block function. Different schedulers might use different functions to handle their internal data consistent.
Referenced by create_block_for_bookkeeping(), create_check_block_twin(), haifa_sched_finish(), and haifa_sched_init().
int sched_verbose |
sched-verbose controls the amount of debugging output the scheduler prints. It is controlled by -fsched-verbose=N: N>0 and no -DSR : the output is directed to stderr. N>=10 will direct the printouts to stderr (regardless of -dSR). N=1: same as -dSR. N=2: bb's probabilities, detailed ready list info, unit/insn info. N=3: rtl at abort point, control-flow, regions info. N=5: dependences info.
Referenced by add_delay_dependencies(), add_dependence(), add_to_speculative_block(), advance_one_cycle(), advance_state_on_fence(), apply_replacement(), attempt_change(), calculate_new_fences(), calculate_privileged_insns(), change_queue_index(), choose_best_insn(), choose_ready(), code_motion_path_driver(), code_motion_process_successors(), commit_schedule(), compute_av_set_at_bb_end(), compute_av_set_inside_bb(), compute_av_set_on_boundaries(), compute_dom_prob_ps(), cond_clobbered_p(), create_block_for_bookkeeping(), create_check_block_twin(), early_queue_to_ready(), extend_rgns(), extract_new_fences_from(), fill_insns(), fill_vec_av_set(), find_best_expr(), find_ebb_boundaries(), find_inc(), find_mem(), find_modifiable_mems(), find_place_for_bookkeeping(), find_sequential_best_exprs(), generate_bookkeeping_insn(), get_ebb_head_tail(), implicit_clobber_conflict_p(), init_before_recovery(), init_ready_list(), invoke_aftermath_hooks(), invoke_dfa_lookahead_guard(), invoke_reorder_hooks(), model_choose_insn(), model_promote_predecessors(), model_recompute(), model_record_pressures(), model_set_excess_costs(), model_start_schedule(), move_cond_jump(), moveup_expr(), moveup_expr_cached(), moveup_set_inside_insn_group(), moving_insn_creates_bookkeeping_block_p(), ps_has_conflicts(), put_TImodes(), queue_insn(), queue_to_ready(), remove_insns_that_need_bookkeeping(), reset_sched_cycles_in_current_ebb(), resolve_dependencies(), restore_pattern(), sched_create_recovery_block(), sched_finish(), sched_init(), sched_rgn_finish(), sched_rgn_init(), schedule_block(), schedule_insn(), schedule_on_fences(), schedule_region(), sel_add_to_insn_priority(), sel_compute_priorities(), sel_dfa_new_cycle(), sel_region_init(), sel_region_target_finish(), sel_sched_region(), sel_sched_region_2(), sel_target_adjust_priority(), setup_sched_dump(), try_bitmap_cache(), try_ready(), try_transformation_cache(), undo_transformations(), update_boundaries(), update_fence_and_insn(), and verify_shadows().
spec_info_t spec_info |
Description of the speculative part of the scheduling. If NULL - no speculation.
Referenced by add_deps_for_risky_insns(), can_speculate_dep_p(), get_spec_check_type_for_insn(), new_ready(), process_spec_exprs(), sched_analyze_2(), and sel_rank_for_schedule().
int target_bb |
The bb being currently scheduled.
Referenced by advance_target_bb(), begin_schedule_ready(), can_schedule_ready_p(), compute_trg_info(), cond_exec_find_if_block(), fill_insns(), init_ready_list(), make_abnormal_goto_edges(), new_ready(), record_edge_info(), rgn_add_remove_insn(), rgn_insn_finishes_block_p(), rgn_print_insn(), rgn_rank(), schedule_ebb(), schedule_region(), and use_killed_between().