GCC Middle and Back End API Reference
sched-deps.c File Reference
#include "tm_p.h"
#include "hard-reg-set.h"
#include "regs.h"
#include "function.h"
Include dependency graph for sched-deps.c:

Data Structures

struct  mem_inc_info

Functions

enum reg_note ds_to_dk ()
ds_t dk_to_ds ()
void init_dep_1 ()
void init_dep ()
static void copy_dep ()
static void dump_ds (FILE *, ds_t)
static void dump_dep ()
void sd_debug_dep ()
static bool depl_on_debug_p ()
static void attach_dep_link ()
static void add_to_deps_list ()
static void detach_dep_link ()
static void remove_from_deps_list ()
static void move_dep_link ()
static bool dep_link_is_detached_p ()
static dep_node_t create_dep_node ()
static void delete_dep_node ()
static bool deps_list_empty_p ()
static deps_list_t create_deps_list ()
static void free_deps_list ()
bool deps_pools_are_empty_p ()
static void clear_deps_list ()
static bool dep_spec_p ()
static int deps_may_trap_p (const_rtx)
static void add_dependence_1 (rtx, rtx, enum reg_note)
static void add_dependence_list (rtx, rtx, int, enum reg_note, bool)
static void add_dependence_list_and_free (struct deps_desc *, rtx, rtx *, int, enum reg_note, bool)
static void delete_all_dependences (rtx)
static void chain_to_prev_insn (rtx)
static void flush_pending_lists (struct deps_desc *, rtx, int, int)
static void sched_analyze_1 (struct deps_desc *, rtx, rtx)
static void sched_analyze_2 (struct deps_desc *, rtx, rtx)
static void sched_analyze_insn (struct deps_desc *, rtx, rtx)
static bool sched_has_condition_p (const_rtx)
static int conditions_mutex_p (const_rtx, const_rtx, bool, bool)
static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 (dep_t, bool, rtx, rtx)
static enum DEPS_ADJUST_RESULT add_or_update_dep_1 (dep_t, bool, rtx, rtx)
static void check_dep (dep_t, bool)
static int deps_may_trap_p ()
static rtx sched_get_condition_with_rev_uncached ()
rtx sched_get_reverse_condition_uncached ()
static rtx sched_get_condition_with_rev ()
static bool sched_has_condition_p ()
static int conditions_mutex_p ()
bool sched_insns_conditions_mutex_p ()
bool sched_insn_is_legitimate_for_speculation_p ()
void sd_next_list (const_rtx insn, sd_list_types_def *types_ptr, deps_list_t *list_ptr, bool *resolved_p_ptr)
int sd_lists_size ()
bool sd_lists_empty_p ()
void sd_init_insn ()
void sd_finish_insn ()
static dep_t sd_find_dep_between_no_cache (rtx pro, rtx con, bool resolved_p, sd_iterator_def *sd_it_ptr)
dep_t sd_find_dep_between ()
static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 ()
static enum DEPS_ADJUST_RESULT ask_dependency_caches ()
static void set_dependency_caches ()
static void update_dependency_caches ()
static void change_spec_dep_to_hard ()
static enum DEPS_ADJUST_RESULT update_dep (dep_t dep, dep_t new_dep, sd_iterator_def sd_it, rtx mem1, rtx mem2)
static void get_back_and_forw_lists (dep_t dep, bool resolved_p, deps_list_t *back_list_ptr, deps_list_t *forw_list_ptr)
void sd_add_dep ()
enum DEPS_ADJUST_RESULT sd_add_or_update_dep ()
void sd_resolve_dep ()
void sd_unresolve_dep ()
void sd_copy_back_deps ()
void sd_delete_dep ()
static void dump_lists ()
void sd_debug_lists ()
void add_dependence ()
static int remove_from_dependence_list ()
static int remove_from_both_dependence_lists ()
static void delete_all_dependences ()
static void chain_to_prev_insn ()
static void add_insn_mem_dependence (struct deps_desc *deps, bool read_p, rtx insn, rtx mem)
static void haifa_start_insn ()
static void haifa_finish_insn ()
void haifa_note_reg_set ()
void haifa_note_reg_clobber ()
void haifa_note_reg_use ()
static void haifa_note_mem_dep ()
static void haifa_note_dep ()
static void note_reg_use ()
static void note_reg_set ()
static void note_reg_clobber ()
static void note_mem_dep ()
static void note_dep ()
enum reg_note ds_to_dt ()
static struct reg_use_datacreate_insn_reg_use ()
static struct reg_set_datacreate_insn_reg_set ()
static void setup_insn_reg_uses ()
static bool insn_use_p ()
static void mark_insn_pseudo_birth ()
static void mark_insn_hard_regno_birth (rtx insn, int regno, int nregs, bool clobber_p, bool unused_p)
static void mark_insn_reg_birth ()
static void mark_pseudo_death ()
static void mark_hard_regno_death ()
static void mark_reg_death ()
static void mark_insn_reg_store ()
static void mark_insn_reg_clobber ()
void init_insn_reg_pressure_info ()
static void extend_deps_reg_info ()
void maybe_extend_reg_info_p ()
static void sched_analyze_reg (struct deps_desc *deps, int regno, enum machine_mode mode, enum rtx_code ref, rtx insn)
static void sched_analyze_1 ()
static void sched_analyze_2 ()
static void sched_analyze_insn ()
static bool call_may_noreturn_p ()
static bool chain_to_prev_insn_p ()
void deps_analyze_insn ()
void deps_start_bb ()
void sched_analyze ()
static void delete_dep_nodes_in_back_deps ()
void sched_free_deps ()
void init_deps ()
void init_deps_reg_last ()
void free_deps ()
void remove_from_deps ()
static void init_deps_data_vector ()
void sched_deps_init ()
void extend_dependency_caches ()
void sched_deps_finish ()
void init_deps_global ()
void finish_deps_global ()
dw_t estimate_dep_weak ()
static void add_dependence_1 ()
static dw_t get_dep_weak_1 ()
dw_t get_dep_weak ()
ds_t set_dep_weak ()
static ds_t ds_merge_1 ()
ds_t ds_merge ()
ds_t ds_full_merge ()
ds_t ds_max_merge ()
dw_t ds_weak ()
ds_t ds_get_speculation_types ()
ds_t ds_get_max_dep_weak ()
static void dump_ds ()
DEBUG_FUNCTION void debug_ds ()
static void check_dep ()
static rtx attempt_change ()
static bool parse_add_or_inc ()
static bool find_inc ()
static bool find_mem ()
void find_modifiable_mems ()

