glsl/loops: Get rid of lower_bounded_loops and ir_loop::normative_bound.

Now that loop_controls no longer creates normatively bound loops,
there is no need for ir_loop::normative_bound or the
lower_bounded_loops pass.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Paul Berry
2013-11-29 00:52:11 -08:00
parent 7ea3baa64d
commit 088494aa03
45 changed files with 35 additions and 221 deletions

View File

@@ -59,7 +59,6 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/loop_analysis.cpp \ $(GLSL_SRCDIR)/loop_analysis.cpp \
$(GLSL_SRCDIR)/loop_controls.cpp \ $(GLSL_SRCDIR)/loop_controls.cpp \
$(GLSL_SRCDIR)/loop_unroll.cpp \ $(GLSL_SRCDIR)/loop_unroll.cpp \
$(GLSL_SRCDIR)/lower_bounded_loops.cpp \
$(GLSL_SRCDIR)/lower_clip_distance.cpp \ $(GLSL_SRCDIR)/lower_clip_distance.cpp \
$(GLSL_SRCDIR)/lower_discard.cpp \ $(GLSL_SRCDIR)/lower_discard.cpp \
$(GLSL_SRCDIR)/lower_discard_flow.cpp \ $(GLSL_SRCDIR)/lower_discard_flow.cpp \

View File

@@ -1277,7 +1277,6 @@ ir_constant::is_basis() const
ir_loop::ir_loop() ir_loop::ir_loop()
{ {
this->ir_type = ir_type_loop; this->ir_type = ir_type_loop;
this->normative_bound = -1;
} }

View File

@@ -1024,13 +1024,6 @@ public:
/** List of ir_instruction that make up the body of the loop. */ /** List of ir_instruction that make up the body of the loop. */
exec_list body_instructions; exec_list body_instructions;
/**
* Normative bound for the loop. If this value is >= 0, the back-end
* should generate instructions to ensure that the loop executes no more
* than this many times.
*/
int normative_bound;
}; };

View File

@@ -158,8 +158,6 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
{ {
ir_loop *new_loop = new(mem_ctx) ir_loop(); ir_loop *new_loop = new(mem_ctx) ir_loop();
new_loop->normative_bound = this->normative_bound;
foreach_iter(exec_list_iterator, iter, this->body_instructions) { foreach_iter(exec_list_iterator, iter, this->body_instructions) {
ir_instruction *ir = (ir_instruction *)iter.get(); ir_instruction *ir = (ir_instruction *)iter.get();
new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht)); new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht));

View File

@@ -101,7 +101,6 @@ bool do_swizzle_swizzle(exec_list *instructions);
bool do_tree_grafting(exec_list *instructions); bool do_tree_grafting(exec_list *instructions);
bool do_vec_index_to_cond_assign(exec_list *instructions); bool do_vec_index_to_cond_assign(exec_list *instructions);
bool do_vec_index_to_swizzle(exec_list *instructions); bool do_vec_index_to_swizzle(exec_list *instructions);
bool lower_bounded_loops(exec_list *instructions);
bool lower_discard(exec_list *instructions); bool lower_discard(exec_list *instructions);
void lower_discard_flow(exec_list *instructions); void lower_discard_flow(exec_list *instructions);
bool lower_instructions(exec_list *instructions, unsigned what_to_lower); bool lower_instructions(exec_list *instructions, unsigned what_to_lower);

View File

