gccint: Delay Slots

1 
1 17.19.8 Delay Slot Scheduling
1 -----------------------------
1 
1 The insn attribute mechanism can be used to specify the requirements for
1 delay slots, if any, on a target machine.  An instruction is said to
1 require a "delay slot" if some instructions that are physically after
1 the instruction are executed as if they were located before it.  Classic
1 examples are branch and call instructions, which often execute the
1 following instruction before the branch or call is performed.
1 
1  On some machines, conditional branch instructions can optionally
1 "annul" instructions in the delay slot.  This means that the instruction
1 will not be executed for certain branch outcomes.  Both instructions
1 that annul if the branch is true and instructions that annul if the
1 branch is false are supported.
1 
1  Delay slot scheduling differs from instruction scheduling in that
1 determining whether an instruction needs a delay slot is dependent only
1 on the type of instruction being generated, not on data flow between the
1 instructions.  See the next section for a discussion of data-dependent
1 instruction scheduling.
1 
1  The requirement of an insn needing one or more delay slots is indicated
1 via the 'define_delay' expression.  It has the following form:
1 
1      (define_delay TEST
1                    [DELAY-1 ANNUL-TRUE-1 ANNUL-FALSE-1
1                     DELAY-2 ANNUL-TRUE-2 ANNUL-FALSE-2
1                     ...])
1 
1  TEST is an attribute test that indicates whether this 'define_delay'
1 applies to a particular insn.  If so, the number of required delay slots
1 is determined by the length of the vector specified as the second
1 argument.  An insn placed in delay slot N must satisfy attribute test
1 DELAY-N.  ANNUL-TRUE-N is an attribute test that specifies which insns
1 may be annulled if the branch is true.  Similarly, ANNUL-FALSE-N
1 specifies which insns in the delay slot may be annulled if the branch is
1 false.  If annulling is not supported for that delay slot, '(nil)'
1 should be coded.
1 
1  For example, in the common case where branch and call insns require a
1 single delay slot, which may contain any insn other than a branch or
1 call, the following would be placed in the 'md' file:
1 
1      (define_delay (eq_attr "type" "branch,call")
1                    [(eq_attr "type" "!branch,call") (nil) (nil)])
1 
1  Multiple 'define_delay' expressions may be specified.  In this case,
1 each such expression specifies different delay slot requirements and
1 there must be no insn for which tests in two 'define_delay' expressions
1 are both true.
1 
1  For example, if we have a machine that requires one delay slot for
1 branches but two for calls, no delay slot can contain a branch or call
1 insn, and any valid insn in the delay slot for the branch can be
1 annulled if the branch is true, we might represent this as follows:
1 
1      (define_delay (eq_attr "type" "branch")
1         [(eq_attr "type" "!branch,call")
1          (eq_attr "type" "!branch,call")
1          (nil)])
1 
1      (define_delay (eq_attr "type" "call")
1                    [(eq_attr "type" "!branch,call") (nil) (nil)
1                     (eq_attr "type" "!branch,call") (nil) (nil)])
1