Variables

struct sched_deps_info_defsched_deps_info
vec< haifa_deps_insn_data_defh_d_i_d = vNULL
static int dump_dep_flags = (DUMP_DEP_PRO | DUMP_DEP_CON)
static alloc_pool dn_pool
static int dn_pool_diff = 0
static alloc_pool dl_pool
static int dl_pool_diff = 0
static regset reg_pending_sets
static regset reg_pending_clobbers
static regset reg_pending_uses
static regset reg_pending_control_uses
static enum
reg_pending_barrier_mode 
reg_pending_barrier
static HARD_REG_SET implicit_reg_pending_clobbers
static HARD_REG_SET implicit_reg_pending_uses
static bitmap_headtrue_dependency_cache = NULL
static bitmap_headoutput_dependency_cache = NULL
static bitmap_headanti_dependency_cache = NULL
static bitmap_headcontrol_dependency_cache = NULL
static bitmap_headspec_dependency_cache = NULL
static int cache_size
static bool mark_as_hard
static rtx cur_insn = NULL_RTX
static struct reg_pressure_data reg_pressure_info [N_REG_CLASSES]
static bool can_start_lhs_rhs_p

Function Documentation

void add_dependence ( )
A wrapper around add_dependence_1, to add a dependence of CON on
   PRO, with type DEP_TYPE.  This function implements special handling
   for REG_DEP_CONTROL dependencies.  For these, we optionally promote
   the type to REG_DEP_ANTI if we can determine that predication is
   impossible; otherwise we add additional true dependencies on the
   INSN_COND_DEPS list of the jump (which PRO must be).   

References add_dependence_1(), add_dependence_list(), const_true_rtx, current_sched_info, DO_PREDICATION, haifa_sched_info::flags, note_uses(), real_insn_for_shadow(), record_hard_reg_uses(), sched_dump, sched_get_reverse_condition_uncached(), and sched_verbose.

Referenced by add_branch_dependences(), add_delay_dependencies(), add_dependence_list(), add_deps_for_risky_insns(), chain_to_prev_insn(), process_replaceable(), sched_analyze_2(), and sched_analyze_insn().

static void add_dependence_1 ( rtx  ,
rtx  ,
enum  reg_note 
)
static

Referenced by add_dependence(), and find_inc().

static void add_dependence_1 ( )
static
Add or update backward dependence between INSN and ELEM with type DEP_TYPE.
   This function can handle same INSN and ELEM (INSN == ELEM).
   It is a convenience wrapper.   

References cur_insn, and note_dep().

static void add_dependence_list ( rtx  insn,
rtx  list,
int  uncond,
enum reg_note  dep_type,
bool  hard 
)
static
A convenience wrapper to operate on an entire list.  HARD should be
   true if DEP_NONREG should be set on newly created dependencies.   

References add_dependence(), mark_as_hard, and sched_insns_conditions_mutex_p().

Referenced by add_dependence(), add_dependence_list_and_free(), sched_analyze_1(), sched_analyze_insn(), and sched_analyze_reg().

static void add_dependence_list_and_free ( struct deps_desc deps,
rtx  insn,
rtx listp,
int  uncond,
enum reg_note  dep_type,
bool  hard 
)
static
Similar, but free *LISTP at the same time, when the context
   is not readonly.  HARD should be true if DEP_NONREG should be set on
   newly created dependencies.   

References add_dependence_list(), free_INSN_LIST_list(), and deps_desc::readonly.

Referenced by deps_analyze_insn(), flush_pending_lists(), and sched_analyze_insn().

static void add_insn_mem_dependence ( struct deps_desc deps,
bool  read_p,
rtx  insn,
rtx  mem 
)
static
Process an insn's memory dependencies.  There are four kinds of
   dependencies:

   (0) read dependence: read follows read
   (1) true dependence: read follows write
   (2) output dependence: write follows write
   (3) anti dependence: write follows read

   We are careful to build only dependencies which actually exist, and
   use transitivity to avoid building too many links.   
Add an INSN and MEM reference pair to a pending INSN_LIST and MEM_LIST.
   The MEM is a memory reference contained within INSN, which we are saving
   so that we can do memory aliasing on it.   

References alloc_EXPR_LIST(), alloc_INSN_LIST(), canon_rtx(), cselib_subst_to_values_from_insn(), deps_desc::pending_read_insns, deps_desc::pending_read_list_length, deps_desc::pending_read_mems, deps_desc::pending_write_insns, deps_desc::pending_write_list_length, deps_desc::pending_write_mems, deps_desc::readonly, and sched_deps_info_def::use_cselib.

Referenced by sched_analyze_1(), and sched_analyze_2().

static enum DEPS_ADJUST_RESULT add_or_update_dep_1 ( dep_t  new_dep,
bool  resolved_p,
rtx  mem1,
rtx  mem2 
)
static
Add or update  a dependence described by DEP.
   MEM1 and MEM2, if non-null, correspond to memory locations in case of
   data speculation.

   The function returns a value indicating if an old entry has been changed
   or a new entry has been added to insn's backward deps or nothing has
   been updated at all.   

References ask_dependency_caches(), check_dep(), DEP_CHANGED, DEP_CREATED, DEP_PRESENT, estimate_dep_weak(), sched_deps_info_def::generate_spec_deps, sd_add_dep(), sd_find_dep_between_no_cache(), set_dep_weak(), and update_dep().

Referenced by maybe_add_or_update_dep_1(), and sd_add_or_update_dep().

static void add_to_deps_list ( )
static
Add dep_link LINK to deps_list L.   

