The instruction scheduler may need a fair amount of machine-specific adjustment in order to produce good code. GCC provides several target hooks for this purpose. It is usually enough to define just a few of them: try the first ones in this list first.
int TARGET_SCHED_ISSUE_RATE (void) | Target Hook |
This hook returns the maximum number of instructions that can ever issue
at the same time on the target machine. The default is one. This value
must be constant over the entire compilation. If you need it to vary
depending on what the instructions are, you must use
TARGET_SCHED_VARIABLE_ISSUE .
|
int TARGET_SCHED_VARIABLE_ISSUE (FILE *file, int verbose, rtx insn, int more) | Target Hook |
This hook is executed by the scheduler after it has scheduled an insn
from the ready list. It should return the number of insns which can
still be issued in the current cycle. Normally this is
more - 1 . You should define this hook if some insns
take more machine resources than others, so that fewer insns can follow
them in the same cycle. file is either a null pointer, or a stdio
stream to write any debug output to. verbose is the verbose level
provided by -fsched-verbose- n . insn is the
instruction that was scheduled.
|
int TARGET_SCHED_ADJUST_COST (rtx insn, rtx link, rtx dep_insn, int cost) | Target Hook |
This function corrects the value of cost based on the relationship between insn and dep_insn through the dependence link. It should return the new value. The default is to make no adjustment to cost. This can be used for example to specify to the scheduler that an output- or anti-dependence does not incur the same cost as a data-dependence. |
int TARGET_SCHED_ADJUST_PRIORITY (rtx insn, int priority) | Target Hook |
This hook adjusts the integer scheduling priority priority of insn. It should return the new priority. Reduce the priority to execute insn earlier, increase the priority to execute insn later. Do not define this hook if you do not need to adjust the scheduling priorities of insns. |
int TARGET_SCHED_REORDER (FILE *file, int verbose, rtx *ready, int *n_readyp, int clock) | Target Hook |
This hook is executed by the scheduler after it has scheduled the ready
list, to allow the machine description to reorder it (for example to
combine two small instructions together on VLIW machines).
file is either a null pointer, or a stdio stream to write any
debug output to. verbose is the verbose level provided by
-fsched-verbose- n . ready is a pointer to the ready
list of instructions that are ready to be scheduled. n_readyp is
a pointer to the number of elements in the ready list. The scheduler
reads the ready list in reverse order, starting with
ready[*n_readyp-1] and going to ready[0]. clock
is the timer tick of the scheduler. You may modify the ready list and
the number of ready insns. The return value is the number of insns that
can issue this cycle; normally this is just issue_rate . See also
TARGET_SCHED_REORDER2 .
|
int TARGET_SCHED_REORDER2 (FILE *file, int verbose, rtx *ready, int *n_ready, clock) | Target Hook |
Like TARGET_SCHED_REORDER , but called at a different time. That
function is called whenever the scheduler starts a new cycle. This one
is called once per iteration over a cycle, immediately after
TARGET_SCHED_VARIABLE_ISSUE ; it can reorder the ready list and
return the number of insns to be scheduled in the same cycle. Defining
this hook can be useful if there are frequent situations where
scheduling one insn causes other insns to become ready in the same
cycle. These other insns can then be taken into account properly.
|
void TARGET_SCHED_INIT (FILE *file, int verbose, int max_ready) | Target Hook |
This hook is executed by the scheduler at the beginning of each block of
instructions that are to be scheduled. file is either a null
pointer, or a stdio stream to write any debug output to. verbose
is the verbose level provided by -fsched-verbose- n .
max_ready is the maximum number of insns in the current scheduling
region that can be live at the same time. This can be used to allocate
scratch space if it is needed, e.g. by TARGET_SCHED_REORDER .
|
void TARGET_SCHED_FINISH (FILE *file, int verbose) | Target Hook |
This hook is executed by the scheduler at the end of each block of
instructions that are to be scheduled. It can be used to perform
cleanup of any actions done by the other scheduling hooks. file
is either a null pointer, or a stdio stream to write any debug output
to. verbose is the verbose level provided by
-fsched-verbose- n .
|
rtx TARGET_SCHED_CYCLE_DISPLAY (int clock, rtx last) | Target Hook |
This hook is called in verbose mode only, at the beginning of each pass over a basic block. It should insert an insn into the chain after last, which has no effect, but records the value clock in RTL dumps and assembly output. Define this hook only if you need this level of detail about what the scheduler is doing. |