Code Optimization

  • Register Allocation
    • Frequency of resolving/referencing.
    • Nesting level in loops
    • Variables as vertices and adding arcs for coexisting vars. Converting it into map coloring problem.
  • Strength Reduction
    • printf optimized to puts for constant string.
    • Multiplication by power of 2 to a Bit shifting