References attach_dep_link(), and depl_on_debug_p().

Referenced by move_dep_link(), and sd_add_dep().

static enum DEPS_ADJUST_RESULT ask_dependency_caches ( )
static
Ask dependency caches what needs to be done for dependence DEP.
   Return DEP_CREATED if new dependence should be created and there is no
   need to try to find one searching the dependencies lists.
   Return DEP_PRESENT if there already is a dependence described by DEP and
   hence nothing is to be done.
   Return DEP_CHANGED if there already is a dependence, but it should be
   updated to incorporate additional information from DEP.   

References bitmap_bit_p(), current_sched_info, DEP_CHANGED, DEP_CREATED, DEP_PRESENT, DO_SPECULATION, haifa_sched_info::flags, insn_luid(), and USE_DEPS_LIST.

Referenced by add_or_update_dep_1().

static void attach_dep_link ( )
static
Functions to operate with a single link from the dependencies lists -
   dep_link_t.   
Attach L to appear after link X whose &DEP_LINK_NEXT (X) is given by
   PREV_NEXT_P.   

Referenced by add_to_deps_list().

static rtx attempt_change ( )
static
Verify that the memory location described in MII can be replaced with
   one using NEW_ADDR.  Return the new memory reference or NULL_RTX.  The
   insn remains unchanged by this function.   

References mem_inc_info::mem_insn, mem_inc_info::mem_loc, replace_equiv_address_nv(), sched_dump, sched_verbose, and validate_change().

Referenced by find_inc().

static bool call_may_noreturn_p ( )
static
Return TRUE if INSN might not always return normally (e.g. call exit,
   longjmp, loop forever, ...).   
FIXME: Why can't this function just use flags_from_decl_or_type and
   test for ECF_NORETURN?   

References BUILT_IN_NORMAL, and get_call_rtx_from().

Referenced by deps_analyze_insn().

static void chain_to_prev_insn ( rtx  )
static

Referenced by deps_analyze_insn().

static void chain_to_prev_insn ( )
static
All insns in a scheduling group except the first should only have
   dependencies on the previous insn in the group.  So we find the
   first instruction in the scheduling group by walking the dependence
   chains backwards. Then we add the dependencies for the group to
   the previous nonnote insn.   

References add_dependence(), delete_all_dependences(), prev_nonnote_insn(), prev_nonnote_nondebug_insn(), and sched_insns_conditions_mutex_p().

static bool chain_to_prev_insn_p ( )
static
Return true if INSN should be made dependent on the previous instruction
   group, and if all INSN's dependencies should be moved to the first
   instruction of that group.   

References prev_nonnote_nondebug_insn(), and set_of().

Referenced by deps_analyze_insn().

static void change_spec_dep_to_hard ( )
static
Convert a dependence pointed to by SD_IT to be non-speculative.   

References bitmap_clear_bit(), _sd_iterator::linkp, and move_dep_link().

Referenced by sched_analyze_insn(), and update_dep().

static void check_dep ( dep_t  ,
bool   
)
static

Referenced by add_or_update_dep_1(), and sd_add_dep().

static void check_dep ( )
static
Verify that dependence type and status are consistent.
   If RELAXED_P is true, then skip dep_weakness checks.   

References current_sched_info, haifa_sched_info::flags, sched_deps_info_def::generate_spec_deps, get_dep_weak(), and USE_DEPS_LIST.

static void clear_deps_list ( )
static
Remove all elements from L.   

References remove_from_deps_list().

Referenced by sched_free_deps().

static int conditions_mutex_p ( const_rtx  ,
const_rtx  ,
bool  ,
bool   
)
static
static int conditions_mutex_p ( )
static
Return nonzero if conditions COND1 and COND2 can never be both true.   

References reversed_comparison_code(), and rtx_equal_p().

static void copy_dep ( )
static
Make a copy of FROM in TO.   

References memcpy().

Referenced by sd_add_dep(), and sd_copy_back_deps().

static dep_node_t create_dep_node ( )
static
Create a dep_node.   

References dn_pool_diff, and pool_alloc().

Referenced by sd_add_dep().

static deps_list_t create_deps_list ( )
static
Create a new deps_list.   

References dl_pool_diff, and pool_alloc().

Referenced by sd_init_insn().

static struct reg_set_data* create_insn_reg_set ( )
staticread
Allocate and return reg_set_data structure for REGNO and INSN.   

References reg_set_data::insn, and reg_set_data::regno.

Referenced by mark_insn_hard_regno_birth(), and mark_insn_pseudo_birth().

static struct reg_use_data* create_insn_reg_use ( )
staticread
Functions for computation of info needed for register pressure
   sensitive insn scheduling.   
Allocate and return reg_use_data structure for REGNO and INSN.   

References reg_use_data::insn, reg_use_data::next_insn_use, and reg_use_data::regno.

Referenced by setup_insn_reg_uses().

DEBUG_FUNCTION void debug_ds ( )

References dump_ds().

static void delete_all_dependences ( rtx  )
static

Referenced by chain_to_prev_insn().

static void delete_all_dependences ( )
static
Clear all dependencies for an insn.   

References sd_delete_dep(), sd_iterator_cond(), and sd_iterator_start().

static void delete_dep_node ( )
static
Delete dep_node N.  N must not be connected to any deps_list.   

References dep_link_is_detached_p(), dn_pool_diff, and pool_free().

Referenced by delete_dep_nodes_in_back_deps(), and sd_delete_dep().

static void delete_dep_nodes_in_back_deps ( )
static
Helper for sched_free_deps ().
   Delete INSN's (RESOLVED_P) backward dependencies.   

References delete_dep_node(), get_back_and_forw_lists(), _sd_iterator::linkp, remove_from_deps_list(), sd_iterator_cond(), and sd_iterator_start().

Referenced by sched_free_deps().

static bool dep_link_is_detached_p ( )
static
Return true of LINK is not attached to any list.   

Referenced by delete_dep_node().

static bool dep_spec_p ( )
static
Decide whether a dependency should be treated as a hard or a speculative
   dependency.   

