From: Eric Anholt Date: Thu, 24 Jun 2010 22:18:39 +0000 (-0700) Subject: Move the talloc_parent lookup down in a few hot paths. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6b01b50888d22ee330df44240591051cb55cf2a9;p=mesa.git Move the talloc_parent lookup down in a few hot paths. talloc_parent is still 80% of our runtime, but likely talloc_parent lookups will be reduced as we improve the handling of memory ownership. --- diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp index 4010e462674..3408f5256a7 100644 --- a/ir_constant_expression.cpp +++ b/ir_constant_expression.cpp @@ -127,7 +127,6 @@ ir_constant_visitor::visit(ir_function *ir) void ir_constant_visitor::visit(ir_expression *ir) { - void *ctx = talloc_parent(ir); value = NULL; ir_constant *op[2]; unsigned int operand, c; @@ -498,6 +497,7 @@ ir_constant_visitor::visit(ir_expression *ir) return; } + void *ctx = talloc_parent(ir); this->value = new(ctx) ir_constant(ir->type, &data); } @@ -514,7 +514,6 @@ ir_constant_visitor::visit(ir_texture *ir) void ir_constant_visitor::visit(ir_swizzle *ir) { - void *ctx = talloc_parent(ir); ir_constant *v = ir->val->constant_expression_value(); this->value = NULL; @@ -536,6 +535,7 @@ ir_constant_visitor::visit(ir_swizzle *ir) } } + void *ctx = talloc_parent(ir); this->value = new(ctx) ir_constant(ir->type, &data); } } diff --git a/ir_dead_code.cpp b/ir_dead_code.cpp index 01b7d2d832a..88213046825 100644 --- a/ir_dead_code.cpp +++ b/ir_dead_code.cpp @@ -77,7 +77,6 @@ public: variable_entry * ir_dead_code_visitor::get_variable_entry(ir_variable *var) { - void *ctx = talloc_parent(var); assert(var); foreach_iter(exec_list_iterator, iter, this->variable_list) { variable_entry *entry = (variable_entry *)iter.get(); @@ -85,6 +84,8 @@ ir_dead_code_visitor::get_variable_entry(ir_variable *var) return entry; } + void *ctx = talloc_parent(var); + variable_entry *entry = new(ctx) variable_entry(var); this->variable_list.push_tail(entry); return entry; diff --git a/ir_vec_index_to_swizzle.cpp b/ir_vec_index_to_swizzle.cpp index bbd873791a1..abeb43cd68e 100644 --- a/ir_vec_index_to_swizzle.cpp +++ b/ir_vec_index_to_swizzle.cpp @@ -60,7 +60,6 @@ public: ir_rvalue * ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) { - void *ctx = talloc_parent(ir); ir_dereference_array *deref = ir->as_dereference_array(); ir_constant *ir_constant; @@ -75,6 +74,7 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) if (!ir_constant) return ir; + void *ctx = talloc_parent(ir); this->progress = true; return new(ctx) ir_swizzle(deref->array, ir_constant->value.i[0], 0, 0, 0, 1);