Streamlining C Compilation: Harnessing Different Optimization Techniques
L D Mukil, Nayantara Varadharajan, K V Divya · 2025
The Optimizing C Compiler is an advanced tool designed to enhance the performance and efficiency of C programs by implementing a comprehensive suite of optimization techniques during the compilation process. It incorporates methods such as constant propagation, constant folding, loop unrolling, strength reduction, common subexpression elimination, and basic block-level optimizations to improve execution speed and minimize memory usage while maintaining the program's original functionality. These optimizations are especially beneficial in resource-constrained environments like embedded systems, where computational and memory efficiency are critical. The compiler also adopts aggressive strategies like control flow restructuring, peephole optimization, and constant propagation across basic blocks, which streamline execution paths and refine code further by eliminating redundant or inefficient patterns. Implemented in Python, the compiler leverages libraries such as Ply for parsing C code and Re for pattern matching, enabling efficient handling of complex expressions. Additionally, it introduces modular components for tasks like loop unrolling and arithmetic evaluation, allowing flexibility and adaptability to evolving optimization needs. Experimental results validate the compiler's effectiveness, showcasing execution time reductions of up to 40 % in specific scenarios. By combining a robust set of optimization techniques with a modular and extensible design, the compiler serves as a vital tool for developers aiming to build high-performance, resource-efficient applications in both generalpurpose and resource-limited domains.