A scheduling algorithm is provided for selecting the placement of
instructions with internal slack into a schedule of instructions within a
loop. The algorithm achieves this by pinning nodes with internal slack to
corresponding nodes on the critical path of the code that have similar
properties in terms of the data dependency graph, such as earliest time
and latest time. The effect is that nodes with internal slack are more
often optimally placed in the schedule, reducing the need for rotating
registers or register copy instructions. The benefit of the present
invention can primarily be seen when performing instruction scheduling or
software pipelining on loop code, but can also apply to other forms of
instruction scheduling when greater control of placement of nodes with
internal slack is desired.