References current_sched_info, DO_PREDICATION, DO_SPECULATION, and haifa_sched_info::flags.

Referenced by get_back_and_forw_lists(), sd_resolve_dep(), sd_unresolve_dep(), and update_dep().

static bool depl_on_debug_p ( )
inlinestatic
Determine whether DEP is a dependency link of a non-debug insn on a
   debug insn.   

Referenced by add_to_deps_list(), and remove_from_deps_list().

static bool deps_list_empty_p ( )
static
Functions to operate with dependences lists - deps_list_t.   
Return true if list L is empty.   

Referenced by free_deps_list(), and sd_lists_empty_p().

static int deps_may_trap_p ( const_rtx  )
static

Referenced by sched_analyze_2().

static int deps_may_trap_p ( )
static
Return nonzero if a load of the memory reference MEM can cause a trap.   

References get_reg_known_value(), and rtx_addr_can_trap_p().

bool deps_pools_are_empty_p ( void  )
Return true if there is no dep_nodes and deps_lists out there.
   After the region is scheduled all the dependency nodes and lists
   should [generally] be returned to pool.   

References dl_pool_diff, and dn_pool_diff.

Referenced by sched_deps_finish(), schedule_ebb(), and schedule_region().

void deps_start_bb ( )
Initialize DEPS for the new block beginning with HEAD.   

References deps_desc::in_post_call_group_p, post_call_initial, prev_nonnote_nondebug_insn(), deps_desc::readonly, and reload_completed.

Referenced by sched_analyze().

static void detach_dep_link ( )
static
Detach dep_link L from the list.   

Referenced by remove_from_deps_list().

ds_t dk_to_ds ( )
Return equivalent dep_status.   

Referenced by init_dep().

ds_t ds_full_merge ( )
Return the join of two dep_statuses DS1 and DS2.   

References ds_merge(), estimate_dep_weak(), and set_dep_weak().

ds_t ds_get_max_dep_weak ( )
Return a dep status that contains maximal weakness for each speculation
   type present in DS.   

References set_dep_weak().

Referenced by create_speculation_check().

ds_t ds_get_speculation_types ( )
Return a dep status that contains all speculation types of DS.   

Referenced by get_spec_check_type_for_insn().

ds_t ds_max_merge ( )
Return the join of DS1 and DS2.  Use maximum instead of multiplying
   probabilities.   

References ds_merge_1().

ds_t ds_merge ( )
Return the join of two dep_statuses DS1 and DS2.
   This function assumes that both DS1 and DS2 contain speculative bits.   

References ds_merge_1().

Referenced by ds_full_merge(), recompute_todo_spec(), and update_dep().

static ds_t ds_merge_1 ( )
static
Return the join of two dep_statuses DS1 and DS2.
   If MAX_P is true then choose the greater probability,
   otherwise multiply probabilities.
   This function assumes that both DS1 and DS2 contain speculative bits.   

References get_dep_weak(), and set_dep_weak().

Referenced by ds_max_merge(), and ds_merge().

enum reg_note ds_to_dk ( )
Return the major type present in the DS.   
enum reg_note ds_to_dt ( )
Return corresponding to DS reg_note.   

Referenced by haifa_note_dep(), and haifa_note_mem_dep().

dw_t ds_weak ( )
Return the probability of speculation success for the speculation
   status DS.   

References get_dep_weak().

Referenced by can_speculate_dep_p(), process_insn_forw_deps_be_in_spec(), process_spec_exprs(), rank_for_schedule(), recompute_todo_spec(), and sel_rank_for_schedule().

static void dump_dep ( )
static
Dump DEP to DUMP.
   FLAGS is a bit mask specifying what information about DEP needs
   to be printed.
   If FLAGS has the very first bit set, then dump all information about DEP
   and propagate this bit into the callee dump functions.   

References current_sched_info, dump_ds(), haifa_sched_info::flags, and USE_DEPS_LIST.

Referenced by dump_lists(), and sd_debug_dep().

static void dump_ds ( FILE *  ,
ds_t   
)
static

Referenced by debug_ds(), and dump_dep().

static void dump_ds ( )
static
Dump information about the dependence status S.   

References get_dep_weak_1().

static void dump_lists ( )
static
Dump deps_lists of INSN specified by TYPES to DUMP.
   FLAGS is a bit mask specifying what information about the lists needs
   to be printed.
   If FLAGS has the very first bit set, then dump all information about
   the lists and propagate this bit into the callee dump functions.   

References dump_dep(), dump_dep_flags, and sd_lists_size().

Referenced by sd_debug_lists().

dw_t estimate_dep_weak ( )
Estimate the weakness of dependence between MEM1 and MEM2.   

Referenced by add_or_update_dep_1(), ds_full_merge(), and update_dep().

void extend_dependency_caches ( )
Create or extend (depending on CREATE_P) dependency caches to
   size N.   

References cache_size, current_sched_info, DO_SPECULATION, and haifa_sched_info::flags.

Referenced by haifa_init_insn(), and sched_deps_init().

static void extend_deps_reg_info ( )
static
Extend reg info for the deps context DEPS given that
   we have just generated a register numbered REGNO.   

References deps_desc::max_reg, max_regno, memset(), deps_desc::readonly, deps_desc::reg_last, and reload_completed.

Referenced by sched_analyze_reg().

static bool find_inc ( )
static
static bool find_mem ( )
static
A recursive function that walks ADDRESS_OF_X to find memory references
   which could be modified during scheduling.  We call find_inc for each
   one we find that has a recognizable form.  MII holds information about
   the pair of memory/increment instructions.
   We ensure that every instruction with a memory reference (which will be
   the location of the replacement) is assigned at most one breakable
   dependency.   

References find_inc(), mem_inc_info::mem_constant, mem_inc_info::mem_index, mem_inc_info::mem_insn, mem_inc_info::mem_loc, mem_inc_info::mem_reg0, reg_overlap_mentioned_p(), sched_dump, and sched_verbose.

Referenced by find_modifiable_mems().

