glsl2: Use _mesa_glsl_parse_state as the talloc parent, not glsl_shader.
_mesa_glsl_parse_state should be the parent for all temporary allocation
done while compiling a shader. glsl_shader should only be used as the
parent for the shader's final IR---the _result_ of compilation.
Since many IR instructions may be added or discarded during optimization
passes, IR should not ever be allocated to glsl_shader directly.
Done via sed -i s/talloc_parent(state)/state/g and s/talloc_parent(st)/st/g.
This also removes a ton of talloc_parent calls, which may help performance.
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index f3074a3..b681115 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -59,7 +59,7 @@
YYLTYPE *loc, exec_list *actual_parameters,
struct _mesa_glsl_parse_state *state)
{
- void *ctx = talloc_parent(state);
+ void *ctx = state;
const ir_function_signature *sig =
f->matching_signature(actual_parameters);
@@ -119,7 +119,7 @@
YYLTYPE *loc, exec_list *actual_parameters,
struct _mesa_glsl_parse_state *state)
{
- void *ctx = talloc_parent(state);
+ void *ctx = state;
ir_function *f = state->symbols->get_function(name);
if (f == NULL) {
@@ -244,7 +244,7 @@
YYLTYPE *loc, exec_list *parameters,
struct _mesa_glsl_parse_state *state)
{
- void *ctx = talloc_parent(state);
+ void *ctx = state;
/* Array constructors come in two forms: sized and unsized. Sized array
* constructors look like 'vec4[2](a, b)', where 'a' and 'b' are vec4
* variables. In this case the number of parameters must exactly match the
@@ -318,7 +318,7 @@
YYLTYPE *loc, exec_list *parameters,
struct _mesa_glsl_parse_state *state)
{
- void *ctx = talloc_parent(state);
+ void *ctx = state;
bool all_parameters_are_constant = true;
exec_node *node = parameters->head;
@@ -862,7 +862,7 @@
ast_function_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
- void *ctx = talloc_parent(state);
+ void *ctx = state;
/* There are three sorts of function calls.
*
* 1. contstructors - The first subexpression is an ast_type_specifier.