Patent attributes
A code, which may be a post-link binary or a pre-link object file, can be transformed to optimize code fragments that implement loading a constant from memory. A constant loading code fragment includes address computing operations that compute (or copy) an address representation of a constant for consumption by a memory access operation, and the memory access operation that loads the constant. Information from control flow analysis, data flow analysis, and binary structure/configuration analysis are examined to identify code fragments of a code that implement constant loading. A tool transforms the code to convert the identified code fragments. To optimize, the tool may convert operations, eliminate operations, convert indirect calls to direct calls, inline functions called indirectly, eliminate unused constant data, modify relocations, etc. This optimization can also be applied recursively. The same tool or another tool can subsequently analyze the transformed code one more times to identify additional opportunities for optimizations revealed by the transformation or to apply the transformation for a different profile of the application.