void find_modifiable_mems ( )
Examine the instructions between HEAD and TAIL and try to find
   dependencies that can be broken by modifying one of the patterns.   

References find_mem(), dep_replacement::insn, mem_inc_info::mem_insn, sched_dump, and sched_verbose.

Referenced by schedule_block().

void finish_deps_global ( void  )
Free everything used by the dependency analysis code.   

Referenced by build_intra_loop_deps(), sched_rgn_compute_dependencies(), schedule_ebb(), and sel_region_finish().

static void flush_pending_lists ( struct deps_desc deps,
rtx  insn,
int  for_read,
int  for_write 
)
static
static void free_deps_list ( )
static
Free deps_list L.   

References deps_list_empty_p(), dl_pool_diff, and pool_free().

Referenced by sd_finish_insn().

static void get_back_and_forw_lists ( dep_t  dep,
bool  resolved_p,
deps_list_t back_list_ptr,
deps_list_t forw_list_ptr 
)
static
Initialize BACK_LIST_PTR with consumer's backward list and
   FORW_LIST_PTR with producer's forward list.  If RESOLVED_P is true
   initialize with lists that hold resolved deps.   

References dep_spec_p().

Referenced by delete_dep_nodes_in_back_deps(), sd_add_dep(), and sd_delete_dep().

dw_t get_dep_weak ( )
Return weakness of speculative type TYPE in the dep_status DS.   

References get_dep_weak_1().

Referenced by check_dep(), create_check_block_twin(), ds_merge_1(), and ds_weak().

static dw_t get_dep_weak_1 ( )
static
Return weakness of speculative type TYPE in the dep_status DS,
   without checking to prevent ICEs on malformed input.   

References BE_IN_CONTROL_BITS_OFFSET, BE_IN_DATA_BITS_OFFSET, BEGIN_CONTROL_BITS_OFFSET, BEGIN_DATA_BITS_OFFSET, and type().

Referenced by dump_ds(), and get_dep_weak().

static void haifa_finish_insn ( )
static

References cur_insn.

Referenced by init_deps_global().

static void haifa_note_dep ( )
static
static void haifa_note_mem_dep ( )
static
void haifa_note_reg_clobber ( )

Referenced by init_deps_global().

void haifa_note_reg_set ( )

Referenced by init_deps_global().

void haifa_note_reg_use ( )

Referenced by init_deps_global().

static void haifa_start_insn ( )
static
Implement hooks for haifa scheduler.   

References cur_insn.

Referenced by init_deps_global().

void init_dep ( )
Init DEP with the arguments.
   While most of the scheduler (including targets) only need the major type
   of the dependency, it is convenient to hide full dep_status from them.   

References current_sched_info, dk_to_ds(), haifa_sched_info::flags, init_dep_1(), and USE_DEPS_LIST.

Referenced by add_deps_for_risky_insns(), add_jump_dependencies(), add_to_speculative_block(), create_check_block_twin(), create_ddg_dep_no_link(), haifa_note_dep(), and priority().

void init_dep_1 ( )
Functions to operate with dependence information container - dep_t.   
Init DEP with the arguments.   

References type().

Referenced by create_check_block_twin(), haifa_note_mem_dep(), init_dep(), and process_insn_forw_deps_be_in_spec().

static void init_deps_data_vector ( )
static
Init deps data vector.   

References h_d_i_d, and sched_max_luid.

Referenced by sched_deps_init().

void init_deps_reg_last ( )
Init only reg_last field of DEPS, which was not allocated before as
   we inited DEPS lazily.   

References deps_desc::max_reg, and deps_desc::reg_last.

static bool insn_use_p ( )
static
Return TRUE if INSN has the use structure for REGNO.   

References reg_use_data::next_insn_use, and reg_use_data::regno.

Referenced by mark_insn_hard_regno_birth(), and mark_insn_pseudo_birth().

static void mark_hard_regno_death ( )
static
Like mark_pseudo_death except that NREGS saying how many hard
   registers involved in the death.   

References reg_pressure_data::change, last, reg_pressure_info, reg_use_data::regno, and sched_regno_pressure_class.

Referenced by mark_reg_death().

static void mark_insn_hard_regno_birth ( rtx  insn,
int  regno,
int  nregs,
bool  clobber_p,
bool  unused_p 
)
static
static void mark_insn_pseudo_birth ( )
static
Update the register pressure info after birth of pseudo register REGNO
   in INSN.  Arguments CLOBBER_P and UNUSED_P say correspondingly that
   the register is in clobber or unused after the insn.   

References reg_pressure_data::change, reg_pressure_data::clobber_increase, create_insn_reg_set(), insn_use_p(), reg_pressure_info, reg_use_data::regno, sched_regno_pressure_class, reg_pressure_data::set_increase, and reg_pressure_data::unused_set_increase.

Referenced by mark_insn_reg_birth().

static void mark_insn_reg_birth ( )
static
Update the register pressure info after birth of pseudo or hard
   register REG in INSN.  Arguments CLOBBER_P and UNUSED_P say
   correspondingly that the register is in clobber or unused after the
   insn.   

References mark_insn_hard_regno_birth(), mark_insn_pseudo_birth(), and reg_use_data::regno.

Referenced by mark_insn_reg_clobber(), and mark_insn_reg_store().

static void mark_insn_reg_clobber ( )
static
Like mark_insn_reg_store except notice just CLOBBERs; ignore SETs.   

References mark_insn_reg_birth().

Referenced by init_insn_reg_pressure_info().

static void mark_insn_reg_store ( )
static
Process SETTER of REG.  DATA is an insn containing the setter.   

References find_reg_note(), mark_insn_reg_birth(), and SET.

Referenced by init_insn_reg_pressure_info().

static void mark_pseudo_death ( )
static
Update the register pressure info after death of pseudo register
   REGNO.   

References reg_pressure_data::change, reg_pressure_info, reg_use_data::regno, and sched_regno_pressure_class.

Referenced by mark_reg_death().

static void mark_reg_death ( )
static
Update the register pressure info after death of pseudo or hard
   register REG.   

References mark_hard_regno_death(), mark_pseudo_death(), and reg_use_data::regno.

