1. A method of optimizing executable program code produced by a compiler from source code comprising at least one compile unit for a cache, the method comprising: performing a forward pass through all of the compile units of the executable program code to be compiled; and: performing a backward pass through all of the compile units of the program to be compiled employing information developed in the forward pass; wherein performing a forward pass through all of the compile units of the executable program code to be compiled comprises: building a global call graph representing all procedures of the executable program code and their call patterns; defining an array descriptor and determining a calculated live range of the array for each unique array in the procedures represented in the global call graph; forming a set of equivalent arrays and pointers; determining for each array if a shape of access to the array and shadow access to the array is consistent and discarding from further consideration any array with an inconsistent access shape; creating a loop descriptor for each loop in the remaining arrays and constructing a global loop table and global loop graph from the loop descriptors; and identifying and classifying each stream in the loop and determining affinity weights between arrays in the loop for each loop in the global loop graph.