A system and method for processing a variable looping statement into a constant
looping statement to enable loop unrolling. A lower bound and an upper bound of
the loop index within the variable looping statement are determined. A constant
looping statement is then formed using the lower bound and upper bound to define
a range over which the loop index varies within the constant looping statement.
The constant looping statement further includes a conditional statement that reflects
conditions in the initial expression and/or the exit expression of the variable
looping statement. The conditional statement controls execution of the body of
the generated constant looping statement, which includes the body from the original
variable looping statement. Loop unrolling may then be performed on the generated
constant looping statement.