Referenced by init_insn_reg_pressure_info().

static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 ( dep_t  ,
bool  ,
rtx  ,
rtx   
)
static
static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 ( )
static
Add or update  a dependence described by DEP.
   MEM1 and MEM2, if non-null, correspond to memory locations in case of
   data speculation.

   The function returns a value indicating if an old entry has been changed
   or a new entry has been added to insn's backward deps.

   This function merely checks if producer and consumer is the same insn
   and doesn't create a dep in this case.  Actual manipulation of
   dependence data structures is performed in add_or_update_dep_1.   

References add_or_update_dep_1(), DEP_NODEP, and sched_deps_info_def::generate_spec_deps.

void maybe_extend_reg_info_p ( void  )
static void move_dep_link ( )
static
Move link LINK from list FROM to list TO.   

References add_to_deps_list(), and remove_from_deps_list().

Referenced by change_spec_dep_to_hard(), find_inc(), sd_resolve_dep(), and sd_unresolve_dep().

static void note_dep ( )
static
static void note_mem_dep ( )
static
static void note_reg_clobber ( )
static
static void note_reg_set ( )
static
static void note_reg_use ( )
static
static bool parse_add_or_inc ( )
static
Return true if INSN is of a form "a = b op c" where a and b are
   regs.  op is + if c is a reg and +|- if c is a const.  Fill in
   informantion in MII about what is found.
   BEFORE_MEM indicates whether the increment is found before or after
   a corresponding memory reference.   

References mem_inc_info::inc_constant, mem_inc_info::inc_input, mem_inc_info::inc_insn, mem_inc_info::mem_reg0, and rtx_equal_p().

Referenced by find_inc().

static int remove_from_both_dependence_lists ( )
static
Same as above, but process two lists at once.   

References remove_free_EXPR_LIST_node(), and remove_free_INSN_LIST_node().

Referenced by remove_from_deps().

static int remove_from_dependence_list ( )
static
Remove all occurrences of INSN from LIST.  Return the number of
   occurrences removed.   

References remove_free_INSN_LIST_node().

Referenced by remove_from_deps().

static void remove_from_deps_list ( )
static
Remove link LINK from list LIST.   

References depl_on_debug_p(), and detach_dep_link().

Referenced by clear_deps_list(), delete_dep_nodes_in_back_deps(), move_dep_link(), and sd_delete_dep().

void sched_analyze ( )
Analyze every insn between HEAD and TAIL inclusive, creating backward
   dependencies for each insn.   

References cselib_finish(), cselib_init(), CSELIB_RECORD_MEMORY, deps_analyze_insn(), deps_start_bb(), sd_init_insn(), and sched_deps_info_def::use_cselib.

Referenced by build_intra_loop_deps(), compute_block_dependences(), and schedule_ebb().

static void sched_analyze_1 ( struct deps_desc ,
rtx  ,
rtx   
)
static
static void sched_analyze_2 ( struct deps_desc ,
rtx  ,
rtx   
)
static
static void sched_analyze_insn ( struct deps_desc ,
rtx  ,
rtx   
)
static

Referenced by deps_analyze_insn().

static void sched_analyze_insn ( )
static
Analyze an INSN with pattern X to find all dependencies.   

References add_dependence(), add_dependence_list(), add_dependence_list_and_free(), alloc_INSN_LIST(), bitmap_ior(), can_start_lhs_rhs_p, can_throw_internal(), change_spec_dep_to_hard(), deps_reg::clobbers, deps_reg::clobbers_length, sched_deps_info_def::compute_jump_reg_dependencies, const_true_rtx, control_flow_insn_p(), deps_reg::control_uses, current_sched_info, DO_SPECULATION, extract_insn(), find_reg_note(), haifa_sched_info::flags, flush_pending_lists(), implicit_reg_pending_clobbers, implicit_reg_pending_uses, deps_reg::implicit_sets, deps_desc::in_post_call_group_p, init_insn_reg_pressure_info(), ira_implicitly_set_insn_hard_regs(), deps_desc::last_debug_insn, deps_desc::last_function_call, deps_desc::last_function_call_may_noreturn, deps_desc::last_pending_memory_flush, deps_desc::last_reg_pending_barrier, deps_desc::max_reg, may_trap_p(), MOVE_BARRIER, next_nonnote_nondebug_insn(), NOT_A_BARRIER, not_post_call, deps_desc::pending_jump_insns, deps_desc::pending_read_insns, deps_desc::pending_read_mems, deps_desc::pending_write_insns, deps_desc::pending_write_mems, post_call, post_call_initial, preprocess_constraints(), deps_desc::readonly, refers_to_regno_p(), deps_desc::reg_last, deps_desc::reg_last_in_use, reg_pending_barrier, reload_completed, sched_analyze_1(), sched_analyze_2(), deps_desc::sched_before_next_jump, sched_emulate_haifa_p, sched_has_condition_p(), sched_insn_is_legitimate_for_speculation_p(), sched_insns_conditions_mutex_p(), sched_pressure, SCHED_PRESSURE_NONE, sd_iterator_cond(), sd_iterator_start(), sel_insn_is_speculation_check(), sel_mark_hard_insn(), sel_sched_p(), SET, deps_reg::sets, setup_insn_reg_uses(), targetm, TRUE_BARRIER, deps_reg::uses, and deps_reg::uses_length.

static void sched_analyze_reg ( struct deps_desc deps,
int  regno,
enum machine_mode  mode,
enum rtx_code  ref,
rtx  insn 
)
static
Analyze a single reference to register (reg:MODE REGNO) in INSN.
   The type of the reference is specified by REF and can be SET,
   CLOBBER, PRE_DEC, POST_DEC, PRE_INC, POST_INC or USE.   

References add_dependence_list(), alloc_INSN_LIST(), extend_deps_reg_info(), get_reg_known_equiv_p(), get_reg_known_value(), deps_desc::last_function_call, deps_desc::max_reg, max_reg_num(), maybe_extend_reg_info_p(), note_reg_clobber(), note_reg_set(), note_reg_use(), deps_desc::readonly, reload_completed, sched_analyze_2(), deps_desc::sched_before_next_call, sel_sched_p(), and SET.

