X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fglsl%2Fir_basic_block.cpp;h=15481aa47f6f1319d630d62d00ad5e4effd37833;hb=0abfb80dacf80c1f2d0a6a4142b9ab84695aa9e7;hp=a8338259620501dd782e26115658c25e70b5e2c8;hpb=222d2f2ac2c7d93cbc0643082c78278ad2c8cfce;p=mesa.git diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index a8338259620..15481aa47f6 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -28,34 +28,7 @@ */ #include "ir.h" -#include "ir_visitor.h" #include "ir_basic_block.h" -#include "glsl_types.h" - -class ir_has_call_visitor : public ir_hierarchical_visitor { -public: - ir_has_call_visitor() - { - has_call = false; - } - - virtual ir_visitor_status visit_enter(ir_call *ir) - { - (void) ir; - has_call = true; - return visit_stop; - } - - bool has_call; -}; - -bool -ir_has_call(ir_instruction *ir) -{ - ir_has_call_visitor v; - ir->accept(&v); - return v.has_call; -} /** * Calls a user function for every basic block in the instruction stream. @@ -83,8 +56,7 @@ void call_for_basic_blocks(exec_list *instructions, ir_instruction *leader = NULL; ir_instruction *last = NULL; - foreach_iter(exec_list_iterator, iter, *instructions) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_in_list(ir_instruction, ir, instructions) { ir_if *ir_if; ir_loop *ir_loop; ir_function *ir_function; @@ -102,7 +74,7 @@ void call_for_basic_blocks(exec_list *instructions, callback(leader, ir, data); leader = NULL; call_for_basic_blocks(&ir_loop->body_instructions, callback, data); - } else if (ir->as_return() || ir->as_call()) { + } else if (ir->as_jump() || ir->as_call()) { callback(leader, ir, data); leader = NULL; } else if ((ir_function = ir->as_function())) { @@ -115,31 +87,9 @@ void call_for_basic_blocks(exec_list *instructions, * and the body of main(). Perhaps those instructions ought * to live inside of main(). */ - foreach_iter(exec_list_iterator, fun_iter, *ir_function) { - ir_function_signature *ir_sig; - - ir_sig = (ir_function_signature *)fun_iter.get(); - + foreach_in_list(ir_function_signature, ir_sig, &ir_function->signatures) { call_for_basic_blocks(&ir_sig->body, callback, data); } - } else if (ir->as_assignment()) { - /* If there's a call in the expression tree being assigned, - * then that ends the BB too. - * - * The assumption is that any consumer of the basic block - * walker is fine with the fact that the call is somewhere in - * the tree even if portions of the tree may be evaluated - * after the call. - * - * A consumer that has an issue with this could not process - * the last instruction of the basic block. If doing so, - * expression flattener may be useful before using the basic - * block finder to get more maximal basic blocks out. - */ - if (ir_has_call(ir)) { - callback(leader, ir, data); - leader = NULL; - } } last = ir; }