@@ -523,10 +523,7 @@ ir_print_visitor::visit(ir_if *ir)
void void
ir_print_visitor::visit(ir_loop *ir) ir_print_visitor::visit(ir_loop *ir)
{ {
printf("(loop ("); printf("(loop (\n");
if (ir->normative_bound >= 0)
printf("%d", ir->normative_bound);
printf(") (\n");
indentation++; indentation++;
foreach_iter(exec_list_iterator, iter, ir->body_instructions) { foreach_iter(exec_list_iterator, iter, ir->body_instructions) {

View File

@@ -488,34 +488,16 @@ ir_reader::read_if(s_expression *expr, ir_loop *loop_ctx)
ir_loop * ir_loop *
ir_reader::read_loop(s_expression *expr) ir_reader::read_loop(s_expression *expr)
{ {
s_expression *s_bound_expr, *s_body, *s_bound; s_expression *s_body;
s_pattern loop_pat[] = { "loop", s_bound_expr, s_body }; s_pattern loop_pat[] = { "loop", s_body };
s_pattern no_bound_pat[] = { };
s_pattern bound_pat[] = { s_bound };
if (!MATCH(expr, loop_pat)) { if (!MATCH(expr, loop_pat)) {
ir_read_error(expr, "expected (loop <bound> <body>)"); ir_read_error(expr, "expected (loop <body>)");
return NULL; return NULL;
} }
ir_loop *loop = new(mem_ctx) ir_loop; ir_loop *loop = new(mem_ctx) ir_loop;
if (MATCH(s_bound_expr, no_bound_pat)) {
loop->normative_bound = -1;
} else if (MATCH(s_bound_expr, bound_pat)) {
s_int *value = SX_AS_INT(s_bound);
if (value == NULL) {
ir_read_error(s_bound_expr, "malformed loop bound");
delete loop;
return NULL;
}
loop->normative_bound = value->value();
} else {
ir_read_error(s_bound_expr, "malformed loop bound");
delete loop;
return NULL;
}
read_instructions(&loop->body_instructions, s_body, loop); read_instructions(&loop->body_instructions, s_body, loop);
if (state->error) { if (state->error) {
delete loop; delete loop;

View File

@@ -193,13 +193,6 @@ loop_control_visitor::visit_leave(ir_loop *ir)
this->progress = true; this->progress = true;
return visit_continue; return visit_continue;
} }
/* If the limiting terminator has a lower iteration count than the
* normative loop bound (if any), then the loop doesn't need a normative
* bound anymore.
*/
if (ir->normative_bound >= 0 && iterations < ir->normative_bound)
ir->normative_bound = -1;
} }
/* Remove the conditional break statements associated with all terminators /* Remove the conditional break statements associated with all terminators
@@ -215,7 +208,7 @@ loop_control_visitor::visit_leave(ir_loop *ir)
if (t->iterations < 0) if (t->iterations < 0)
continue; continue;
if (ir->normative_bound >= 0 || t != ls->limiting_terminator) { if (t != ls->limiting_terminator) {
t->ir->remove(); t->ir->remove();
assert(ls->num_loop_jumps > 0); assert(ls->num_loop_jumps > 0);

View File

@@ -228,9 +228,6 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
loop_variable_state *const ls = this->state->get(ir); loop_variable_state *const ls = this->state->get(ir);
int iterations; int iterations;
/* Note: normatively-bounded loops aren't created anymore. */
assert(ir->normative_bound < 0);
/* If we've entered a loop that hasn't been analyzed, something really, /* If we've entered a loop that hasn't been analyzed, something really,
* really bad has happened. * really bad has happened.
*/ */

View File

@@ -1,117 +0,0 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/** \file
*
* This pass converts bounded loops (those whose ir_loop contains non-null
* values for \c from, \c to, \c increment, and \c counter) into unbounded
* loops.
*
* For instance:
*
* (loop (declare () uint i) (constant uint 0) (constant uint 4)
* (constant uint 1)
* ...loop body...)
*
* Is transformed into:
*
* (declare () uint i)
* (assign (x) (var_ref i) (constant uint 0))
* (loop
* (if (expression bool >= (var_ref i) (constant uint 4))
* (break)
* ())
* ...loop body...
* (assign (x) (var_ref i)
* (expression uint + (var_ref i) (constant uint 1))))
*/
#include "ir_hierarchical_visitor.h"
#include "ir.h"
#include "ir_builder.h"
using namespace ir_builder;
namespace {
class lower_bounded_loops_visitor : public ir_hierarchical_visitor {
public:
lower_bounded_loops_visitor()
: progress(false)
{
}
virtual ir_visitor_status visit_leave(ir_loop *ir);
bool progress;
};
} /* anonymous namespace */
ir_visitor_status
lower_bounded_loops_visitor::visit_leave(ir_loop *ir)
{
if (ir->normative_bound < 0)
return visit_continue;
exec_list new_instructions;
ir_factory f(&new_instructions, ralloc_parent(ir));
/* Before the loop, declare the counter and initialize it to zero. */
ir_variable *counter = f.make_temp(glsl_type::uint_type, "counter");
f.emit(assign(counter, f.constant(0u)));
ir->insert_before(&new_instructions);
/* At the top of the loop, compare the counter to normative_bound, and
* break if the comparison succeeds.
*/
ir_loop_jump *brk = new(f.mem_ctx) ir_loop_jump(ir_loop_jump::jump_break);
ir_if *if_inst = if_tree(gequal(counter,
f.constant((unsigned) ir->normative_bound)),
brk);
ir->body_instructions.push_head(if_inst);
/* At the bottom of the loop, increment the counter. */
ir->body_instructions.push_tail(assign(counter,
add(counter, f.constant(1u))));
/* Since we've explicitly added instructions to terminate the loop, we no
* longer need it to have a normative bound.
*/
ir->normative_bound = -1;
this->progress = true;
return visit_continue;
}
bool
lower_bounded_loops(exec_list *instructions)
{
lower_bounded_loops_visitor v;
visit_list_elements(&v, instructions);
return v.progress;
}

View File

@@ -8,6 +8,6 @@
((declare (out) float a) ((declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) break)))))) ((assign (x) (var_ref a) (constant float (1.000000))) break))))))
EOF EOF

