Patent ID: 8516465

Claim:
A method for performing a prespill phase in a compiler, comprising: analyzing code of a program, the code including virtual registers, utilizing at least one processing unit, to determine at least one point in the code where a number of live virtual registers exceeds a number of physical registers of a target machine, the code stored in at least one non-transitory storage media; selecting, utilizing the at least one processing unit, a plurality of virtual registers from the virtual registers included in the code as prespilling candidates for the at least one point in the code; choosing, utilizing the at least one processing unit, at least one of the plurality of selected virtual registers to prespill; and prior to performing any register allocation on the code, inserting, utilizing the at least one processing unit, at least one spill instruction and at least one reload instruction in the code to prespill the at least one of the plurality of selected virtual registers, reducing an amount that the number of live virtual registers exceeds the number of physical registers of the target machine for the at least one point in the code.