Hi,

> Ok, I've actually gone a different route. Instead of waiting for the
> middle end to perform this, I've directly modified the parser stage to
> unroll the loop directly there.

I think this is a very bad idea.  First of all, getting the information
needed to decide at this stage whether unrolling is possible at all
is difficult; for instance, what happens for a loop of form

for (...)
  {
    something;
    label:
    something else;
  }

...

goto label;

?

Are you sure that you handle correctly loops with several exits from the
loop body, loops whose control variables may overflow, exception
handling, ...?  And if so, what is the benefit of having the code to
deal with all these complexities twice in the compiler?

Furthermore, unrolling the loops this early may increase compile time
with little or no gain in code quality.

Zdenek

Reply via email to