GCC Middle and Back End API Reference
sched-ebb.c File Reference

Functions

static void init_ready_list (void)
static void begin_schedule_ready (rtx)
static int schedule_more_p (void)
static const char * ebb_print_insn (const_rtx, int)
static int rank (rtx, rtx)
static int ebb_contributes_to_priority (rtx, rtx)
static basic_block earliest_block_with_similiar_load (basic_block, rtx)
static void add_deps_for_risky_insns (rtx, rtx)
static void debug_ebb_dependencies (rtx, rtx)
static void ebb_add_remove_insn (rtx, int)
static void ebb_add_block (basic_block, basic_block)
static basic_block advance_target_bb (basic_block, rtx)
static void ebb_fix_recovery_cfg (int, int, int)
static void * save_ebb_state ()
static void restore_ebb_state ()
static void debug_ebb_dependencies ()
static void begin_schedule_ready ()
static void begin_move_insn ()
static const char * ebb_print_insn ()
static int rank ()
void ebb_compute_jump_reg_dependencies ()
static basic_block earliest_block_with_similiar_load ()
static void add_deps_for_risky_insns ()
basic_block schedule_ebb ()
void schedule_ebbs_init ()
void schedule_ebbs_finish ()
void schedule_ebbs ()
static void ebb_add_remove_insn ()
static void ebb_add_block ()
static basic_block advance_target_bb ()

Variables

static int rgn_n_insns
static int sched_rgn_n_insns
static bitmap_head dont_calc_deps
static basic_block last_bb
static struct common_sched_info_def ebb_common_sched_info
static struct sched_deps_info_def ebb_sched_deps_info
static struct haifa_sched_info ebb_sched_info

Function Documentation

static void add_deps_for_risky_insns ( rtx  ,
rtx   
)
static
static void add_deps_for_risky_insns ( )
static
   The following function adds dependencies between jumps and risky
   insns in given ebb.  
             Ensure blocks stay in the same order.  
                 Fall through.  
                 ??? We could implement better checking PRISKY_CANDIDATEs
                 analogous to sched-rgn.c.  
                 We can not change the mode of the backward
                 dependency because REG_DEP_ANTI has the lowest
                 rank.  
     Maintain the invariant that bb->aux is clear after use.  
static basic_block advance_target_bb ( basic_block  ,
rtx   
)
static
static basic_block advance_target_bb ( )
static
   Return next block in ebb chain.  For parameter meaning please refer to
   sched-int.h: struct sched_info: advance_target_bb.  
             We handle interblock movement of the speculation check
             or over a speculation check in
             haifa-sched.c: move_block_after_check ().  
             Assert that we don't move jumps across blocks.  
       Return next non empty block.  
static void begin_move_insn ( )
static
   INSN is being moved to its place in the schedule, after LAST.  
         INSN is a jump in the last block, ...  
         that is going to be moved over some instructions.  
         An obscure special case, where we do have partially dead
         instruction scheduled after last control flow instruction.
         In this case we can create new basic block.  It is
         always exactly one basic block last in the sequence.  
             Create an empty unreachable block after the INSN.  
         split_edge () creates BB before E->DEST.  Keep in mind, that
         this operation extends scheduling region till the end of BB.
         Hence, we need to shift NEXT_TAIL, so haifa-sched.c won't go out
         of the scheduling region.  
         Append new basic block to the end of the ebb.  
static void begin_schedule_ready ( rtx  )
static
static void begin_schedule_ready ( )
static
   INSN is being scheduled after LAST.  Update counters.  
static void debug_ebb_dependencies ( rtx  ,
rtx   
)
static
static void debug_ebb_dependencies ( )
static
   Print dependency information about ebb between HEAD and TAIL.  

References current_sched_info, haifa_sched_info::next_tail, haifa_sched_info::prev_head, sched_rgn_n_insns, and sched_verbose.