Referenced by sched_analyze_1(), and sched_analyze_2().

void sched_deps_finish ( void  )
void sched_deps_init ( )
If it is profitable to use them, initialize or extend (depending on
   GLOBAL_P) dependency data.   

References cache_size, create_alloc_pool(), extend_dependency_caches(), init_deps_data_vector(), sched_max_luid, and sel_sched_p().

Referenced by haifa_init_insn(), haifa_sched_init(), sel_global_init(), and sel_region_init().

void sched_free_deps ( )
Delete (RESOLVED_P) dependencies between HEAD and TAIL together with
   deps_lists.   

References clear_deps_list(), delete_dep_nodes_in_back_deps(), and sd_finish_insn().

Referenced by build_intra_loop_deps(), free_block_dependencies(), free_rgn_deps(), and schedule_ebb().

static rtx sched_get_condition_with_rev ( )
static
Caching variant of sched_get_condition_with_rev_uncached.
   We only do actual work the first time we come here for an insn; the
   results are cached in INSN_CACHED_COND and INSN_REVERSE_COND.   

References const_true_rtx, and sched_get_condition_with_rev_uncached().

Referenced by deps_analyze_insn(), sched_has_condition_p(), and sched_insns_conditions_mutex_p().

static rtx sched_get_condition_with_rev_uncached ( )
static
Find the condition under which INSN is executed.  If REV is not NULL,
   it is set to TRUE when the returned comparison should be reversed
   to get the actual condition.   

References any_condjump_p(), onlyjump_p(), pc_rtx, pc_set(), and reversed_comparison_code().

Referenced by sched_get_condition_with_rev(), and sched_get_reverse_condition_uncached().

rtx sched_get_reverse_condition_uncached ( )
Return the condition under which INSN does not execute (i.e.  the
   not-taken condition for a conditional branch), or NULL if we cannot
   find such a condition.  The caller should make a copy of the condition
   before using it.   

References reversed_comparison_code(), and sched_get_condition_with_rev_uncached().

Referenced by add_dependence(), and recompute_todo_spec().

static bool sched_has_condition_p ( const_rtx  )
static
static bool sched_has_condition_p ( )
static
True when we can find a condition under which INSN is executed.   

References sched_get_condition_with_rev().

bool sched_insn_is_legitimate_for_speculation_p ( )
Return true if INSN can potentially be speculated with type DS.   

References may_trap_or_fault_p(), sched_has_condition_p(), and side_effects_p().

Referenced by new_ready(), process_insn_forw_deps_be_in_spec(), sched_analyze_insn(), sched_speculate_insn(), and sd_add_dep().

bool sched_insns_conditions_mutex_p ( )
Return true if insn1 and insn2 can never depend on one another because
   the conditions under which they are executed are mutually exclusive.   

References conditions_mutex_p(), modified_in_p(), and sched_get_condition_with_rev().

Referenced by add_branch_dependences(), add_dependence_list(), add_deps_for_risky_insns(), chain_to_prev_insn(), fur_orig_expr_not_found(), move_cond_jump(), moveup_expr(), sched_analyze_1(), sched_analyze_2(), sched_analyze_insn(), and undo_transformations().

enum DEPS_ADJUST_RESULT sd_add_or_update_dep ( )
Add or update backward dependence between INSN and ELEM
   with given type DEP_TYPE and dep_status DS.
   This function is a convenience wrapper.   

References add_or_update_dep_1().

Referenced by add_deps_for_risky_insns().

void sd_copy_back_deps ( )
Make TO depend on all the FROM's producers.
   If RESOLVED_P is true add dependencies to the resolved lists.   

References copy_dep(), and sd_add_dep().

Referenced by add_to_speculative_block(), and create_check_block_twin().

void sd_debug_dep ( )
Dump all fields of DEP to STDERR.   

References dump_dep().

void sd_debug_lists ( )
Dump all information about deps_lists of INSN specified by TYPES
   to STDERR.   

References dump_lists().

dep_t sd_find_dep_between ( )
Find a dependency between producer PRO and consumer CON.
   Use dependency [if available] to check if dependency is present at all.
   Search through resolved dependency lists if RESOLVED_P is true.
   If the dependency or NULL if none found.   

References bitmap_bit_p(), insn_luid(), and sd_find_dep_between_no_cache().

Referenced by add_branch_dependences(), ok_for_early_queue_removal(), and rank_for_schedule().

static dep_t sd_find_dep_between_no_cache ( rtx  pro,
rtx  con,
bool  resolved_p,
sd_iterator_def sd_it_ptr 
)
static
Find a dependency between producer PRO and consumer CON.
   Search through resolved dependency lists if RESOLVED_P is true.
   If no such dependency is found return NULL,
   otherwise return the dependency and initialize SD_IT_PTR [if it is nonnull]
   with an iterator pointing to it.   

References sd_lists_size().

Referenced by add_or_update_dep_1(), and sd_find_dep_between().

void sd_finish_insn ( )
Free data for INSN.   

References free_deps_list().

Referenced by sched_free_deps(), and sched_remove_insn().

void sd_init_insn ( )
Initialize data for INSN.   

References create_deps_list().

Referenced by haifa_init_insn(), and sched_analyze().

bool sd_lists_empty_p ( )
int sd_lists_size ( )
Return the summary size of INSN's lists defined by LIST_TYPES.   

References sd_next_list().

Referenced by debug_dependencies(), dep_list_size(), dump_lists(), and sd_find_dep_between_no_cache().

void sd_next_list ( const_rtx  insn,
sd_list_types_def types_ptr,
deps_list_t list_ptr,
bool *  resolved_p_ptr 
)
Initialize LIST_PTR to point to one of the lists present in TYPES_PTR,
   initialize RESOLVED_P_PTR with true if that list consists of resolved deps,
   and remove the type of returned [through LIST_PTR] list from TYPES_PTR.
   This function is used to switch sd_iterator to the next list.
   !!! For internal use only.  Might consider moving it to sched-int.h.   

