1. A method comprising: collecting statistics to identify potential optimization candidates for software controlled caching; analyzing the statistics to determine selected optimization candidates; performing a check to determine if optimization of the selected optimization candidates is appropriate; and if optimization is appropriate, generating a code sequence for each of the selected optimization candidates.