Hello, In porting GCC to our VLIW, we would like to implement #pragma unroll to manually specify unrolling factor, hoping to achieve better performance in some cases without changing code itself. As far as I know, #pragma unroll is present in both HPUX aCC and INTEL icc. I examined pragma implementations of some other GCC targets (arm, m32c, etc). It seems that these pragmas are interchangeable with __attribute__, meaning they are attached to either a type or a declaration. But for loop, it is neither a type or a declaration. In fact, when I tracked into GCC, LOOP_EXPR related stuff is never used. Do/while/for loops are lowered to individual statements in parsing stage. At best, I can find a compound statement (statement_list) that represent a loop. Maybe I can invent some attribute for unrolling factor and attach it to the compound statement. But I am not sure whether later optimization (before loop unrolling) will remove or change it. I also need to change many places in the gcc code itself, which is not nice. Is there any better way to do this? Thanks in advance.
BTW, I am working on GCC 4.3.0. Is there any future plan for GCC to implement #pragma unroll or provide infrastructure to implement similar #pragma? I can see it will be quite useful for many targets. Cheers, Bingfeng Mei Broadcom UK