Revert "i965/fs: Change fs_visitor::emit_lrp to use MAC for gen<6"
[mesa.git] / src / glsl / ir_expression_flattening.cpp
index 7b1b8dbfef1a3d097a3c59df270ad6f20b6c150b..c1cadb122bcefc701a7a34288d2149523d684c1e 100644 (file)
  * Takes the leaves of expression trees and makes them dereferences of
  * assignments of the leaves to temporaries, according to a predicate.
  *
- * This is used for automatic function inlining, where we want to take
- * an expression containing a call and move the call out to its own
- * assignment so that we can inline it at the appropriate place in the
- * instruction stream.
+ * This is used for breaking down matrix operations, where it's easier to
+ * create a temporary and work on each of its vector components individually.
  */
 
 #include "ir.h"
@@ -61,8 +59,8 @@ do_expression_flattening(exec_list *instructions,
 {
    ir_expression_flattening_visitor v(predicate);
 
-   foreach_iter(exec_list_iterator, iter, *instructions) {
-      ir_instruction *ir = (ir_instruction *)iter.get();
+   foreach_list(n, instructions) {
+      ir_instruction *ir = (ir_instruction *) n;
 
       ir->accept(&v);
    }
@@ -78,7 +76,7 @@ ir_expression_flattening_visitor::handle_rvalue(ir_rvalue **rvalue)
    if (!ir || !this->predicate(ir))
       return;
 
-   void *ctx = talloc_parent(ir);
+   void *ctx = ralloc_parent(ir);
 
    var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary);
    base_ir->insert_before(var);