From b2ed4dd7b0270e469302965269007292117d02e2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 4 May 2010 11:58:03 -0700 Subject: ir_to_mesa: Get temps allocated at the right times. The alloced_vec4/vec4 distinction was an experiment to expose the cost of temps to the codegen. But the problem is that the temporary production rule gets called after the emit rule that was using the temp. We could have the args to emit_op be pointers to where the temp would get allocated later, but that seems overly hard while just trying to bring this thing up. Besides, the temps used in expressions bear only the vaguest relation to how many temps will be used after register allocation. --- ir_to_mesa.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ir_to_mesa.cpp') diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp index f36dea5f31..eb55f82e27 100644 --- a/ir_to_mesa.cpp +++ b/ir_to_mesa.cpp @@ -293,6 +293,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) ir->accept(&v); exit(1); } + + /* Allocate a temporary for the result. */ + this->get_temp(this->result); } @@ -309,6 +312,7 @@ ir_to_mesa_visitor::visit(ir_swizzle *ir) assert(this->result); tree = this->create_tree(MB_TERM_swizzle_vec4, ir, this->result, NULL); + this->get_temp(tree); for (i = 0; i < 4; i++) { if (i < ir->type->vector_elements) { -- cgit v1.2.3