this invention provides a method for effectively eliminating copy instructions in call - intensive codes by rearranging instructions . these copy instructions would otherwise be required by the calling conventions . removing the copy instructions reduces code size , and therefore i - cache miss rate . the method schedules instructions with the intent of removing copy instructions . it can be used in conjunction with any prior scheduling technique . the method has three primary parts . 2 . coalesce all copy instructions creating an illegal or unschedulable program . def - use chains represent program as directed graphs . nodes in the graphs are program instructions . arcs in the graphs go from the instruction defining some value to the instruction using that value . in the final programs each arc will be associated with a physical register . during scheduling , arcs may not be associated with a physical register ; equivalently , arcs can be associated with virtual registers drawn from an infinite pool of registers . either the defining instruction or the using instruction can require its value to be in a particular physical register . it is possible that both instructions require different physical registers . in this situation , a copy instruction is required to be generated . def - use chains are built using standard techniques for basic block schedulers . copy instructions are coalesced by combining a copy instruction &# 39 ; s input and output arcs . the final arc may require a particular physical register on the arc &# 39 ; s head or tail . if the arc is unconstrained , then the copy instruction is trivially removed . if the arc is constrained to a single register , then it may be possible to schedule the code so that the register is not clobbered between the defining instruction and the using instruction . if rescheduled , then the copy instruction can be removed . if not , then the copy instruction must remain . if both ends of the arc require different physical registers , a copy instruction is still required . coalescing copy instructions during scheduling is one key idea of this invention . coalescing copy instructions in a compiler is typically done either by the register allocater or by a separate compiler pass . in either case , another compiler pass is unable to rearrange instructions . the remaining phase of the invention deals with the consequences of coalescing copy instructions . a typical list scheduler is used . list schedulers maintain a list of &# 34 ; ready &# 34 ; instructions ; instructions whose inputs have already been scheduled . the scheduler pulls the best instruction from a &# 34 ; ready list &# 34 ; containing the ready instructions using some heuristic , then schedules it . scheduling an instruction typically makes more instructions ready . the process repeats until all instructions have been scheduled , and the ready list is empty . the art of list scheduling involves selecting a good heuristic . the heuristic described herein is designed to produce a legal schedule if one is possible . the heuristic follows these basic steps : 1 . find the next subroutine call or end - of - block ( using a simple linear scan ). 2 . find the set of instructions that must be scheduled before this subroutine call due to data dependencies ( by walking the def - use chains already present ). 3 . schedule this set of instructions , then the subroutine call , then repeat until all instructions have been scheduled . if the ready instruction selected to be scheduled next defines a register that is currently in use , then there is a conflict . resolving the conflict usually requires a copy instruction to be generated , where the value in use is copied into virtual register and the value &# 39 ; s users are altered to reflect this . since conflicts imply generation of copy instructions , the heuristic tries to avoid conflicts . scheduling the subset of ready instructions required by the next subroutine call is further refined by more heuristics : 1 . ready instructions defining virtual registers are scheduled before ones defining physical registers . virtual registers never conflict . 2 . instructions that do not conflict and use many physical registers are selected next . when the last use of a physical register is scheduled , that register no longer causes conflicts . 3 . after all instructions are scheduled , a separate pass can reschedule the instructions with the intent of reducing latency . fig4 is a flow chart that illustrates removing copy instructions utilizing rescheduling . first , def - use chains are built , step 52 . def - use chains are described earlier and are built using standard techniques . next , copy instructions are coalesced , step 54 , as described earlier . next a list of instructions whose inputs are all available is generated . this ready list is built in step 56 . a loop is entered in step 58 . while the ready list is not empty , the loop iterates . when the ready list is finally empty , the loop exits and the method is done . within the loop , an instruction is first selected from the ready list , in step 62 . in step 64 , if the selected instruction conflicts with any values that are currently live , then the conflict is resolved . a conflict occurs if a selected instructions writes to a physical register which currently holds a value needed by some other instruction . resolving such a conflict requires inserting a copy instructions to move the value in the physical register to a virtual register . next the selected instruction is scheduled in the basic block , step 66 . scheduling an instruction makes its inputs available for other instructions . if any of these other instructions now have all their inputs available , they are added to the ready list , step 68 . finally the loop repeats starting at step 58 . fig5 is a dataflow chart that illustrates the method shown in fig4 applied to the example shown in fig3 . in this example , the def - use chains are shown explicitly by arcs . coalescing copy instructions in step 54 replaces register ra in instruction 90 with the coalesced register r3 , and the copy instruction 94 is removed . the result is shown on the right hand side of fig5 . next , instructions 92 and 98 are ready and placed on the ready list , step 56 . since the ready list is not empty , step 58 , a next instruction is selected . different methods can be used to select the next instruction . preferably the following technique is used . instruction 98 is not needed by the call instruction , 92 , and it defines a physical register r3 . scheduling instruction 98 next would lead to a conflict with the next call . instead , instruction 92 is scheduled . the ready list will then contain only instruction 98 , and the method repeats the loop starting at step 58 . instruction 98 now must be scheduled ( since it is the only instruction on the ready list ) . since it does not conflict , no conflict resolution is done . instruction 98 is then scheduled and instruction 96 is placed on the ready list . finally instruction 96 is scheduled , the ready list runs dry and the method is done . this method illustrates a technique for removing copy instructions . the actual execution time of copy instructions is quite small for modern microprocessors . however , in call - intensive programs , copy instructions represent a significant percentage of all instructions and they use valuable i - cache space . i - cache misses are a significant portion of the running time of these large programs , so reducing code size reduces running time . traditional techniques for removing copy instructions are limited to register selection ( the copy elimination or register allocation techniques described above ) and do not attempt code motion . traditional code motion techniques do not attempt to remove copy instructions and miss many opportunities to do so . fig6 is a block diagram showing a general purpose computer 20 . the general purpose computer 20 has a computer processor 22 , and memory 24 , connected by a bus 26 . memory 24 includes relatively high speed machine readable media such as dram , sram , rom , flash , eeprom , and bubble memory . also connected to the bus are secondary storage 30 , external storage 32 , output devices such as a monitor 34 , input devices such as a keyboard ( with mouse ) 36 , and printers 38 . secondary storage 30 includes machine readable media such as hard disk drives , magnetic drum , and bubble memory . external storage 32 includes machine readable media such as floppy disks , removable hard drives , magnetic tape , cd - rom , and even other computers , possibly connected via a communications line . the distinction drawn here between secondary storage 30 and external storage 32 is primarily for convenience in describing the invention . as such , it should be appreciated that there is substantial functional overlap between these elements . executable versions of computer software 33 , such as a compiler and user programs generated by such a compiler can be read from the external storage 32 and loaded for execution directly into the memory 34 , or stored on the secondary storage 30 prior to loading into memory 34 and execution . those skilled in the art will recognize that modifications and variations can be made without departing from the spirit of the invention . therefore , it is intended that this invention encompass all such variations and modifications as fall within the scope of the appended claims . claim elements and steps herein have been numbered and / or lettered solely as an aid in readability and understanding . as such , the numbering and / or lettering in itself is not intended to and should not be taken to indicate the ordering of elements and / or steps in the claims .