glsl/loops: consolidate bounded loop handling into a lowering pass.

Previously, all of the back-ends (ir_to_mesa, st_glsl_to_tgsi, and the
i965 fs and vec4 visitors) had nearly identical logic for handling
bounded loops.  This replaces the duplicate logic with an equivalent
lowering pass that is used by all the back-ends.

Note: on i965, there is a slight increase in instruction count.  For
example, a loop like this:

    for (int i = 0; i < 100; i++) {
      total += i;
    }

would previously compile down to this (vec4) native code:

          mov(8)       g4<1>.xD 0D
          mov(8)       g8<1>.xD 0D
    loop:
          cmp.ge.f0(8) null     g8<4;4,1>.xD 100D
    (+f0) break(8)
          add(8)       g5<1>.xD g5<4;4,1>.xD g4<4;4,1>.xD
          add(8)       g8<1>.xD g8<4;4,1>.xD 1D
          add(8)       g4<1>.xD g4<4;4,1>.xD 1D
          while(8) loop

After this patch, the "(+f0) break(8)" turns into:

    (+f0) if(8)
          break(8)
          endif(8)

because the back-end isn't smart enough to recognize that "if
(condition) break;" can be done using a conditional break instruction.
However, it should be relatively easy for a future peephole
optimization to properly optimize this.
WIP: replace loop controls with a normative bound.
glsl: Remove unused fields iv_scale and biv from loop_variable class.
glsl: Remove unnecessary list walk from loop_control_visitor.

When loop_control_visitor::visit_leave(ir_loop *) is analyzing a loop
terminator that acts on a certain ir_variable, it doesn't need to walk
the list of induction variables to find the loop_variable entry
corresponding to the variable.  It can just look it up in the
loop_variable_state hashtable and verify that the loop_variable entry
represents an induction variable.
glsl/loops: Allocate loop_terminator using new(mem_ctx) syntax.

Patches to follow will introduce code into the loop_terminator
constructor.  Allocating loop_terminator using new(mem_ctx) syntax
will ensure that the constructor runs.
WIP: move some analysis for loop_controls to loop_analysis.
glsl/loops: Simplify loop unrolling logic by breaking into functions.

The old logic of loop_unroll_visitor::visit_leave(ir_loop *) was:

    heuristics to skip unrolling in various circumstances;
    if (loop contains more than one jump)
      return;
    else if (loop contains one jump) {
      if (the jump is an unconditional "break" at the end of the loop) {
        remove the break and set iteration count to 1;
        fall through to simple loop unrolling code;
      } else {
        for (each "if" statement in the loop body)
          see if the jump is a "break" at the end of one of its forks;
        if (the "break" wasn't found)
          return;
        splice the remainder of the loop into the other fork of the "if";
        remove the "break";
        complex loop unrolling code;
        return;
      }
    }
    simple loop unrolling code;
    return;

These tasks have been moved to their own functions:
- search for the jump as a "break" inside an "if" statement
- splice the remainder of the loop into the other fork of the "if"
- simple loop unrolling code
- complex loop unrolling code

And the logic has been flattened to:

    heuristics to skip unrolling in various circumstances;
    if (loop contains more than one jump)
      return;
    if (loop contains no jumps) {
      simple loop unroll;
      return;
    }
    if (the jump is an unconditional "break" at the end of the loop) {
      remove the break;
      simple loop unroll with iteration count of 1;
      return;
    }
    for (each "if" statement in the loop body) {
      if (the jump is a "break" at the end of one of its forks) {
        splice the remainder of the loop into the other fork of the "if";
        remove the "break";
        complex loop unroll;
        return;
      }
    }
glsl/loops: Get rid of loop_variable_state::max_iterations.

This value is now redundant with
loop_variable_state::limiting_terminator->iterations and
ir_loop::normative_bound.
!UPSTREAM: WIP: leave the limiting terminator.  TODO: merge.
glsl/loops: Stop creating normatively bound loops in loop_controls.

Instead, create informatively bound loops, since these are more likely
to compile into efficient code.

This requires loop_controls to leave the limiting terminator in the
loop.  As a result, when deciding whether to unroll a loop, we have to
account for the fact that the limiting terminator is there, and just
before doing the unrolling, we have to remove it.

This should result in more efficient code generation when a loop with
a known bound is not inlined, since previously, a loop like this:

    for (int i = 0; i < 3; i++) {
      ...computation involving i...;
    }

would get transformed by loop_controls into this (pseudocode):

    int i = 0;
    loop (normative_bound 3) {
      ...computation involving i...;
      i++;
    }

which at code-generation time, would get lowered to:

    int i = 0;
    int j = 0;
    for (int j = 0; j < 3; j++) {
      ..computation involving i...;
      i++;
    }

and the loop would require two registers to hold the loop index
instead of 1.

Now, loop_controls preserves the original structure of the loop, which
is:

    int i = 0;
    loop (informative_bound 3) {
      if (i >= 3)
        break;
      ...computation involving i...;
      i++;
    }

Since no lowering is required for informative bounds in the back-end,
this can get code generated without using up an extra loop index
register.
glsl/loops: Get rid of lower_bounded_loops and ir_loop::normative_bound.