View File

@@ -1,5 +1,5 @@
((declare (out) float a) ((declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) break)))))) ((assign (x) (var_ref a) (constant float (1.000000))) break))))))

View File

@@ -8,7 +8,7 @@
((declare (in) float b) (declare (out) float a) ((declare (in) float b) (declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) (break) (if (expression bool > (var_ref b) (constant float (0.000000))) (break)
()))))))) ())))))))

View File

@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) ((declare (in) float b) (declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) (break) (if (expression bool > (var_ref b) (constant float (0.0))) (break)
()))))))) ())))))))

View File

@@ -9,7 +9,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c) ((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) (if (expression bool > (var_ref b) (constant float (0.000000)))
((assign (x) (var_ref c) (constant float (1.000000))) break) ((assign (x) (var_ref c) (constant float (1.000000))) break)

View File

@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c) ((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) (if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref c) (constant float (1.000000))) break) ((assign (x) (var_ref c) (constant float (1.000000))) break)

View File

@@ -8,7 +8,7 @@
((declare (in) float b) (declare (out) float a) ((declare (in) float b) (declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) () (if (expression bool > (var_ref b) (constant float (0.000000))) ()
(break)))))))) (break))))))))

View File

@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) ((declare (in) float b) (declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) () (if (expression bool > (var_ref b) (constant float (0.0))) ()
(break)))))))) (break))))))))

View File

@@ -9,7 +9,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c) ((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) () (if (expression bool > (var_ref b) (constant float (0.000000))) ()
((assign (x) (var_ref c) (constant float (1.000000))) break)))))))) ((assign (x) (var_ref c) (constant float (1.000000))) break))))))))

View File

@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c) ((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) () (if (expression bool > (var_ref b) (constant float (0.0))) ()
((assign (x) (var_ref c) (constant float (1.000000))) break)))))))) ((assign (x) (var_ref c) (constant float (1.000000))) break))))))))

View File

