diff options
author | Eric Anholt <eric@anholt.net> | 2010-06-24 15:13:03 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-06-24 15:13:03 -0700 |
commit | e33c10328caec29616a5433b1d1df9088f3a84df (patch) | |
tree | 723cc38803bb10032d28be9a9a161232d05d0fd1 /ir_constant_expression.cpp | |
parent | 9290e0dd28e646c3dc810e0a6405582f8bf643b6 (diff) | |
parent | 26bbfb7917a71d46d9227bbf960606cb673636d3 (diff) |
Merge remote branch 'cworth/master'
Conflicts:
ast_to_hir.cpp
ir.cpp
This brings in the talloc-based memory management work, so that the
compiler (almost) no longer leaks memory.
Diffstat (limited to 'ir_constant_expression.cpp')
-rw-r--r-- | ir_constant_expression.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp index effb88844e..4010e46267 100644 --- a/ir_constant_expression.cpp +++ b/ir_constant_expression.cpp @@ -127,6 +127,7 @@ 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; @@ -497,7 +498,7 @@ ir_constant_visitor::visit(ir_expression *ir) return; } - this->value = new ir_constant(ir->type, &data); + this->value = new(ctx) ir_constant(ir->type, &data); } @@ -513,6 +514,7 @@ 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; @@ -534,7 +536,7 @@ ir_constant_visitor::visit(ir_swizzle *ir) } } - this->value = new ir_constant(ir->type, &data); + this->value = new(ctx) ir_constant(ir->type, &data); } } @@ -553,6 +555,7 @@ ir_constant_visitor::visit(ir_dereference_variable *ir) void ir_constant_visitor::visit(ir_dereference_array *ir) { + void *ctx = talloc_parent(ir); ir_constant *array = ir->array->constant_expression_value(); ir_constant *idx = ir->array_index->constant_expression_value(); @@ -592,11 +595,11 @@ ir_constant_visitor::visit(ir_dereference_array *ir) break; } - this->value = new ir_constant(column_type, &data); + this->value = new(ctx) ir_constant(column_type, &data); } else if (array->type->is_vector()) { const unsigned component = idx->value.u[0]; - this->value = new ir_constant(array, component); + this->value = new(ctx) ir_constant(array, component); } else { /* FINISHME: Handle access of constant arrays. */ } |