static basic_block earliest_block_with_similiar_load ( basic_block  ,
rtx   
)
static
static basic_block earliest_block_with_similiar_load ( )
static
   Returns the earliest block in EBB currently being processed where a
   "similar load" 'insn2' is found, and hence LOAD_INSN can move
   speculatively into the found block.  All the following must hold:

   (1) both loads have 1 base register (PFREE_CANDIDATEs).
   (2) load_insn and load2 have a def-use dependence upon
   the same insn 'insn1'.

   From all these we can conclude that the two loads access memory
   addresses that differ at most by a constant, and hence if moving
   load_insn would cause an exception, it would have been caused by
   load2 anyhow.

   The function uses list (given by LAST_BLOCK) of already processed
   blocks in EBB.  The list is formed in `add_deps_for_risky_insns'.  
           Found a DEF-USE dependence (insn1, load_insn).  
                     Found a DEF-USE dependence (insn1, insn2).  
                       insn2 not guaranteed to be a 1 base reg load.  
                       insn2 is the similar load.  
static void ebb_add_block ( basic_block  ,
basic_block   
)
static
static void ebb_add_block ( )
static
   BB was added to ebb after AFTER.  
     Recovery blocks are always bounded by BARRIERS,
     therefore, they always form single block EBB,
     therefore, we can use rec->index to identify such EBBs.  
static void ebb_add_remove_insn ( rtx  ,
int   
)
static
static void ebb_add_remove_insn ( )
static
   INSN has been added to/removed from current ebb.  

References basic_block_def::index.

void ebb_compute_jump_reg_dependencies ( )
    INSN is a JUMP_INSN.  Store the set of registers that
    must be considered as used by this jump in USED.  

Referenced by ebb_contributes_to_priority().

static int ebb_contributes_to_priority ( rtx  next,
rtx  insn 
)
static
   NEXT is an instruction that depends on INSN (a backward dependence);
   return nonzero if we should include this dependence in priority
   calculations.  

References ebb_compute_jump_reg_dependencies().

static void ebb_fix_recovery_cfg ( int  bbi,
int  jump_bbi,
int  jump_bb_nexti 
)
static
   Fix internal data after interblock movement of jump instruction.
   For parameter meaning please refer to
   sched-int.h: struct sched_info: fix_recovery_cfg.  
static const char* ebb_print_insn ( const_rtx  ,
int   
)
static
static const char* ebb_print_insn ( )
static
   Return a string that contains the insn uid and optionally anything else
   necessary to identify this insn in an output.  It's valid to use a
   static buffer for this.  The ALIGNED parameter should cause the string
   to be formatted so that multiple output lines will line up nicely.  
     '+' before insn means it is a new cycle start.  
static void init_ready_list ( void  )
static
   Implementations of the sched_info functions for region scheduling.  
   Add all insns that are initially ready to the ready list READY.  Called
   once before scheduling a set of insns.  
     Print debugging information.  
     Initialize ready list with all 'ready' insns in target block.
     Count number of insns in the target block being scheduled.  
static int rank ( rtx  ,
rtx   
)
static

Referenced by get_rank().

static int rank ( )
static
   Compare priority of two insns.  Return a positive number if the second
   insn is to be preferred for scheduling, and a negative one if the first
   is to be preferred.  Zero if they are equally good.  

References bitmap_ior_into(), edge_def::dest, df_get_live_in(), edge_def::flags, and basic_block_def::succs.

static void restore_ebb_state ( )
static
   Restore the state of the frontend from P_, then free it.  

References rgn_n_insns, and sched_rgn_n_insns.

static void* save_ebb_state ( )
static
   Allocate memory and store the state of the frontend.  Return the allocated
   memory.  

References free(), and sched_rgn_n_insns.

basic_block schedule_ebb ( )
   Schedule a single extended basic block, defined by the boundaries
   HEAD and TAIL.

   We change our expectations about scheduler behaviour depending on
   whether MODULO_SCHEDULING is true.  If it is, we expect that the
   caller has already called set_modulo_params and created delay pairs
   as appropriate.  If the modulo schedule failed, we return
   NULL_RTX.  
     Blah.  We should fix the rest of the code not to get confused by
     a note or two.  
         Compute dependencies.  
       Only recovery blocks can have their dependencies already calculated,
       and they always are single block ebbs.  
     Set priorities.  
     Make ready list big enough to hold all the instructions from the ebb.  
     Free ready list.  
     We might pack all instructions into fewer blocks,
     so we may made some of them empty.  Can't assert (b == last_bb).  
     Sanity check: verify that all region insns were scheduled.  
     Free dependencies.  
       LAST_BB is unreachable.  

References targetm.

void schedule_ebbs ( void  )
   The main entry point in this file.  
     Taking care of this degenerate case makes the rest of
     this code simpler.  
     Schedule every region in the subroutine.  
void schedule_ebbs_finish ( void  )
   Perform cleanups after scheduling using schedules_ebbs or schedule_ebb.  
     Reposition the prologue and epilogue notes in case we moved the
     prologue/epilogue insns.  
void schedule_ebbs_init ( void  )
   Perform initializations before running schedule_ebbs or a single
   schedule_ebb.  
     Setup infos.  
     Initialize DONT_CALC_DEPS and ebb-{start, end} markers.  
static int schedule_more_p ( void  )
static
   Return nonzero if there are more insns that should be scheduled.  

Variable Documentation

bitmap_head dont_calc_deps
static
   Set of blocks, that already have their dependencies calculated.  
struct common_sched_info_def ebb_common_sched_info
static
   Used in schedule_insns to initialize current_sched_info for scheduling
   regions (or single basic blocks).  
struct sched_deps_info_def ebb_sched_deps_info
static
Initial value:
{
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL,
1, 0, 0
}
basic_block last_bb
static
   Last basic block in current ebb.  

Referenced by thread_prologue_and_epilogue_insns().

int rgn_n_insns
static
@verbatim 

Instruction scheduling pass. Copyright (C) 1992-2013 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiema.nosp@m.nn@c.nosp@m.ygnus.nosp@m..com) Enhanced by, and currently maintained by, Jim Wilson (wilso.nosp@m.n@cy.nosp@m.gnus..nosp@m.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/.

   The number of insns to be scheduled in total.  

Referenced by restore_ebb_state().

int sched_rgn_n_insns
static
   The number of insns scheduled so far.  

Referenced by debug_ebb_dependencies(), restore_ebb_state(), and save_ebb_state().