@@ -12,7 +12,7 @@
(declare (in) float cb) (declare (in) float cb)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((if (expression bool > (var_ref a) (constant float (0.000000))) ((if (expression bool > (var_ref a) (constant float (0.000000)))
((if (expression bool > (var_ref ba) (constant float (0.000000))) ((if (expression bool > (var_ref ba) (constant float (0.000000)))
((if (expression bool > (var_ref bb) (constant float (0.000000))) ((if (expression bool > (var_ref bb) (constant float (0.000000)))

View File

@@ -5,7 +5,7 @@
(signature void (parameters) (signature void (parameters)
((declare (temporary) bool break_flag) ((declare (temporary) bool break_flag)
(assign (x) (var_ref break_flag) (constant bool (0))) (assign (x) (var_ref break_flag) (constant bool (0)))
(loop () (loop
((declare (temporary) bool execute_flag) ((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1))) (assign (x) (var_ref execute_flag) (constant bool (1)))
(if (expression bool > (var_ref a) (constant float (0.0))) (if (expression bool > (var_ref a) (constant float (0.0)))

View File

@@ -10,7 +10,7 @@
((declare (in) float aa) (declare (in) float ab) (declare (in) float b) ((declare (in) float aa) (declare (in) float ab) (declare (in) float b)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((if (expression bool > (var_ref aa) (constant float (0.000000))) ((if (expression bool > (var_ref aa) (constant float (0.000000)))
((if (expression bool > (var_ref ab) (constant float (0.000000))) ((if (expression bool > (var_ref ab) (constant float (0.000000)))
(continue) (continue)

View File

@@ -3,7 +3,7 @@
(signature void (parameters) (signature void (parameters)
((declare (temporary) bool break_flag) ((declare (temporary) bool break_flag)
(assign (x) (var_ref break_flag) (constant bool (0))) (assign (x) (var_ref break_flag) (constant bool (0)))
(loop () (loop
((declare (temporary) bool execute_flag) ((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1))) (assign (x) (var_ref execute_flag) (constant bool (1)))
(if (expression bool > (var_ref aa) (constant float (0.0))) (if (expression bool > (var_ref aa) (constant float (0.0)))

View File

@@ -19,7 +19,7 @@
((return)) ((return))
())) ()))
()) ())
(loop () (loop
((if (expression bool > (var_ref b) (constant float (0.000000))) ((if (expression bool > (var_ref b) (constant float (0.000000)))
((if (expression bool > (var_ref c) (constant float (0.000000))) (break) ((if (expression bool > (var_ref c) (constant float (0.000000))) (break)
(continue))) (continue)))

View File

@@ -14,7 +14,7 @@
())) ()))
()) ())
(if (var_ref execute_flag) (if (var_ref execute_flag)
((loop () ((loop
((if (expression bool > (var_ref b) (constant float (0.0))) ((if (expression bool > (var_ref b) (constant float (0.0)))
((if (expression bool > (var_ref c) (constant float (0.0))) () ((if (expression bool > (var_ref c) (constant float (0.0))) ()
(continue))) (continue)))

View File

@@ -8,6 +8,6 @@
((declare (out) float a) ((declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) continue)))))) ((assign (x) (var_ref a) (constant float (1.000000))) continue))))))
EOF EOF

View File

@@ -1,5 +1,5 @@
((declare (out) float a) ((declare (out) float a)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))))))))) ((assign (x) (var_ref a) (constant float (1.000000)))))))))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function sub (function sub
(signature float (parameters) (signature float (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000))))) (return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000))) (assign (x) (var_ref b) (constant float (3.000000)))

View File

@@ -1,7 +1,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function sub (function sub
(signature float (parameters) (signature float (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000))))) (return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000))) (assign (x) (var_ref b) (constant float (3.000000)))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function sub (function sub
(signature float (parameters) (signature float (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000))))) (return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000))) (assign (x) (var_ref b) (constant float (3.000000)))

View File

@@ -6,7 +6,7 @@
(declare (temporary) float return_value) (declare (temporary) float return_value)
(declare (temporary) bool return_flag) (declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0))) (assign (x) (var_ref return_flag) (constant bool (0)))
(loop () (loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_value) (constant float (2.000000))) (assign (x) (var_ref return_value) (constant float (2.000000)))
(assign (x) (var_ref return_flag) (constant bool (1))) (assign (x) (var_ref return_flag) (constant bool (1)))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function sub (function sub
(signature float (parameters) (signature float (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000))))) (return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000))) (assign (x) (var_ref b) (constant float (3.000000)))

View File

@@ -6,7 +6,7 @@
(declare (temporary) float return_value) (declare (temporary) float return_value)
(declare (temporary) bool return_flag) (declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0))) (assign (x) (var_ref return_flag) (constant bool (0)))
(loop () (loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_value) (constant float (2.000000))) (assign (x) (var_ref return_value) (constant float (2.000000)))
(assign (x) (var_ref return_flag) (constant bool (1))) (assign (x) (var_ref return_flag) (constant bool (1)))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return))) ((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000))))))) (assign (x) (var_ref b) (constant float (2.000000)))))))
EOF EOF

View File

