Code factoring in GCC on different intermediate languages

Csaba Nagy, Gábor Lóki, Árpád Beszédes and Tibor Gyimóthy
Today as handheld devices (smart phones, PDAs, etc.) are coming to be increasingly popular, the storage capacity becomes more and more important. One way to increase capacity is to optimize static executables on the device. This resulted that code-size optimization gets bigger attention nowadays and new techniques are observed, like code factoring which is still under research.
GNU GCC as the most common compiler in the open source community has many implemented algorithms for code-size optimization, but currently the compiler is still weak in these methods, which can be turned on using the '-Os' flag. In this article we would like to give an overview about implementing different code factoring algorithms (local factoring, sequence abstraction, interprocedural abstraction) on the IPA, Tree, Tree SSA and RTL passes of GCC.
The correctness of the implementation has been checked, and the results were measured on different architectures with GCC's official Code-Size Benchmark Environment (CSiBE) as real-world system. These results showed that on the ARM architecture we could achieve maximum 61.53% and 2.58% average extra code-size saving compared to the '-Os' flag of GCC.