Patent ID: 7293265

Claim:
A method to perform return-address prediction in a program during a compile time, the method comprising: detecting whether a procedure is associated with an overflow condition by determining at least one of a maximum call-chain length and an average call-chain length associated with the procedure and determining if the at least one of the maximum call-chain length and the average call-chain length exceeds a threshold associated with a return-address stack; when the at least one of the maximum call-chain length and the average call-chain length does not exceed the threshold associated with the return-address stack, analyzing another procedure; and when the at least one of the maximum call-chain length and the average call-chain length exceeds the threshold associated with the return-address stack, inserting a branch-hint instruction corresponding to a return instruction associated with the procedure in the program, wherein inserting the branch-hint instruction comprises inserting the branch-hint instruction in a dominant node.