@@ -1,6 +1,6 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return))) ((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000))))))) (assign (x) (var_ref b) (constant float (2.000000)))))))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return))) ((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000))))))) (assign (x) (var_ref b) (constant float (2.000000)))))))
EOF EOF

View File

@@ -3,7 +3,7 @@
(signature void (parameters) (signature void (parameters)
((declare (temporary) bool return_flag) ((declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0))) (assign (x) (var_ref return_flag) (constant bool (0)))
(loop () (loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1))) (assign (x) (var_ref return_flag) (constant bool (1)))
break)) break))

View File

@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b) ((declare (out) float a) (declare (out) float b)
(function main (function main
(signature void (parameters) (signature void (parameters)
((loop () ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return))) ((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000))))))) (assign (x) (var_ref b) (constant float (2.000000)))))))
EOF EOF

View File

@@ -3,7 +3,7 @@
(signature void (parameters) (signature void (parameters)
((declare (temporary) bool return_flag) ((declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0))) (assign (x) (var_ref return_flag) (constant bool (0)))
(loop () (loop
((assign (x) (var_ref a) (constant float (1.000000))) ((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1))) (assign (x) (var_ref return_flag) (constant bool (1)))
break)) break))

View File

@@ -2181,11 +2181,6 @@ fs_visitor::visit(ir_if *ir)
void void
fs_visitor::visit(ir_loop *ir) fs_visitor::visit(ir_loop *ir)
{ {
/* Any normative loop bounds should have been lowered by
* lower_bounded_loops().
*/
assert(ir->normative_bound < 0);
if (brw->gen < 6 && dispatch_width == 16) { if (brw->gen < 6 && dispatch_width == 16) {
fail("Can't support (non-uniform) control flow on 16-wide\n"); fail("Can't support (non-uniform) control flow on 16-wide\n");
} }

View File

@@ -213,8 +213,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
|| progress; || progress;
} while (progress); } while (progress);
lower_bounded_loops(shader->ir);
/* Make a pass over the IR to add state references for any built-in /* Make a pass over the IR to add state references for any built-in
* uniforms that are used. This has to be done now (during linking). * uniforms that are used. This has to be done now (during linking).
* Code generation doesn't happen until the first time this shader is * Code generation doesn't happen until the first time this shader is

View File

@@ -1007,11 +1007,6 @@ vec4_visitor::visit(ir_variable *ir)
void void
vec4_visitor::visit(ir_loop *ir) vec4_visitor::visit(ir_loop *ir)
{ {
/* Any normative loop bounds should have been lowered by
* lower_bounded_loops().
*/
assert(ir->normative_bound < 0);
/* We don't want debugging output to print the whole body of the /* We don't want debugging output to print the whole body of the
* loop as the annotation. * loop as the annotation.
*/ */

View File

@@ -759,11 +759,6 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
void void
ir_to_mesa_visitor::visit(ir_loop *ir) ir_to_mesa_visitor::visit(ir_loop *ir)
{ {
/* Any normative loop bounds should have been lowered by
* lower_bounded_loops().
*/
assert(ir->normative_bound < 0);
emit(NULL, OPCODE_BGNLOOP); emit(NULL, OPCODE_BGNLOOP);
visit_exec_list(&ir->body_instructions, this); visit_exec_list(&ir->body_instructions, this);
@@ -3057,8 +3052,6 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = lower_vector_insert(ir, true) || progress; progress = lower_vector_insert(ir, true) || progress;
} while (progress); } while (progress);
lower_bounded_loops(ir);
validate_ir_tree(ir); validate_ir_tree(ir);
} }

View File

@@ -1137,11 +1137,6 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
void void
glsl_to_tgsi_visitor::visit(ir_loop *ir) glsl_to_tgsi_visitor::visit(ir_loop *ir)
{ {
/* Any normative loop bounds should have been lowered by
* lower_bounded_loops().
*/
assert(ir->normative_bound < 0);
emit(NULL, TGSI_OPCODE_BGNLOOP); emit(NULL, TGSI_OPCODE_BGNLOOP);
visit_exec_list(&ir->body_instructions, this); visit_exec_list(&ir->body_instructions, this);
@@ -5307,8 +5302,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
} while (progress); } while (progress);
lower_bounded_loops(ir);
validate_ir_tree(ir); validate_ir_tree(ir);
} }