Referenced by sd_iterator_cond(), sd_lists_empty_p(), and sd_lists_size().

void sd_resolve_dep ( )
Resolved dependence pointed to by SD_IT.
   SD_IT will advance to the next element.   

References dep_spec_p(), _sd_iterator::linkp, and move_dep_link().

Referenced by resolve_dependencies(), and schedule_insn().

void sd_unresolve_dep ( )
Perform the inverse operation of sd_resolve_dep.  Restore the dependence
   pointed to by SD_IT to unresolved state.   

References dep_spec_p(), _sd_iterator::linkp, and move_dep_link().

Referenced by unschedule_insns_until().

ds_t set_dep_weak ( )
Return the dep_status, which has the same parameters as DS, except for
   speculative type TYPE, that will have weakness DW.   

References BE_IN_CONTROL_BITS_OFFSET, BE_IN_DATA_BITS_OFFSET, BEGIN_CONTROL_BITS_OFFSET, and BEGIN_DATA_BITS_OFFSET.

Referenced by add_deps_for_risky_insns(), add_or_update_dep_1(), create_check_block_twin(), ds_full_merge(), ds_get_max_dep_weak(), ds_merge_1(), new_ready(), sched_analyze_2(), and update_dep().

static void set_dependency_caches ( )
static
Set dependency caches according to DEP.   

References bitmap_set_bit(), current_sched_info, DO_SPECULATION, haifa_sched_info::flags, insn_luid(), and USE_DEPS_LIST.

Referenced by sd_add_dep(), and update_dependency_caches().

static void setup_insn_reg_uses ( )
static
Set up insn register uses for INSN and dependency context DEPS.   

References create_insn_reg_use(), find_regno_note(), reg_use_data::next_regno_use, deps_desc::reg_last, and deps_reg::uses.

Referenced by sched_analyze_insn().

static enum DEPS_ADJUST_RESULT update_dep ( dep_t  dep,
dep_t  new_dep,
sd_iterator_def  sd_it,
rtx  mem1,
rtx  mem2 
)
static
Update DEP to incorporate information from NEW_DEP.
   SD_IT points to DEP in case it should be moved to another list.
   MEM1 and MEM2, if nonnull, correspond to memory locations in case if
   data-speculative dependence should be updated.   

References change_spec_dep_to_hard(), current_sched_info, DEP_CHANGED, DEP_PRESENT, dep_spec_p(), ds_merge(), estimate_dep_weak(), haifa_sched_info::flags, set_dep_weak(), update_dependency_caches(), and USE_DEPS_LIST.

Referenced by add_or_update_dep_1().

static void update_dependency_caches ( )
static
Type of dependence DEP have changed from OLD_TYPE.  Update dependency
   caches accordingly.   

References bitmap_clear_bit(), current_sched_info, haifa_sched_info::flags, insn_luid(), set_dependency_caches(), and USE_DEPS_LIST.

Referenced by update_dep().


Variable Documentation

bitmap_head* anti_dependency_cache = NULL
static
int cache_size
static
bool can_start_lhs_rhs_p
static
Internal variable for sched_analyze_[12] () functions.
   If it is nonzero, this means that sched_analyze_[12] looks
   at the most toplevel SET.   

Referenced by sched_analyze_1(), sched_analyze_2(), and sched_analyze_insn().

bitmap_head* control_dependency_cache = NULL
static
alloc_pool dl_pool
static
Pool to hold dependencies lists (deps_list_t).   
int dl_pool_diff = 0
static
Number of deps_lists out there.   

Referenced by create_deps_list(), deps_pools_are_empty_p(), and free_deps_list().

alloc_pool dn_pool
static
Pool to hold all dependency nodes (dep_node_t).   
int dn_pool_diff = 0
static
Number of dep_nodes out there.   

Referenced by create_dep_node(), delete_dep_node(), and deps_pools_are_empty_p().

int dump_dep_flags = (DUMP_DEP_PRO | DUMP_DEP_CON)
static
Default flags for dump_dep ().   

Referenced by dump_lists().

The data is specific to the Haifa scheduler.   

Referenced by init_deps_data_vector(), sched_deps_finish(), and sel_region_finish().

HARD_REG_SET implicit_reg_pending_clobbers
static
Hard registers implicitly clobbered or used (or may be implicitly
   clobbered or used) by the currently analyzed insn.  For example,
   insn in its constraint has one register class.  Even if there is
   currently no hard register in the insn, the particular hard
   register will be in the insn after reload pass because the
   constraint requires it.   

Referenced by init_deps_global(), and sched_analyze_insn().

HARD_REG_SET implicit_reg_pending_uses
static
bool mark_as_hard
static
True if we should mark added dependencies as a non-register deps.   

Referenced by add_dependence_list(), flush_pending_lists(), and haifa_note_dep().

bitmap_head* output_dependency_cache = NULL
static
regset reg_pending_clobbers
static
regset reg_pending_control_uses
static
regset reg_pending_sets
static
regset reg_pending_uses
static
struct reg_pressure_data reg_pressure_info[N_REG_CLASSES]
static
Register pressure info for the currently processed insn.   

Referenced by init_insn_reg_pressure_info(), mark_hard_regno_death(), mark_insn_hard_regno_birth(), mark_insn_pseudo_birth(), and mark_pseudo_death().

struct sched_deps_info_def* sched_deps_info
bitmap_head* spec_dependency_cache = NULL
static
bitmap_head* true_dependency_cache = NULL
static
To speed up the test for duplicate dependency links we keep a
   record of dependencies created by add_dependence when the average
   number of instructions in a basic block is very large.

   Studies have shown that there is typically around 5 instructions between
   branches for typical C code.  So we can make a guess that the average
   basic block is approximately 5 instructions long; we will choose 100X
   the average size as a very large basic block.

   Each insn has associated bitmaps for its dependencies.  Each bitmap
   has enough entries to represent a dependency on any other insn in
   the insn chain.  All bitmap for true dependencies cache is
   allocated then the rest two ones are also allocated.