GCC Middle and Back End API Reference
|
Data Structures | |
struct | delay_pair |
struct | delay_i1_hasher |
struct | delay_i2_hasher |
struct | model_pressure_data |
struct | model_insn_info |
struct | model_pressure_limit |
struct | model_pressure_group |
struct | sched_block_state |
struct | haifa_saved_data |
struct | choice_entry |
Typedefs | |
typedef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DATA_T | first_cycle_multipass_data_t |
typedef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DATA_T first_cycle_multipass_data_t |
void add_delay_dependencies | ( | ) |
Given an insn INSN, add a dependence on its delayed shadow if it has one. Also try to find situations where shadows depend on each other and add dependencies to the real insns to limit the amount of backtracking needed.
References add_dependence(), hash_table< Descriptor, Allocator >::find_with_hash(), delay_pair::i1, delay_pair::i2, hash_table< Descriptor, Allocator >::is_created(), pair_delay(), sched_dump, sched_verbose, and delay_pair::stages.
Referenced by add_deps_for_risky_insns().
Referenced by fix_recovery_deps().
|
static |
Add dependences between JUMP and other instructions in the recovery block. INSN is the first insn the recovery block.
References dep_list_size(), init_dep(), sd_add_dep(), and sd_lists_empty_p().
|
static |
Referenced by generate_recovery_code().
|
static |
Generates recovery code for BE_IN speculative INSN.
References alloc_INSN_LIST(), calc_priorities(), clear_priorities(), copy_insn(), create_check_block_twin(), spec_info_def::dump, emit_insn_before(), free_INSN_LIST_node(), haifa_init_insn(), basic_block_def::index, init_dep(), nr_be_in_control, nr_be_in_data, process_insn_forw_deps_be_in_spec(), sched_verbose, sd_add_dep(), sd_copy_back_deps(), sd_delete_dep(), sd_iterator_cond(), sd_iterator_next(), and sd_iterator_start().
|
static |
Referenced by try_ready().
|
static |
PREV is an insn that is ready to execute. Adjust its priority if that will help shorten or lengthen register lifetimes as appropriate. Also provide a hook for the target to tweak itself.
References targetm.
|
static |
Advance time on one cycle.
References advance_state(), sched_dump, and sched_verbose.
Referenced by queue_to_ready(), and schedule_block().
void advance_state | ( | ) |
Advance DFA state STATE on one cycle.
References targetm.
Referenced by advance_one_cycle(), and reset_sched_cycles_in_current_ebb().
|
static |
|
static |
Apply a replacement described by DESC. If IMMEDIATELY is false, we may have to postpone the replacement until the start of the next cycle, at which point we will be called again with IMMEDIATELY true. This is only done for machines which have instruction packets with explicit parallelism however.
References fix_tick_ready(), dep_replacement::insn, dep_replacement::loc, dep_replacement::newval, reload_completed, haifa_saved_data::replace_apply, haifa_saved_data::replacement_deps, sched_dump, sched_verbose, targetm, update_insn_after_change(), and validate_change().
|
static |
Referenced by generate_recovery_code().
|
static |
Generates recovery code for BEGIN speculative INSN.
References create_check_block_twin(), nr_begin_control, and nr_begin_data.
|
static |
Referenced by add_to_speculative_block(), and create_check_block_twin().
|
static |
Recompute priorities of instructions, whose priorities might have been changed. ROOTS is a vector of instructions whose priority computation will trigger initialization of all cleared priorities.
References priority().
|
static |
For each pressure class CL, set DEATH[CL] to the number of registers in that class that die in INSN.
References dying_use_p(), mark_regno_birth_or_death(), reg_use_data::next_insn_use, and reg_use_data::regno.
Referenced by model_classify_pressure(), model_excess_cost(), model_record_pressures(), and setup_insn_reg_pressure_info().
|
static |
Referenced by choose_ready(), fix_tick_ready(), sched_remove_insn(), and try_ready().
|
static |
Move NEXT to the proper queue list with (DELAY >= 1), or add it to the ready list (DELAY == QUEUE_READY), or remove it from ready and queue lists at all (DELAY == QUEUE_NOWHERE).
References haifa_sched_info::print_insn, q_ptr, queue_insn(), queue_remove(), ready_add(), ready_remove_insn(), sched_dump, and sched_verbose.
|
static |
If doing predication while scheduling, verify whether INSN, which has just been scheduled, clobbers the conditions of any instructions that must be predicated in order to break their dependencies. If so, remove them from the queues so that they will only be scheduled once their control dependency is resolved.
References cond_clobbered_p(), DO_PREDICATION, find_all_hard_reg_sets(), haifa_sched_info::flags, insn_queue, ready_list::n_ready, q_ptr, queue_remove(), ready_element(), and ready_remove_insn().
Referenced by schedule_insn().
|
static |
The following function chooses insn from READY and modifies READY. The following function is used only for first cycle multipass scheduling. Return: -1 if cycle should be advanced, 0 if INSN_PTR is set to point to the desirable insn, 1 if choose_ready () should be restarted without advancing the cycle.
References change_queue_index(), dbg_cnt(), spec_info_def::flags, choice_entry::index, max_issue(), choice_entry::n, ready_list::n_ready, next_nonnote_insn(), nonscheduled_insns_begin, PREFER_NON_CONTROL_SPEC, PREFER_NON_DATA_SPEC, haifa_sched_info::print_insn, ready_element(), ready_remove(), ready_remove_first(), ready_remove_first_dispatch(), ready_remove_insn(), ready_try, recog_memoized(), sched_dump, sched_verbose, and targetm.
Referenced by schedule_block().
Referenced by add_to_speculative_block(), clear_priorities(), and create_check_block_twin().
|
static |
Clear priorities of all instructions, that are forward dependent on INSN. Store in vector pointed to by ROOTS_PTR insns on which priority () should be invoked to initialize all cleared priorities.
References clear_priorities(), contributes_to_priority_p(), and _dep::pro.
|
static |
This function is called when we have successfully scheduled a block. It uses the schedule stored in the scheduled_insns vector to rearrange the RTL. PREV_HEAD is used as the anchor to which we append the scheduled insns; TAIL is the insn after the scheduled block. TARGET_BB is the argument passed to schedule_block.
References haifa_sched_info::advance_target_bb, bb_note(), haifa_sched_info::begin_move_insn, control_flow_insn_p(), dump_new_block_header(), last_scheduled_insn, move_insn(), next_real_insn(), haifa_sched_info::next_tail, reemit_notes(), and sched_verbose.
Referenced by schedule_block().
void concat_note_lists | ( | ) |
Functions for handling of notes.
Add note list that ends on FROM_END to the end of TO_ENDP.
|
static |
Determine if INSN has a condition that is clobbered if a register in SET_REGS is modified.
References haifa_change_pattern(), haifa_sched_info::print_insn, sched_dump, and sched_verbose.
Referenced by check_clobbered_conditions().
|
static |
Return 'true' if DEP should be included in priority calculations.
References haifa_sched_info::contributes_to_priority, COUNT_SPEC_IN_CRITICAL_PATH, spec_info_def::flags, sched_deps_info_def::generate_spec_deps, and sched_deps_info.
Referenced by clear_priorities(), and priority().
|
static |
Referenced by add_to_speculative_block(), and begin_speculative_block().
|
static |
This function creates recovery code for INSN. If MUTATE_P is nonzero, INSN is a simple check, that should be converted to branchy one.
References haifa_sched_info::add_remove_insn, calc_priorities(), clear_priorities(), spec_info_def::dump, emit_insn_after(), emit_insn_before(), emit_jump_insn_before(), get_dep_weak(), haifa_init_insn(), basic_block_def::index, init_dep(), init_dep_1(), haifa_sched_info::print_insn, _dep::pro, process_insn_forw_deps_be_in_spec(), sched_create_recovery_block(), sched_create_recovery_edges(), sched_extend_ready_list(), sched_init_only_bb, sched_ready_n_insns, sched_remove_insn(), sched_split_block, sched_verbose, sd_add_dep(), sd_copy_back_deps(), sd_delete_dep(), sd_iterator_cond(), sd_iterator_next(), sd_iterator_start(), set_dep_weak(), targetm, and try_ready().
|
static |
Referenced by schedule_block().
|
static |
Print the ready list for debugging purposes. Callable from debugger.
References clock_var, ready_list::n_ready, haifa_sched_info::print_insn, ready_lastpos(), sched_dump, sched_pressure, and SCHED_PRESSURE_NONE.
int dep_cost | ( | ) |
Compute cost of dependence LINK. This is the number of cycles between instruction issue and instruction results.
References dep_cost_1().
Referenced by create_ddg_dep_from_intra_loop_link(), create_ddg_dep_no_link(), estimate_insn_tick(), fix_tick_ready(), ok_for_early_queue_removal(), priority(), and rank_for_schedule().
int dep_cost_1 | ( | ) |
Compute cost of dependence LINK. This is the number of cycles between instruction issue and instruction results. ??? We also use this function to call recog_memoized on all insns.
References alloc_INSN_LIST(), hash_table< Descriptor, Allocator >::find_with_hash(), free_INSN_LIST_node(), delay_pair::i1, dep_replacement::insn, insn_cost(), hash_table< Descriptor, Allocator >::is_created(), pair_delay(), recog_memoized(), and targetm.
Referenced by dep_cost().
|
static |
Compute the number of nondebug deps in list LIST for INSN.
References sd_lists_size().
Referenced by add_jump_dependencies(), model_analyze_insns(), priority(), and rank_for_schedule().
void discard_delay_pairs_above | ( | ) |
Discard all delay pairs which involve an insn with an UID higher than MAX_UID.
References haifa_htab_i1_traverse(), haifa_htab_i2_traverse(), max_uid, and hash_table< Descriptor, Allocator >::traverse().
|
static |
Referenced by commit_schedule(), and schedule_block().
|
static |
Print some information about block BB, which starts with HEAD and ends with TAIL, before scheduling it. I is zero, if scheduler is about to start with the fresh ebb.
References basic_block_def::index, reload_completed, and sched_dump.
|
static |
Return TRUE if the register is dying after its USE.
References reg_use_data::insn, and reg_use_data::next_regno_use.
Referenced by calculate_reg_deaths(), and update_register_pressure().
|
static |
Referenced by schedule_block().
|
static |
Remove insns from the queue, before they become "ready" with respect to FU latency considerations.
References dfa_state_size, free_INSN_LIST_node(), dep_replacement::insn, insn_queue, memcpy(), ok_for_early_queue_removal(), haifa_sched_info::print_insn, print_rtl_single(), q_ptr, q_size, ready_add(), recog_memoized(), sched_dump, and sched_verbose.
|
static |
Compute INSN_TICK_ESTIMATE for INSN. PROCESSED is a bitmap of instructions we've previously encountered, a set bit prevents recursion. BUDGET is a limit on how far ahead we look, it is reduced on recursive calls. Return true if we produced a good estimate, or false if we exceeded the budget.
References bitmap_bit_p(), bitmap_set_bit(), and dep_cost().
Referenced by estimate_shadow_tick().
|
static |
Examine the pair of insns in P, and estimate (optimistically, assuming infinite resources) the cycle in which the delayed shadow can be issued. Return the number of cycles that must pass before the real insn can be issued in order to meet this constraint.
References bitmap_clear(), clock_var, estimate_insn_tick(), delay_pair::i2, pair_delay(), and processed.
Referenced by prune_ready_list().
|
static |
The following functions are used to implement scheduling of data/control speculative instructions.
Extend global scheduler structures (those, that live across calls to schedule_block) to include information about just emitted INSN.
References get_max_uid(), and sched_extend_target().
Referenced by haifa_init_h_i_d(), and haifa_init_insn().
edge find_fallthru_edge_from | ( | ) |
Helper function. Find fallthru edge from PRED.
References edge_def::dest, find_fallthru_edge(), basic_block_def::next_bb, basic_block_def::preds, basic_block_def::prev_bb, edge_def::src, and basic_block_def::succs.
Referenced by in_fallthru_bb_p(), init_before_recovery(), and move_cond_jump().
Referenced by schedule_block().
|
static |
Fix INSN_TICKs of the instructions in the current block as well as INSN_TICKs of their dependents. HEAD and TAIL are the begin and the end of the current scheduled block.
References bitmap_clear(), bitmap_set_bit(), clock_var, haifa_saved_data::next, processed, and tick.
|
static |
Referenced by move_insn().
|
static |
Helper function. Fix CFG after both in- and inter-block movement of control_flow_insn_p JUMP.
References basic_block_def::next_bb, SCHED_EBB_PASS, common_sched_info_def::sched_pass_id, and update_bb_for_insn().
|
static |
Referenced by schedule_insn().
|
static |
Removes dependency between instructions in the recovery block REC and usual region instructions. It keeps inner dependences so it won't be necessary to recompute them.
References add_jump_dependencies(), alloc_INSN_LIST(), bitmap_clear(), bitmap_set_bit(), free_INSN_LIST_list(), sd_delete_dep(), sd_iterator_cond(), sd_iterator_next(), sd_iterator_start(), and try_ready().
|
static |
Referenced by apply_replacement(), and try_ready().
|
static |
Calculate INSN_TICK of NEXT and add it to either ready or queue list.
References change_queue_index(), clock_var, dep_cost(), sched_pressure, SCHED_PRESSURE_NONE, sd_lists_empty_p(), and tick.
|
static |
Free the entire backtrack queue.
References free_topmost_backtrack_point().
Referenced by schedule_block().
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().
|
static |
Discard all data associated with the topmost entry in the backtrack queue. If RESET_TICK is false, we just want to free the data. If true, we are doing this because we discovered a reason to backtrack. In the latter case, also reset the INSN_TICK for the shadow insn.
References backtrack_queue, haifa_saved_data::be_saved_data, haifa_saved_data::curr_state, haifa_saved_data::delay_pair, haifa_saved_data::fe_saved_data, free(), free_INSN_LIST_list(), delay_pair::i2, haifa_saved_data::insn_queue, haifa_saved_data::next, delay_pair::next_same_i1, haifa_saved_data::ready, haifa_saved_data::replace_apply, haifa_saved_data::replacement_deps, haifa_sched_info::restore_state, targetm, undo_replacements_for_backtrack(), and ready_list::vec.
Referenced by free_backtrack_queue(), and schedule_block().
|
static |
Referenced by schedule_block().
|
static |
Generates recovery code for INSN.
References add_to_speculative_block(), and begin_speculative_block().
void get_ebb_head_tail | ( | ) |
Return the head and tail pointers of ebb starting at BEG and ending at END.
References df_insn_change_bb(), reorder_insns_nobb(), sched_dump, and sched_verbose.
Referenced by build_intra_loop_deps(), compute_block_dependences(), compute_priorities(), const_iteration_count(), debug_rgn_dependencies(), find_ebb_boundaries(), free_block_dependencies(), free_rgn_deps(), init_ready_list(), loop_single_full_bb_p(), schedule_region(), and sms_schedule().
rtx get_ready_element | ( | ) |
Get number of ready's in the ready list.
References ready_element().
Referenced by cond_clobbered_p(), recompute_todo_spec(), restore_pattern(), try_ready(), and unschedule_insns_until().
|
static |
Change pattern of INSN to NEW_PAT. Invalidate cached haifa instruction data.
References update_insn_after_change(), and validate_change().
int haifa_classify_insn | ( | ) |
References haifa_classify_rtx().
Referenced by add_deps_for_risky_insns(), earliest_block_with_similiar_load(), is_exception_free(), and is_pfree().
|
static |
Classifies rtx X of an insn for the purpose of verifying that X can be executed speculatively (and consequently the insn can be moved speculatively), by examining X, returning: TRAP_RISKY: store, or risky non-load insn (e.g. division by variable). TRAP_FREE: non-load insn. IFREE: load from a globally safe location. IRISKY: volatile load. PFREE_CANDIDATE, PRISKY_CANDIDATE: load that need to be checked for being either PFREE or PRISKY.
References IRISKY, len, may_trap_exp(), SET, TRAP_FREE, and TRAP_RISKY.
Referenced by haifa_classify_insn().
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().
int haifa_htab_i1_traverse | ( | ) |
Called through htab_traverse. Walk the hashtable using I2 as index, and delete all elements involving an UID higher than that pointed to by *DATA.
References hash_table< Descriptor, Allocator >::clear_slot(), first, delay_pair::i2, and delay_pair::next_same_i1.
Referenced by discard_delay_pairs_above().
int haifa_htab_i2_traverse | ( | ) |
Called through htab_traverse. Walk the hashtable using I2 as index, and delete all elements involving an UID higher than that pointed to by *DATA.
References hash_table< Descriptor, Allocator >::clear_slot(), delay_pair::i1, and delay_pair::i2.
Referenced by discard_delay_pairs_above().
void haifa_init_h_i_d | ( | ) |
Initialize haifa_insn_data for BBS.
References extend_h_i_d(), and init_h_i_d().
Referenced by haifa_sched_init(), and sel_region_init().
|
static |
Referenced by add_to_speculative_block(), create_check_block_twin(), init_before_recovery(), and sched_emit_insn().
|
static |
Init data for the new insn INSN.
References adding_bb_to_current_region_p, extend_dependency_caches(), extend_h_i_d(), init_h_i_d(), init_insn_reg_pressure_info(), sched_deps_init(), sched_extend_luids(), sched_extend_target(), sched_init_insn_luid(), sched_pressure, SCHED_PRESSURE_NONE, and sd_init_insn().
|
static |
Referenced by haifa_sched_init().
|
static |
Init data for the new basic block BB which comes after AFTER.
References common_sched_info_def::add_block, and sched_init_bbs().
|
static |
Returns a class that insn with GET_DEST(insn)=x may belong to, as found by analyzing insn's expression.
|
static |
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().
Referenced by try_ready().
|
static |
References sched_deps_info_def::generate_spec_deps, sched_deps_info, and sched_speculate_insn().
void increase_insn_priority | ( | ) |
Use this sel-sched.c friendly function in reorder2 instead of increasing INSN_PRIORITY explicitly.
References sel_add_to_insn_priority(), and sel_sched_p().
|
static |
Referenced by sched_create_recovery_block().
|
static |
Initialize BEFORE_RECOVERY variable.
References add_bb_to_loop(), adding_bb_to_current_region_p, before_recovery, block_label(), basic_block_def::count, spec_info_def::dump, emit_barrier_after(), emit_jump_insn_after(), find_fallthru_edge_from(), basic_block_def::frequency, haifa_init_insn(), basic_block_def::index, last, make_single_succ_edge(), basic_block_def::prev_bb, redirect_edge_succ(), sched_create_empty_bb, sched_extend_bb(), sched_init_only_bb, sched_verbose, and single.
|
static |
Referenced by haifa_init_h_i_d(), and haifa_init_insn().
|
static |
Initialize h_i_d entry of the INSN with default values. Values, that are not explicitly initialized here, hold zero.
|
static |
Initiate current register pressure related info at the start of basic block BB.
References bb_has_eh_pred(), bitmap_bit_p(), curr_reg_pressure, current_nr_blocks, df_get_live_in(), initiate_reg_pressure_info(), mark_regno_birth_or_death(), and setup_ref_regs().
Referenced by sched_setup_bb_reg_pressure_info().
|
static |
Initiate current register pressure related info from living registers given by LIVE.
References bitmap_bit_p(), bitmap_clear(), curr_reg_pressure, current_nr_blocks, mark_regno_birth_or_death(), sched_pressure, and SCHED_PRESSURE_MODEL.
Referenced by initiate_bb_reg_pressure_info(), and model_start_schedule().
int insn_cost | ( | ) |
Compute cost of executing INSN. This is the number of cycles between instruction issue and instruction results.
References recog_memoized(), and sel_sched_p().
Referenced by debug_dependencies(), dep_cost_1(), noce_try_cmove_arith(), and priority().
|
static |
Return the number of cycles until INSN is expected to be ready. Return zero if it already is.
References clock_var.
Referenced by model_excess_cost(), model_set_excess_costs(), and rank_for_schedule().
|
static |
Return true if scheduling INSN will finish current clock cycle.
References haifa_sched_info::insn_finishes_block_p.
Referenced by max_issue().
int insn_luid | ( | ) |
Return logical uid of INSN. Helpful while debugging.
Referenced by add_btr_def(), ask_dependency_caches(), compute_defs_uses_and_gen(), new_btr_user(), sd_delete_dep(), sd_find_dep_between(), set_dependency_caches(), and update_dependency_caches().
|
static |
For every dependency of INSN, set the FEEDS_BACKTRACK_INSN bit according to SET_P.
Referenced by restore_last_backtrack_point(), and save_backtrack_point().
|
inlinestatic |
PRESSURE[CL] describes the pressure on register class CL. Update it for the birth (if BIRTH_P) or death (if !BIRTH_P) of register REGNO. LIVE tracks the set of live registers; if it is null, assume that every birth or death is genuine.
References bitmap_clear_bit(), bitmap_set_bit(), and sched_regno_pressure_class.
Referenced by calculate_reg_deaths(), initiate_bb_reg_pressure_info(), initiate_reg_pressure_info(), model_recompute(), and update_register_pressure().
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().
|
static |
Referenced by haifa_classify_rtx(), and may_trap_exp().
|
static |
References IFREE, IRISKY, may_trap_exp(), may_trap_p(), PFREE_CANDIDATE, PRISKY_CANDIDATE, TRAP_FREE, and TRAP_RISKY.
|
static |
Update all successors of INSN, given that INSN has just been scheduled.
References model_insn_info::depth, model_insn_info::insn, model_add_to_worklist(), model_promote_insn(), model_insn_info::next, and model_insn_info::unscheduled_preds.
Referenced by model_choose_insn().
|
static |
Add INSN to the end of the model schedule.
Referenced by model_choose_insn().
|
static |
Add INSN to the model worklist. Start looking for a suitable position between neighbors PREV and NEXT, testing at most MAX_SCHED_READY_INSNS insns either side. A null PREV indicates the beginning of the list and a null NEXT indicates the end.
References count, model_add_to_worklist_at(), model_order_p(), model_insn_info::next, and model_insn_info::prev.
Referenced by model_add_successors_to_worklist(), model_analyze_insns(), and model_promote_predecessors().
|
static |
Add INSN to the model worklist immediately after PREV. Add it to the beginning of the list if PREV is null.
References model_insn_info::insn, model_worklist, model_insn_info::next, and model_insn_info::prev.
Referenced by model_add_to_worklist(), model_promote_insn(), and model_promote_predecessors().
|
static |
Analyze the instructions that are to be scheduled, setting up MODEL_INSN_INFO (...) and model_num_insns accordingly. Add ready instructions to model_worklist.
References model_insn_info::alap, dep_list_size(), model_insn_info::insn, model_add_to_worklist(), model_num_insns, haifa_sched_info::next_tail, model_insn_info::old_queue, haifa_sched_info::prev_head, and model_insn_info::unscheduled_preds.
Referenced by model_start_schedule().
|
static |
Pick one instruction from model_worklist and process it.
References model_insn_info::alap, count, model_insn_info::depth, model_insn_info::insn, model_add_successors_to_worklist(), model_add_to_schedule(), model_classify_pressure(), model_insn_info::model_priority, model_promote_predecessors(), model_record_pressures(), model_remove_from_worklist(), model_worklist, model_insn_info::next, sched_dump, sched_verbose, model_insn_info::unscheduled_preds, and update_register_pressure().
Referenced by model_start_schedule().
|
static |
Return (in order): - positive if INSN adversely affects the pressure on one register class - negative if INSN reduces the pressure on one register class - 0 if INSN doesn't affect the pressure on any register class.
References calculate_reg_deaths(), model_insn_info::insn, and reg_pressure_data::set_increase.
Referenced by model_choose_insn().
|
static |
Dump the next points of maximum pressure for GROUP.
References curr_reg_pressure, model_pressure_group::limits, model_num_insns, model_pressure_limit::point, model_pressure_limit::pressure, reg_class_names, and sched_dump.
Referenced by model_set_excess_costs().
|
static |
We have calculated the model schedule and spill costs. Print a summary to sched_dump.
References model_pressure_group::limits, model_before_pressure, model_pressure_limit::pressure, reg_class_names, and sched_dump.
Referenced by model_start_schedule().
|
static |
Free the information created by model_start_schedule.
References model_before_pressure, and model_finalize_pressure_group().
Referenced by schedule_block().
|
static |
Return baseECC (MODEL_INSN (INSN)). Dump the costs to sched_dump if PRINT_P.
References calculate_reg_deaths(), insn_delay(), model_before_pressure, model_excess_group_cost(), model_index(), reg_class_names, sched_dump, and reg_pressure_data::set_increase.
Referenced by model_set_excess_costs().
|
static |
Return baseECC (ira_pressure_classes[PCI], POINT), given that P = curr_reg_pressure[ira_pressure_classes[PCI]] and that P' = P + DELTA.
References curr_reg_pressure, model_pressure_group::limits, model_spill_cost(), model_pressure_limit::orig_pressure, model_pressure_limit::point, and model_pressure_limit::pressure.
Referenced by model_excess_cost().
|
static |
Free the information associated with GROUP.
References model_pressure_group::model.
Referenced by model_end_schedule().
|
static |
Return INSN's index in the model schedule, or model_num_insns if it doesn't belong to that schedule.
References model_num_insns.
Referenced by model_excess_cost(), model_last_use_except(), model_recompute(), model_record_pressures(), queue_to_ready(), rank_for_schedule(), and schedule_insn().
|
static |
The global state describes the register pressure at the start of the model schedule. Initialize GROUP accordingly.
References curr_reg_pressure, model_pressure_group::limits, model_pressure_group::model, model_num_insns, model_pressure_limit::point, and model_pressure_limit::pressure.
Referenced by model_start_schedule().
|
static |
Return the model_index of the last unscheduled use in chain USE outside of USE's instruction. Return -1 if there are no other uses, or model_num_insns if the register is live at the end of the block.
References reg_use_data::insn, last, model_index(), model_num_insns, and reg_use_data::next_regno_use.
Referenced by model_recompute().
|
static |
Return true if INSN1 should come before INSN2 in the model schedule.
References model_insn_info::alap, model_insn_info::depth, model_insn_info::insn, and model_insn_info::model_priority.
Referenced by model_add_to_worklist(), and model_promote_insn().
|
static |
INSN may now have a higher priority (in the model_order_p sense) than before. Move it up the worklist if necessary.
References count, model_add_to_worklist_at(), model_order_p(), model_remove_from_worklist(), and model_insn_info::prev.
Referenced by model_add_successors_to_worklist().
|
static |
Give INSN a higher priority than any current instruction, then give unscheduled predecessors of INSN a higher priority still. If any of those predecessors are not on the model worklist, do the same for its predecessors, and so on.
References first, model_insn_info::insn, model_add_to_worklist(), model_add_to_worklist_at(), model_next_priority, model_insn_info::model_priority, model_remove_from_worklist(), model_insn_info::next, sched_dump, and sched_verbose.
Referenced by model_choose_insn().
|
static |
INSN has just been scheduled. Update the model schedule accordingly.
References mark_regno_birth_or_death(), model_before_pressure, model_curr_point, model_index(), model_last_use_except(), model_start_update_pressure(), model_update_pressure(), reg_use_data::next_insn_use, queue, reg_class_names, reg_use_data::regno, sched_dump, sched_verbose, reg_pressure_data::set_increase, and str_pattern_slim().
Referenced by schedule_insn().
|
static |
All instructions have been added to the model schedule. Record the final register pressure in GROUP and set up all MODEL_MAX_PRESSUREs.
References curr_reg_pressure, model_pressure_group::limits, model_num_insns, model_record_pressure(), model_pressure_limit::orig_pressure, and model_pressure_limit::pressure.
Referenced by model_start_schedule().
|
static |
Record that MODEL_REF_PRESSURE (GROUP, POINT, PCI) is PRESSURE. Update the maximum pressure for the whole schedule.
References model_pressure_group::limits, model_pressure_limit::point, and model_pressure_limit::pressure.
Referenced by model_record_final_pressures(), and model_record_pressures().
|
static |
INSN has just been added to the end of the model schedule. Record its register-pressure information.
References model_insn_info::alap, calculate_reg_deaths(), curr_reg_pressure, model_insn_info::depth, model_insn_info::insn, model_before_pressure, model_index(), model_insn_info::model_priority, model_record_pressure(), reg_class_names, sched_dump, sched_verbose, reg_pressure_data::set_increase, and str_pattern_slim().
Referenced by model_choose_insn().
|
static |
Remove INSN from the model worklist.
References model_insn_info::insn, model_insn_info::next, and model_insn_info::prev.
Referenced by model_choose_insn(), model_promote_insn(), and model_promote_predecessors().
|
static |
Restore all QUEUE_INDEXs to the values that they had before model_start_schedule was called.
References model_insn_info::insn.
Referenced by model_start_schedule().
|
static |
Set INSN_REG_PRESSURE_EXCESS_COST_CHANGE for INSNS[0...COUNT-1].
References count, insn_delay(), model_before_pressure, model_dump_pressure_points(), model_excess_cost(), priority(), sched_dump, and sched_verbose.
Referenced by ready_sort().
|
static |
model_spill_cost (CL, P, P') returns the cost of increasing the pressure on CL from P to P'. We use this to calculate a "base ECC", baseECC (CL, X), for each pressure class CL and each instruction X. Supposing X changes the pressure on CL from P to P', and that the maximum pressure on CL in the current model schedule is MP', then: * if X occurs before or at the next point of maximum pressure in the model schedule and P' > MP', then: baseECC (CL, X) = model_spill_cost (CL, MP, P') The idea is that the pressure after scheduling a fixed set of instructions -- in this case, the set up to and including the next maximum pressure point -- is going to be the same regardless of the order; we simply want to keep the intermediate pressure under control. Thus X has a cost of zero unless scheduling it now would exceed MP'. If all increases in the set are by the same amount, no zero-cost instruction will ever cause the pressure to exceed MP'. However, if X is instead moved past an instruction X' with pressure in the range (MP' - (P' - P), MP'), the pressure at X' will increase beyond MP'. Since baseECC is very much a heuristic anyway, it doesn't seem worth the overhead of tracking cases like these. The cost of exceeding MP' is always based on the original maximum pressure MP. This is so that going 2 registers over the original limit has the same cost regardless of whether it comes from two separate +1 deltas or from a single +2 delta. * if X occurs after the next point of maximum pressure in the model schedule and P' > P, then: baseECC (CL, X) = model_spill_cost (CL, MP, MP' + (P' - P)) That is, if we move X forward across a point of maximum pressure, and if X increases the pressure by P' - P, then we conservatively assume that scheduling X next would increase the maximum pressure by P' - P. Again, the cost of doing this is based on the original maximum pressure MP, for the same reason as above. * if P' < P, P > MP, and X occurs at or after the next point of maximum pressure, then: baseECC (CL, X) = -model_spill_cost (CL, MAX (MP, P'), P) That is, if we have already exceeded the original maximum pressure MP, and if X might reduce the maximum pressure again -- or at least push it further back, and thus allow more scheduling freedom -- it is given a negative cost to reflect the improvement. * otherwise, baseECC (CL, X) = 0 In this case, X is not expected to affect the maximum pressure MP', so it has zero cost. We then create a combined value baseECC (X) that is the sum of baseECC (CL, X) for each pressure class CL. baseECC (X) could itself be used as the ECC value described above. However, this is often too conservative, in the sense that it tends to make high-priority instructions that increase pressure wait too long in cases where introducing a spill would be better. For this reason the final ECC is a priority-adjusted form of baseECC (X). Specifically, we calculate: P (X) = INSN_PRIORITY (X) - insn_delay (X) - baseECC (X) baseP = MAX { P (X) | baseECC (X) <= 0 } Then: ECC (X) = MAX (MIN (baseP - P (X), baseECC (X)), 0) Thus an instruction's effect on pressure is ignored if it has a high enough priority relative to the ones that don't increase pressure. Negative values of baseECC (X) do not increase the priority of X itself, but they do make it harder for other instructions to increase the pressure further. This pressure cost is deliberately timid. The intention has been to choose a heuristic that rarely interferes with the normal list scheduler in cases where that scheduler would produce good code. We simply want to curb some of its worst excesses.
Return the cost of increasing the pressure in class CL from FROM to TO. Here we use the very simplistic cost model that every register above ira_class_hard_regs_num[CL] has a spill cost of 1. We could use other measures instead, such as one based on MEMORY_MOVE_COST. However: (1) In order for an instruction to be scheduled, the higher cost would need to be justified in a single saving of that many stalls. This is overly pessimistic, because the benefit of spilling is often to avoid a sequence of several short stalls rather than a single long one. (2) The cost is still arbitrary. Because we are not allocating registers during scheduling, we have no way of knowing for sure how many memory accesses will be required by each spill, where the spills will be placed within the block, or even which block(s) will contain the spills. So a higher cost than 1 is often too conservative in practice, forcing blocks to contain unnecessary stalls instead of spill code. The simple cost below seems to be the best compromise. It reduces the interference with the normal list scheduler, which helps make it more suitable for a default-on option.
Referenced by model_excess_group_cost().
|
static |
Initialize the SCHED_PRESSURE_MODEL information for the current scheduling region.
References df_get_live_in(), initiate_reg_pressure_info(), model_analyze_insns(), model_before_pressure, model_choose_insn(), model_curr_point, model_dump_pressure_summary(), model_init_pressure_group(), model_next_priority, model_num_insns, model_record_final_pressures(), model_reset_queue_indices(), haifa_sched_info::prev_head, sched_dump, sched_max_luid, and sched_verbose.
Referenced by schedule_block().
|
static |
An instruction with model_index POINT has just been scheduled, and it adds DELTA to the pressure on ira_pressure_classes[PCI] after POINT - 1. Update MODEL_REF_PRESSURE (GROUP, POINT, PCI) and MODEL_MAX_PRESSURE (GROUP, POINT, PCI) accordingly.
References model_pressure_group::limits, model_num_insns, and model_pressure_limit::point.
Referenced by model_recompute().
|
static |
Make sure that all register-pressure limits are up-to-date for the current position in the model schedule.
References model_before_pressure, and model_update_limit_points_in_group().
Referenced by schedule_insn().
|
static |
Make sure that GROUP->limits is up-to-date for the current point of the model schedule.
References model_pressure_group::limits, model_curr_point, model_num_insns, model_pressure_limit::point, and model_pressure_limit::pressure.
Referenced by model_update_limit_points().
|
static |
Record that scheduling a later instruction has changed the pressure at point POINT of the model schedule by DELTA (which might be 0). Update GROUP accordingly. Return nonzero if these changes might trigger changes to previous points as well.
References model_pressure_group::limits, model_pressure_limit::point, and model_pressure_limit::pressure.
Referenced by model_recompute().
|
static |
Referenced by move_insn().
|
static |
Fix CFG after interblock movement of control_flow_insn_p JUMP.
References df_mark_solutions_dirty(), common_sched_info_def::fix_recovery_cfg, basic_block_def::index, link_block(), move_succs(), basic_block_def::next_bb, basic_block_def::succs, unlink_block(), and update_bb_for_insn().
|
static |
Move INSN. Reemit notes if needed. Update CFG, if needed.
References control_flow_insn_p(), df_insn_change_bb(), fix_jump_move(), dep_replacement::insn, last, move_block_after_check(), SCHED_EBB_PASS, common_sched_info_def::sched_pass_id, and SCHED_RGN_PASS.
Referenced by commit_schedule(), copy_src_to_dest(), initialize_uninitialized_regs(), move_unallocated_pseudos(), and setup_prohibited_mode_move_regs().
|
static |
Referenced by move_block_after_check().
|
static |
Helper function for move_block_after_check. This functions attaches edge vector pointed to by SUCCSP to block TO.
References edge_def::src, and basic_block_def::succs.
|
static |
After DEP, which was cancelled, has been resolved for insn NEXT, check whether the insn's pattern needs restoring.
References dep_replacement::insn, dep_replacement::loc, and dep_replacement::orig.
Referenced by schedule_insn().
int no_real_insns_p | ( | ) |
Return nonzero if there are no real insns in the range [ HEAD, TAIL ].
Referenced by compute_priorities(), free_block_dependencies(), schedule_ebb(), schedule_region(), and sel_region_target_finish().
int number_in_ready | ( | void | ) |
Get number of ready insn in the ready list.
References ready_list::n_ready.
|
static |
Used by early_queue_to_ready. Determines whether it is "ok" to prematurely move INSN from the queue to the ready list. Currently, if a target defines the hook 'is_costly_dependence', this function uses the hook to check whether there exist any dependences which are considered costly by the target, between INSN and other insns that have already been scheduled. Dependences are checked up to Y cycles back, with default Y=1; The flag -fsched-stalled-insns-dep=Y allows controlling this value. (Other considerations could be taken into account instead (or in addition) depending on user flags and target hooks.
References dep_cost(), sd_find_dep_between(), and targetm.
Referenced by early_queue_to_ready().
|
static |
For a pair P of insns, return the fixed distance in cycles from the first insn after which the second must be scheduled.
References delay_pair::cycles, modulo_ii, and delay_pair::stages.
Referenced by add_delay_dependencies(), dep_cost_1(), estimate_shadow_tick(), save_backtrack_point(), and verify_shadows().
|
static |
Perform pattern replacements that were queued up until the next cycle.
References apply_replacement(), and restore_pattern().
Referenced by schedule_block().
|
static |
Print info about the current register pressure and its excess for each pressure class.
References curr_reg_pressure, reg_class_names, and sched_dump.
Referenced by schedule_block(), and schedule_insn().
|
static |
Forward declarations.
Referenced by add_prefix(), bb_to_key(), build_cdtor(), calc_priorities(), decl_fini_priority_insert(), decl_init_priority_insert(), find_hard_regno_for(), model_set_excess_costs(), priority(), sel_target_adjust_priority(), set_priorities(), and setup_allocno_priorities().
|
static |
Compute the priority number for INSN.
References contributes_to_priority_p(), dep_cost(), dep_list_size(), init_dep(), insn_cost(), priority(), and sel_sched_p().
Referenced by add_to_speculative_block(), and create_check_block_twin().
|
static |
Helper function. Tries to add speculative dependencies of type FS between instructions in deps_list L and TWIN.
References ds_weak(), init_dep_1(), sched_insn_is_legitimate_for_speculation_p(), and sd_add_dep().
|
static |
Examine all insns on the ready list and queue those which can't be issued in this cycle. TEMP_STATE is temporary scheduler state we can use as scratch space. If FIRST_CYCLE_INSN_P is true, no insns have been issued for the current cycle, which means it is valid to issue an asm statement. If SHADOWS_ONLY_P is true, we eliminate all real insns and only leave those for which SHADOW_P is true. If MODULO_EPILOGUE is true, we only leave insns which have an INSN_EXACT_TICK.
References asm_noperands(), clock_var, dfa_state_size, estimate_shadow_tick(), hash_table< Descriptor, Allocator >::find_with_hash(), hash_table< Descriptor, Allocator >::is_created(), memcpy(), choice_entry::n, ready_list::n_ready, delay_pair::next_same_i1, queue_insn(), ready_element(), ready_remove(), recog_memoized(), sched_pressure, SCHED_PRESSURE_MODEL, and SCHED_PRESSURE_NONE.
Referenced by schedule_block().
|
static |
Referenced by change_queue_index(), prune_ready_list(), queue_to_ready(), and schedule_block().
|
static |
Add INSN to the insn queue so that it can be executed at least N_CYCLES after the currently executing insn. Preserve insns chain for debugging purposes. REASON will be printed in debugging output.
References alloc_INSN_LIST(), clock_var, DO_BACKTRACKING, haifa_sched_info::flags, insn_queue, must_backtrack, haifa_sched_info::print_insn, q_ptr, q_size, sched_dump, and sched_verbose.
|
static |
Remove INSN from queue.
References insn_queue, q_size, and remove_free_INSN_LIST_elem().
Referenced by change_queue_index(), check_clobbered_conditions(), and resolve_dependencies().
|
static |
Referenced by schedule_block().
|
static |
Move insns that became ready to fire from queue to ready list.
References advance_one_cycle(), clock_var, dbg_cnt(), free_INSN_LIST_list(), dep_replacement::insn, insn_queue, model_curr_point, model_index(), model_num_insns, ready_list::n_debug, ready_list::n_ready, next_nonnote_nondebug_insn(), nonscheduled_insns_begin, haifa_sched_info::print_insn, q_ptr, q_size, queue_insn(), ready_add(), reload_completed, sched_dump, sched_pressure, SCHED_PRESSURE_MODEL, and sched_verbose.
|
static |
Referenced by swap_sort().
|
static |
Returns a positive value if x is preferred; returns a negative value if y is preferred. Should never return 0, since that will make the sort unstable.
References clock_var, dep_cost(), dep_list_size(), DO_BACKTRACKING, ds_weak(), haifa_sched_info::flags, insn_delay(), last, last_nondebug_scheduled_insn, model_index(), haifa_sched_info::rank, sched_pressure, SCHED_PRESSURE_MODEL, SCHED_PRESSURE_NONE, and sd_find_dep_between().
|
static |
Notes handling mechanism: ========================= Generally, NOTES are saved before scheduling and restored after scheduling. The scheduler distinguishes between two types of notes: (1) LOOP_BEGIN, LOOP_END, SETJMP, EHREGION_BEG, EHREGION_END notes: Before scheduling a region, a pointer to the note is added to the insn that follows or precedes it. (This happens as part of the data dependence computation). After scheduling an insn, the pointer contained in it is used for regenerating the corresponding note (in reemit_notes). (2) All other notes (e.g. INSN_DELETED): Before scheduling a block, these notes are put in a list (in rm_other_notes() and unlink_other_notes ()). After scheduling the block, these notes are inserted at the beginning of the block (in schedule_block()).
Referenced by change_queue_index(), early_queue_to_ready(), queue_to_ready(), and schedule_block().
|
static |
Add an element INSN to the ready list so that it ends up with the lowest/highest priority depending on FIRST_P.
References clock_var, ready_list::first, must_backtrack, ready_list::n_debug, ready_list::n_ready, ready_lastpos(), ready_list::vec, and ready_list::veclen.
rtx ready_element | ( | ) |
The following code implements multi-pass scheduling for the first cycle. In other words, we will try to choose ready insn which permits to start maximum number of insns on the same cycle.
Return a pointer to the element INDEX from the ready. INDEX for insn with the highest priority is 0, and the lowest priority has N_READY - 1.
References ready_list::first, ready_list::n_ready, and ready_list::vec.
Referenced by check_clobbered_conditions(), choose_ready(), get_ready_element(), invoke_dfa_lookahead_guard(), invoke_reorder_hooks(), max_issue(), prune_ready_list(), ready_remove_first_dispatch(), ready_remove_insn(), and schedule_block().
rtx* ready_lastpos | ( | ) |
Return a pointer to the bottom of the ready list, i.e. the insn with the lowest priority.
References ready_list::first, ready_list::n_ready, and ready_list::vec.
Referenced by debug_ready_list(), invoke_reorder_hooks(), ready_add(), ready_sort(), restore_last_backtrack_point(), schedule_block(), and toggle_cancelled_flags().
|
static |
The following functions are used to implement multi-pass scheduling on the first cycle.
Referenced by choose_ready(), prune_ready_list(), ready_remove_first_dispatch(), ready_remove_insn(), and schedule_block().
|
static |
Remove the element INDEX from the ready list and return it. INDEX for insn with the highest priority is 0, and the lowest priority has N_READY - 1.
References ready_list::first, ready_list::n_debug, ready_list::n_ready, ready_remove_first(), and ready_list::vec.
|
static |
Referenced by choose_ready(), ready_remove(), ready_remove_first_dispatch(), and schedule_block().
|
static |
Remove the element with the highest priority from the ready list and return it.
References ready_list::first, ready_list::n_debug, ready_list::n_ready, ready_list::vec, and ready_list::veclen.
|
static |
Referenced by choose_ready().
|
static |
This function returns a candidate satisfying dispatch constraints from the ready list.
References active_insn_p(), reg_use_data::insn, ready_list::n_ready, ready_element(), ready_remove(), ready_remove_first(), and targetm.
|
static |
Referenced by change_queue_index(), check_clobbered_conditions(), and choose_ready().
|
static |
Remove INSN from the ready list.
References ready_list::n_ready, ready_element(), and ready_remove().
void ready_sort | ( | ) |
Sort the ready list READY by ascending priority, using the SCHED_SORT macro.
References first, model_curr_point, model_num_insns, model_set_excess_costs(), ready_list::n_ready, ready_lastpos(), sched_pressure, SCHED_PRESSURE_MODEL, SCHED_PRESSURE_WEIGHTED, and setup_insn_reg_pressure_info().
Referenced by schedule_block().
rtx real_insn_for_shadow | ( | ) |
Examine the delay pair hashtable to see if INSN is a shadow for another, and return the other insn if so. Return NULL otherwise.
References hash_table< Descriptor, Allocator >::find_with_hash(), delay_pair::i1, hash_table< Descriptor, Allocator >::is_created(), and delay_pair::stages.
Referenced by add_dependence(), and recompute_todo_spec().
|
static |
Look at the remaining dependencies for insn NEXT, and compute and return the TODO_SPEC value we should use for it. This is called after one of NEXT's dependencies has been resolved. We also perform pattern replacements for predication, and for broken replacement dependencies. The latter is only done if FOR_BACKTRACK is false.
References apply_replacement(), spec_info_def::data_weakness_cutoff, dbg_cnt(), DO_PREDICATION, ds_merge(), ds_weak(), find_all_hard_reg_sets(), haifa_sched_info::flags, haifa_change_pattern(), dep_replacement::insn, real_insn_for_shadow(), sched_get_reverse_condition_uncached(), sd_lists_empty_p(), and tick.
Referenced by restore_last_backtrack_point(), try_ready(), and unschedule_insns_until().
void record_delay_slot_pair | ( | ) |
This function can be called by a port just before it starts the final scheduling pass. It records the fact that an instruction with delay slots has been split into two insns, I1 and I2. The first one will be scheduled normally and initiates the operation. The second one is a shadow which must follow a specific number of cycles after I1; its only purpose is to show the side effect that occurs at that cycle in the RTL. If a JUMP_INSN or a CALL_INSN has been split, I1 should be a normal INSN, while I2 retains the original insn type. There are two ways in which the number of cycles can be specified, involving the CYCLES and STAGES arguments to this function. If STAGES is zero, we just use the value of CYCLES. Otherwise, STAGES is a factor which is multiplied by MODULO_II to give the number of cycles. This is only useful if the caller also calls set_modulo_params to enable modulo scheduling.
References hash_table< Descriptor, Allocator >::create(), delay_pair::cycles, hash_table< Descriptor, Allocator >::find_slot_with_hash(), i1, delay_pair::i1, i2, delay_pair::i2, hash_table< Descriptor, Allocator >::is_created(), delay_pair::next_same_i1, and delay_pair::stages.
void reemit_notes | ( | ) |
Search INSN for REG_SAVE_NOTE notes and convert them back into insn NOTEs. This is used for NOTE_INSN_EPILOGUE_BEG, so that sched-ebb replaces the epilogue note in the correct basic block.
References emit_note_before(), dep_replacement::insn, last, and remove_note().
Referenced by commit_schedule().
void remove_notes | ( | ) |
Delete notes between HEAD and TAIL and put them in the chain of notes ended by NOTE_LIST.
References add_reg_note(), dep_replacement::insn, note_list, remove_insn(), and sel_sched_p().
Referenced by schedule_ebb(), and schedule_region().
|
static |
If INSN has no unresolved backwards dependencies, add it to the schedule and recursively resolve all its forward dependencies.
References queue_remove(), sched_dump, sched_verbose, sd_iterator_cond(), sd_iterator_start(), sd_lists_empty_p(), and sd_resolve_dep().
Referenced by schedule_block().
|
static |
Referenced by schedule_block().
|
static |
Restore basic block notes. FIRST is the first basic block in the ebb.
References bb_header, free(), basic_block_def::index, and basic_block_def::next_bb.
|
static |
Restore scheduler state from the topmost entry on the backtracking queue. PSCHED_BLOCK_P points to the local data of schedule_block that we must overwrite with the saved data. The caller must already have called unschedule_insns_until.
References backtrack_queue, haifa_saved_data::be_saved_data, clock_var, haifa_saved_data::clock_var, haifa_saved_data::curr_state, cycle_issued_insns, haifa_saved_data::cycle_issued_insns, haifa_saved_data::delay_pair, dfa_state_size, haifa_saved_data::fe_saved_data, first, free(), free_INSN_LIST_list(), delay_pair::i2, insn_queue, haifa_saved_data::insn_queue, last_clock_var, haifa_saved_data::last_clock_var, last_nondebug_scheduled_insn, haifa_saved_data::last_nondebug_scheduled_insn, last_scheduled_insn, haifa_saved_data::last_scheduled_insn, mark_backtrack_feeds(), memcpy(), ready_list::n_ready, haifa_saved_data::next, haifa_saved_data::next_cycle_apply, haifa_saved_data::next_cycle_deps, q_ptr, q_size, haifa_saved_data::q_size, haifa_saved_data::ready, ready_lastpos(), recompute_todo_spec(), haifa_sched_info::restore_state, haifa_saved_data::sched_block, targetm, toggle_cancelled_flags(), undo_replacements_for_backtrack(), and ready_list::vec.
Referenced by schedule_block().
rtx restore_other_notes | ( | ) |
Restore-other-notes: NOTE_LIST is the end of a chain of notes previously found among the insns. Insert them just before HEAD.
References bb_note(), and note_list.
Referenced by schedule_block().
|
static |
Referenced by perform_replacements_new_cycle(), schedule_insn(), and undo_replacements_for_backtrack().
|
static |
We have determined that a pattern involved in DEP must be restored. If IMMEDIATELY is false, we may have to postpone the replacement until the start of the next cycle, at which point we will be called again with IMMEDIATELY true.
References haifa_change_pattern(), dep_replacement::insn, dep_replacement::loc, dep_replacement::orig, reload_completed, haifa_saved_data::replace_apply, haifa_saved_data::replacement_deps, sched_dump, sched_verbose, sd_lists_empty_p(), targetm, tick, update_insn_after_change(), and validate_change().
|
static |
Restore saved register pressure related info.
References bitmap_copy(), curr_reg_pressure, and saved_reg_pressure.
Referenced by setup_insn_max_reg_pressure().
|
static |
Save the current scheduler state so that we can backtrack to it later if necessary. PAIR gives the insns that make it necessary to save this point. SCHED_BLOCK is the local state of schedule_block that need to be saved.
References backtrack_queue, haifa_saved_data::be_saved_data, clock_var, haifa_saved_data::clock_var, copy_INSN_LIST(), haifa_saved_data::curr_state, cycle_issued_insns, haifa_saved_data::cycle_issued_insns, haifa_saved_data::delay_pair, dfa_state_size, haifa_saved_data::fe_saved_data, ready_list::first, delay_pair::i2, insn_queue, haifa_saved_data::insn_queue, last_clock_var, haifa_saved_data::last_clock_var, last_nondebug_scheduled_insn, haifa_saved_data::last_nondebug_scheduled_insn, last_scheduled_insn, haifa_saved_data::last_scheduled_insn, mark_backtrack_feeds(), memcpy(), ready_list::n_debug, ready_list::n_ready, haifa_saved_data::next, haifa_saved_data::next_cycle_apply, haifa_saved_data::next_cycle_deps, delay_pair::next_same_i1, pair_delay(), q_ptr, q_size, haifa_saved_data::q_size, haifa_saved_data::ready, haifa_saved_data::replace_apply, haifa_saved_data::replacement_deps, haifa_sched_info::save_state, haifa_saved_data::sched_block, delay_pair::stages, targetm, ready_list::vec, and ready_list::veclen.
Referenced by schedule_block().
|
static |
Save current register pressure related info.
References bitmap_copy(), curr_reg_pressure, and saved_reg_pressure.
Referenced by setup_insn_max_reg_pressure().
basic_block sched_create_empty_bb_1 | ( | ) |
A generic version of sched_create_empty_bb ().
References create_empty_bb().
Referenced by haifa_sched_init().
basic_block sched_create_recovery_block | ( | ) |
Returns new recovery block.
References create_basic_block(), spec_info_def::dump, emit_barrier_after(), emit_label_after(), gen_label_rtx(), get_last_bb_insn(), haifa_recovery_bb_ever_added_p, haifa_recovery_bb_recently_added_p, basic_block_def::index, init_before_recovery(), and sched_verbose.
Referenced by create_check_block_twin().
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().
rtx sched_emit_insn | ( | ) |
Insert PAT as an INSN into the schedule and update the necessary data structures to account for it.
References haifa_sched_info::add_remove_insn, haifa_sched_info::begin_schedule_ready, emit_insn_before(), haifa_init_insn(), reg_use_data::insn, last_scheduled_insn, and nonscheduled_insns_begin.
|
static |
Extend per basic block data structures.
References emit_note_after(), and prev_nondebug_insn().
Referenced by init_before_recovery(), and sched_init_bbs().
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 | ( | ) |
Initialize per region data structures.
References dfa_state_size, issue_rate, ready_try, sched_ready_n_insns, choice_entry::state, targetm, ready_list::vec, ready_list::veclen, and xrecalloc().
Referenced by convert_vec_av_set_to_ready(), create_check_block_twin(), schedule_ebb(), and schedule_region().
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 | ( | ) |
Initialize LUID for INSN.
References common_sched_info_def::luid_for_non_insn, and sched_max_luid.
Referenced by haifa_init_insn(), and sched_init_luids().
void sched_init_luids | ( | ) |
Initialize luids for BBS. The hook common_sched_info->luid_for_non_insn () is used to determine if notes, labels, etc. need luids.
References sched_extend_luids(), and sched_init_insn_luid().
Referenced by haifa_sched_init(), and sel_region_init().
void sched_init_region_reg_pressure_info | ( | void | ) |
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().
|
static |
Referenced by create_check_block_twin().
|
static |
Remove INSN from the instruction stream. INSN should have any dependencies.
References haifa_sched_info::add_remove_insn, change_queue_index(), delete_insn(), and sd_finish_insn().
void sched_setup_bb_reg_pressure_info | ( | ) |
Set up register pressure at the beginning of basic block BB whose insns starting after insn AFTER. Set up also max register pressure for all insns of the basic block.
References initiate_bb_reg_pressure_info(), sched_pressure, SCHED_PRESSURE_WEIGHTED, and setup_insn_max_reg_pressure().
Referenced by schedule_region().
int sched_speculate_insn | ( | ) |
-1 - can't speculate, 0 - for speculation with REQUEST mode it is OK to use current instruction pattern, 1 - need to change pattern for *NEW_PAT to be speculative.
References DO_SPECULATION, haifa_sched_info::flags, spec_info_def::mask, sched_insn_is_legitimate_for_speculation_p(), and targetm.
Referenced by haifa_speculate_insn().
basic_block sched_split_block_1 | ( | ) |
A generic version of sched_split_block ().
References edge_def::dest, split_block(), and edge_def::src.
Referenced by haifa_sched_init().
bool schedule_block | ( | ) |
Use forward list scheduling to rearrange insns of block pointed to by TARGET_BB, possibly bringing insns from subsequent blocks in the same region.
References advance(), advance_one_cycle(), asm_noperands(), haifa_sched_info::begin_schedule_ready, sched_block_state::can_issue_more, haifa_sched_info::can_schedule_ready_p, choose_ready(), clock_var, commit_schedule(), cycle_issued_insns, dbg_cnt(), debug_ready_list(), haifa_saved_data::delay_pair, dfa_state_size, DONT_BREAK_DEPENDENCIES, dump_new_block_header(), early_queue_to_ready(), find_modifiable_mems(), hash_table< Descriptor, Allocator >::find_with_hash(), ready_list::first, sched_block_state::first_cycle_insn_p, fix_inter_tick(), haifa_sched_info::flags, free_backtrack_queue(), free_INSN_LIST_list(), free_INSN_LIST_node(), free_topmost_backtrack_point(), generate_recovery_code(), haifa_recovery_bb_recently_added_p, haifa_sched_info::head, delay_pair::i1, haifa_sched_info::init_ready_list, insn_queue, hash_table< Descriptor, Allocator >::is_created(), issue_rate, last_clock_var, last_nondebug_scheduled_insn, last_scheduled_insn, memcpy(), memset(), model_end_schedule(), model_start_schedule(), modulo_backtracks_left, sched_block_state::modulo_epilogue, modulo_ii, modulo_insns_scheduled, modulo_iter0_max_uid, modulo_last_stage, modulo_max_stages, modulo_n_insns, must_backtrack, ready_list::n_debug, ready_list::n_ready, next_nonnote_insn(), haifa_sched_info::next_tail, nonscheduled_insns_begin, perform_replacements_new_cycle(), haifa_sched_info::prev_head, print_curr_reg_pressure(), prune_ready_list(), q_ptr, q_size, queue_insn(), haifa_sched_info::queue_must_finish_empty, queue_to_ready(), ready_add(), ready_element(), ready_lastpos(), ready_remove(), ready_remove_first(), ready_sort(), recog_memoized(), reload_completed, resolve_dependencies(), restore_bb_notes(), restore_last_backtrack_point(), restore_other_notes(), save_backtrack_point(), sched_dump, sched_extend_luids(), sched_pressure, SCHED_PRESSURE_MODEL, SCHED_PRESSURE_NONE, SCHED_PRESSURE_WEIGHTED, sched_verbose, schedule_insn(), haifa_sched_info::schedule_more_p, sched_block_state::shadows_only_p, haifa_sched_info::tail, targetm, toggle_cancelled_flags(), undo_all_replacements(), unschedule_insns_until(), ready_list::veclen, and verify_shadows().
Referenced by schedule_ebb(), and schedule_region().
|
static |
Referenced by schedule_block().
|
static |
INSN is the "currently executing insn". Launch each insn which was waiting on INSN. READY is the ready list which contains the insns that are ready to fire. CLOCK is the current cycle. The function returns necessary cycle advance after issuing the insn (it is not zero for insns in a schedule group).
References advance(), apply_replacement(), reg_pressure_data::change, check_clobbered_conditions(), clock_var, df_insn_rescan(), fix_recovery_deps(), free(), dep_replacement::insn, issue_rate, last_clock_var, model_curr_point, model_index(), model_num_insns, model_recompute(), model_update_limit_points(), must_restore_pattern_p(), reg_use_data::next_insn_use, reg_use_data::next_regno_use, print_curr_reg_pressure(), haifa_sched_info::print_insn, recog_memoized(), reg_class_names, reload_completed, restore_pattern(), sched_dump, sched_pressure, SCHED_PRESSURE_MODEL, SCHED_PRESSURE_WEIGHTED, sched_verbose, sd_delete_dep(), sd_iterator_cond(), sd_iterator_next(), sd_iterator_start(), sd_lists_empty_p(), sd_resolve_dep(), reg_pressure_data::set_increase, str_pattern_slim(), try_ready(), update_reg_and_insn_max_reg_pressure(), and update_register_pressure().
void schedule_insns | ( | void | ) |
In sched-rgn.c.
Referenced by rest_of_handle_sched(), and rest_of_handle_sched2().
void set_modulo_params | ( | ) |
After the scheduler initialization function has been called, this function can be called to enable modulo scheduling. II is the initiation interval we should use, it affects the delays for delay_pairs that were recorded as separated by a given number of stages. MAX_STAGES provides us with a limit after which we give up scheduling; the caller must have unrolled at least as many copies of the loop body and recorded delay_pairs for them. INSNS is the number of real (non-debug) insns in one iteration of the loop. MAX_UID can be used to test whether an insn belongs to the first iteration of the loop; all of them have a uid lower than MAX_UID.
References max_uid, modulo_backtracks_left, modulo_ii, modulo_iter0_max_uid, modulo_max_stages, and modulo_n_insns.
int set_priorities | ( | ) |
Set_priorities: compute priority of each insn in the block.
References priority(), and haifa_sched_info::sched_max_insns_priority.
Referenced by compute_priorities(), and schedule_ebb().
|
static |
Set up or update (if UPDATE_P) max register pressure (see its meaning in sched-int.h::_haifa_insn_data) for all current BB insns after insn AFTER.
References curr_reg_pressure, reg_set_data::insn, restore_reg_pressure(), save_reg_pressure(), and update_register_pressure().
Referenced by sched_setup_bb_reg_pressure_info(), and update_reg_and_insn_max_reg_pressure().
|
static |
Setup info about the current register pressure impact of scheduling INSN at the current scheduling point.
References calculate_reg_deaths(), curr_reg_pressure, and reg_pressure_data::set_increase.
Referenced by ready_sort().
|
static |
Mark registers in X as mentioned in the current region.
References bitmap_set_bit(), and bitmap_set_range().
Referenced by initiate_bb_reg_pressure_info().
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().
|
static |
|
static |
Resort the array A in which only element at index N may be out of order.
References rank_for_schedule().
|
static |
Walk the ready list and all queues. If any insns have unresolved backwards dependencies, these must be cancelled deps, broken by predication. Set or clear (depending on SET) the DEP_CANCELLED bit in DEP_STATUS.
References first, insn_queue, ready_list::n_ready, q_ptr, and ready_lastpos().
Referenced by restore_last_backtrack_point(), and schedule_block().
int try_ready | ( | ) |
Check if NEXT is ready to be added to the ready or queue list. If "yes", add it to the proper list. Returns: -1 - is not ready yet, 0 - added to the ready list, 0 < N - queued for N cycles.
References adjust_priority(), change_queue_index(), spec_info_def::dump, fix_tick_ready(), haifa_change_pattern(), haifa_speculate_insn(), haifa_sched_info::new_ready, haifa_sched_info::print_insn, recompute_todo_spec(), sched_dump, and sched_verbose.
Referenced by create_check_block_twin(), fix_recovery_deps(), init_ready_list(), and schedule_insn().
|
static |
When we know we are going to discard the schedule due to a failed attempt at modulo scheduling, undo all replacements.
References dep_replacement::insn, dep_replacement::loc, dep_replacement::orig, sd_iterator_cond(), sd_iterator_next(), sd_iterator_start(), and validate_change().
Referenced by schedule_block().
|
static |
Undo the replacements that have occurred after backtrack point SAVE was placed.
References apply_replacement(), haifa_saved_data::replace_apply, haifa_saved_data::replacement_deps, and restore_pattern().
Referenced by free_topmost_backtrack_point(), and restore_last_backtrack_point().
void unlink_bb_notes | ( | ) |
Unlink basic block notes and labels and saves them, so they can be easily restored. We unlink basic block notes in EBB to provide back-compatibility with the previous code, as target backends assume, that there'll be only instructions between current_sched_info->{head and tail}. We restore these notes as soon as we can. FIRST (LAST) is the first (last) basic block in the ebb. NB: In usual case (FIRST == LAST) nothing is really done.
References bb_header, basic_block_def::index, basic_block_def::next_bb, and basic_block_def::prev_bb.
Referenced by schedule_ebb(), and schedule_region().
|
static |
Pop entries from the SCHEDULED_INSNS vector up to and including INSN. Restore their dependencies to an unresolved state, and mark them as queued nowhere.
References haifa_change_pattern(), last, modulo_ii, modulo_insns_scheduled, modulo_iter0_max_uid, recompute_todo_spec(), sd_iterator_cond(), sd_iterator_start(), sd_lists_empty_p(), sd_unresolve_dep(), and vNULL.
Referenced by schedule_block().
|
static |
This function should be called after modifying the pattern of INSN, to update scheduler data structures as needed.
References sd_iterator_cond(), sd_iterator_next(), and sd_iterator_start().
Referenced by apply_replacement(), haifa_change_pattern(), and restore_pattern().
|
static |
Update the current register pressure after scheduling INSN. Update also max register pressure for unscheduled insns of the current BB.
References curr_reg_pressure, setup_insn_max_reg_pressure(), and update_register_pressure().
Referenced by schedule_insn().
|
static |
Update register pressure after scheduling INSN.
References curr_reg_pressure, dying_use_p(), mark_regno_birth_or_death(), reg_use_data::next_insn_use, and reg_use_data::regno.
Referenced by model_choose_insn(), schedule_insn(), setup_insn_max_reg_pressure(), and update_reg_and_insn_max_reg_pressure().
|
staticread |
Called when we detect that the schedule is impossible. We examine the backtrack queue to find the earliest insn that caused this condition.
References clock_var, haifa_saved_data::delay_pair, i1, delay_pair::i1, i2, delay_pair::i2, haifa_saved_data::next, delay_pair::next_same_i1, pair_delay(), sched_dump, and sched_verbose.
Referenced by schedule_block().
void* xrecalloc | ( | ) |
Extends and fills with zeros (only the new part) array pointed to by P.
References memset().
Referenced by fill_vec_av_set(), maybe_extend_reg_info_p(), and sched_extend_ready_list().
bool adding_bb_to_current_region_p = true |
FALSE if we add bb to another region, so we don't need to initialize it.
Referenced by haifa_init_insn(), and init_before_recovery().
basic_block after_recovery |
Basic block just before the EXIT_BLOCK and after recovery, if we have created it.
Referenced by sel_global_init().
|
static |
A record, in reverse order, of all scheduled insns which have delay slots and may require backtracking.
Referenced by free_topmost_backtrack_point(), restore_last_backtrack_point(), and save_backtrack_point().
|
static |
Array used in {unlink, restore}_bb_notes.
Referenced by restore_bb_notes(), and unlink_bb_notes().
|
static |
Basic block after which recovery blocks will be created.
Referenced by init_before_recovery().
|
static |
The following value is value of hook `first_cycle_multipass_dfa_lookahead' at the last call of `max_issue'.
Referenced by max_issue(), and sched_init().
|
static |
The following value is value of `issue_rate' at the last call of `sched_init'.
Referenced by sched_init().
|
static |
The following array is used to implement a stack of choices used in function max_issue.
Referenced by max_issue().
|
static |
Scheduling clock.
Referenced by debug_ready_list(), estimate_shadow_tick(), fix_inter_tick(), fix_tick_ready(), insn_delay(), prune_ready_list(), queue_insn(), queue_to_ready(), rank_for_schedule(), ready_add(), restore_last_backtrack_point(), save_backtrack_point(), schedule_block(), schedule_insn(), and verify_shadows().
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().
|
static |
Register living at given scheduling point.
|
static |
The current register pressure. Only elements corresponding pressure classes are defined.
Referenced by initiate_bb_reg_pressure_info(), initiate_reg_pressure_info(), model_dump_pressure_points(), model_excess_group_cost(), model_init_pressure_group(), model_record_final_pressures(), model_record_pressures(), print_curr_reg_pressure(), restore_reg_pressure(), save_reg_pressure(), setup_insn_max_reg_pressure(), setup_insn_reg_pressure_info(), update_reg_and_insn_max_reg_pressure(), and update_register_pressure().
state_t curr_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().
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().
|
static |
Two hash tables to record delay_pairs, one indexed by I1 and the other indexed by I2.
|
static |
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().
vec<haifa_insn_data_def> h_i_d = vNULL |
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().
|
static |
True, if recovery block was added during scheduling of current block. Used to determine, if we need to fix INSN_TICKs.
Referenced by sched_create_recovery_block(), and schedule_block().
|
static |
Queues, etc.
An instruction is ready to be scheduled when all insns preceding it have already been scheduled. It is important to ensure that all insns which use its result will not be executed until its result has been computed. An insn is maintained in one of four structures: (P) the "Pending" set of insns which cannot be scheduled until their dependencies have been satisfied. (Q) the "Queued" set of insns that can be scheduled when sufficient time has passed. (R) the "Ready" list of unscheduled, uncommitted insns. (S) the "Scheduled" list of insns. Initially, all insns are either "Pending" or "Ready" depending on whether their dependencies are satisfied. Insns move from the "Ready" list to the "Scheduled" list as they are committed to the schedule. As this occurs, the insns in the "Pending" list have their dependencies satisfied and move to either the "Ready" list or the "Queued" set depending on whether sufficient time has passed to make them ready. As time passes, insns move from the "Queued" set to the "Ready" list. The "Pending" list (P) are the insns in the INSN_FORW_DEPS of the unscheduled insns, i.e., those that are ready, queued, and pending. The "Queued" set (Q) is implemented by the variable `insn_queue'. The "Ready" list (R) is implemented by the variables `ready' and `n_ready'. The "Scheduled" list (S) is the new insn chain built by this pass. The transition (R->S) is implemented in the scheduling loop in `schedule_block' when the best insn to schedule is chosen. The transitions (P->R and P->Q) are implemented in `schedule_insn' as insns move from the ready list to the scheduled list. The transition (Q->R) is implemented in 'queue_to_insn' as time passes or stalls are introduced.
Implement a circular buffer to delay instructions until sufficient time has passed. For the new pipeline description interface, MAX_INSN_QUEUE_INDEX is a power of two minus one which is not less than maximal time of instruction execution computed by genattr.c on the base maximal time of functional unit reservations and getting a result. This is the longest time an insn may be queued.
Referenced by check_clobbered_conditions(), early_queue_to_ready(), queue_insn(), queue_remove(), queue_to_ready(), restore_last_backtrack_point(), save_backtrack_point(), schedule_block(), and toggle_cancelled_flags().
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.
|
static |
Clock at which the previous instruction was issued.
Referenced by restore_last_backtrack_point(), save_backtrack_point(), schedule_block(), and schedule_insn().
|
static |
Pointer to the last nondebug instruction scheduled within the block, or the prev_head of the scheduling block. Used by rank_for_schedule, so that insns independent of the last scheduled insn will be preferred over dependent instructions.
Referenced by rank_for_schedule(), restore_last_backtrack_point(), save_backtrack_point(), and schedule_block().
|
static |
Pointer to the last instruction scheduled.
Referenced by commit_schedule(), restore_last_backtrack_point(), save_backtrack_point(), sched_emit_insn(), and schedule_block().
|
static |
The following variable value is maximal number of tries of issuing insns for the first cycle multipass insn scheduling. We define this value as constant*(DFA_LOOKAHEAD**ISSUE_RATE). We would not need this constraint if all real insns (with non-negative codes) had reservations because in this case the algorithm complexity is O(DFA_LOOKAHEAD**ISSUE_RATE). Unfortunately, the dfa descriptions might be incomplete and such insn might occur. For such descriptions, the complexity of algorithm (without the constraint) could achieve DFA_LOOKAHEAD ** N , where N is the queue length.
Referenced by max_issue().
|
static |
Describes the pressure before each instruction in the model schedule.
Referenced by model_dump_pressure_summary(), model_end_schedule(), model_excess_cost(), model_recompute(), model_record_pressures(), model_set_excess_costs(), model_start_schedule(), and model_update_limit_points().
|
static |
The index of the first instruction in model_schedule that hasn't yet been added to the main schedule, or model_num_insns if all of them have.
Referenced by model_recompute(), model_start_schedule(), model_update_limit_points_in_group(), queue_to_ready(), ready_sort(), and schedule_insn().
|
static |
Index I describes the instruction with INSN_LUID I.
|
static |
The first unused model_priority value (as used in model_insn_info).
Referenced by model_promote_predecessors(), and model_start_schedule().
|
static |
The number of instructions in the model schedule.
Referenced by model_analyze_insns(), model_dump_pressure_points(), model_index(), model_init_pressure_group(), model_last_use_except(), model_record_final_pressures(), model_start_schedule(), model_start_update_pressure(), model_update_limit_points_in_group(), queue_to_ready(), ready_sort(), and schedule_insn().
Index POINT gives the instruction at point POINT of the model schedule. This array doesn't change during main scheduling.
|
static |
The list of instructions in the model worklist, sorted in order of decreasing priority.
Referenced by model_add_to_worklist_at(), and model_choose_insn().
|
static |
The number of times we should attempt to backtrack when modulo scheduling. Decreased each time we have to backtrack.
Referenced by schedule_block(), and set_modulo_params().
|
static |
The current initiation interval used when modulo scheduling.
Referenced by haifa_sched_init(), pair_delay(), schedule_block(), set_modulo_params(), and unschedule_insns_until().
|
static |
The current count of insns in the first iteration of the loop that have already been scheduled.
Referenced by schedule_block(), and unschedule_insns_until().
|
static |
The maximum uid of insns from the first iteration of the loop.
Referenced by schedule_block(), set_modulo_params(), and unschedule_insns_until().
|
static |
The stage in which the last insn from the original loop was scheduled.
Referenced by schedule_block().
|
static |
The maximum number of stages we are prepared to handle.
Referenced by schedule_block(), and set_modulo_params().
|
static |
The number of insns that exist in each iteration of the loop. We use this to detect when we've scheduled all insns from the first iteration.
Referenced by schedule_block(), and set_modulo_params().
|
static |
Set to true if, when queuing a shadow insn, we discover that it would be scheduled too late.
Referenced by queue_insn(), ready_add(), and schedule_block().
|
static |
Two VECs, one to hold dependencies for which pattern replacements need to be applied or restored at the start of the next cycle, and another to hold an integer that is either one, to apply the corresponding replacement, or zero to restore it.
|
static |
Pointer that iterates through the list of unscheduled insns if we have a dbg_cnt enabled. It always points at an insn prior to the first unscheduled one.
Referenced by choose_ready(), queue_to_ready(), sched_emit_insn(), and schedule_block().
rtx note_list |
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().
|
static |
Referenced by add_to_speculative_block(), haifa_sched_finish(), and haifa_sched_init().
|
static |
Referenced by add_to_speculative_block(), haifa_sched_finish(), and haifa_sched_init().
|
static |
Referenced by begin_speculative_block(), haifa_sched_finish(), and haifa_sched_init().
|
static |
Counters of different types of speculative instructions.
Referenced by begin_speculative_block(), haifa_sched_finish(), and haifa_sched_init().
|
static |
|
static |
struct ready_list ready = {NULL, 0, 0, 0, 0} |
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 = NULL |
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().
|
static |
The pointer to the ready list (to be removed).
|
static |
Registers mentioned in the current region.
|
static |
Saved value of the previous array.
|
static |
Saved value of the previous array.
Referenced by restore_reg_pressure(), and save_reg_pressure().
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().
FILE* sched_dump = 0 |
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().
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().
Mapping from instruction UID to its Logical UID.
Referenced by sel_dump_cfg_insn().
int sched_max_luid = 1 |
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().
|
static |
Referenced by create_check_block_twin(), sched_extend_ready_list(), and sched_finish_ready_list().
enum reg_class* sched_regno_pressure_class |
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 = 0 |
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().
This records the actual schedule. It is built up during the main phase of schedule_block, and afterwards used to reorder the insns in the RTL.
Referenced by fill_insns(), and sel_sched_region_2().
spec_info_t spec_info = NULL |
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().
|
static |
Referenced by sched_init().