aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/opt_function_inlining.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-01-15 21:37:10 +0100
committermarha <marha@users.sourceforge.net>2014-01-15 21:37:10 +0100
commitb7f01cb1f6cfd1ec301f650a073436c91ec614aa (patch)
tree1dbf32344313ad7e5884e6686251cad398a231fa /mesalib/src/glsl/opt_function_inlining.cpp
parent7b4b94b4449aec056c4c92f5cacc2f89a292a80e (diff)
parent1b0fcca503ae9cf2d462b60770f96c794dfbb27a (diff)
downloadvcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.tar.gz
vcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.tar.bz2
vcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.zip
Merge remote-tracking branch 'origin/released'
* origin/released: mesa xkeyboard-config xserver git update 15 jan 2014 randrproto libfontenc mesa xserver git update 10 Jan 2014 randsrproto fontconfig libX11 git update 6 Jan 2014 Conflicts: mesalib/src/glsl/builtin_functions.cpp mesalib/src/glsl/ir_builder.h xorg-server/Xext/xres.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/winwindowswm.c xorg-server/include/gc.h xorg-server/os/access.c
Diffstat (limited to 'mesalib/src/glsl/opt_function_inlining.cpp')
-rw-r--r--mesalib/src/glsl/opt_function_inlining.cpp45
1 files changed, 19 insertions, 26 deletions
diff --git a/mesalib/src/glsl/opt_function_inlining.cpp b/mesalib/src/glsl/opt_function_inlining.cpp
index c8f42a424..9649598dd 100644
--- a/mesalib/src/glsl/opt_function_inlining.cpp
+++ b/mesalib/src/glsl/opt_function_inlining.cpp
@@ -107,7 +107,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare);
num_parameters = 0;
- foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters)
+ foreach_list(n, &this->callee->parameters)
num_parameters++;
parameters = new ir_variable *[num_parameters];
@@ -116,11 +116,10 @@ ir_call::generate_inline(ir_instruction *next_ir)
* and set up the mapping of real function body variables to ours.
*/
i = 0;
- exec_list_iterator sig_param_iter = this->callee->parameters.iterator();
- exec_list_iterator param_iter = this->actual_parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
- ir_rvalue *param = (ir_rvalue *) param_iter.get();
+ foreach_two_lists(formal_node, &this->callee->parameters,
+ actual_node, &this->actual_parameters) {
+ ir_variable *sig_param = (ir_variable *) formal_node;
+ ir_rvalue *param = (ir_rvalue *) actual_node;
/* Generate a new variable for the parameter. */
if (sig_param->type->contains_opaque()) {
@@ -154,15 +153,14 @@ ir_call::generate_inline(ir_instruction *next_ir)
next_ir->insert_before(assign);
}
- sig_param_iter.next();
- param_iter.next();
+ ++i;
}
exec_list new_instructions;
/* Generate the inlined body of the function to a new list */
- foreach_iter(exec_list_iterator, iter, callee->body) {
- ir_instruction *ir = (ir_instruction *)iter.get();
+ foreach_list(n, &callee->body) {
+ ir_instruction *ir = (ir_instruction *) n;
ir_instruction *new_ir = ir->clone(ctx, ht);
new_instructions.push_tail(new_ir);
@@ -172,11 +170,10 @@ ir_call::generate_inline(ir_instruction *next_ir)
/* If any opaque types were passed in, replace any deref of the
* opaque variable with a deref of the argument.
*/
- param_iter = this->actual_parameters.iterator();
- sig_param_iter = this->callee->parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_instruction *const param = (ir_instruction *) param_iter.get();
- ir_variable *sig_param = (ir_variable *) sig_param_iter.get();
+ foreach_two_lists(formal_node, &this->callee->parameters,
+ actual_node, &this->actual_parameters) {
+ ir_rvalue *const param = (ir_rvalue *) actual_node;
+ ir_variable *sig_param = (ir_variable *) formal_node;
if (sig_param->type->contains_opaque()) {
ir_dereference *deref = param->as_dereference();
@@ -184,8 +181,6 @@ ir_call::generate_inline(ir_instruction *next_ir)
assert(deref);
do_variable_replacement(&new_instructions, sig_param, deref);
}
- param_iter.next();
- sig_param_iter.next();
}
/* Now push those new instructions in. */
@@ -195,11 +190,10 @@ ir_call::generate_inline(ir_instruction *next_ir)
* variables to our own.
*/
i = 0;
- param_iter = this->actual_parameters.iterator();
- sig_param_iter = this->callee->parameters.iterator();
- for (i = 0; i < num_parameters; i++) {
- ir_instruction *const param = (ir_instruction *) param_iter.get();
- const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get();
+ foreach_two_lists(formal_node, &this->callee->parameters,
+ actual_node, &this->actual_parameters) {
+ ir_rvalue *const param = (ir_rvalue *) actual_node;
+ const ir_variable *const sig_param = (ir_variable *) formal_node;
/* Move our param variable into the actual param if it's an 'out' type. */
if (parameters[i] && (sig_param->data.mode == ir_var_function_out ||
@@ -212,8 +206,7 @@ ir_call::generate_inline(ir_instruction *next_ir)
next_ir->insert_before(assign);
}
- param_iter.next();
- sig_param_iter.next();
+ ++i;
}
delete [] parameters;
@@ -349,8 +342,8 @@ ir_variable_replacement_visitor::visit_leave(ir_dereference_record *ir)
ir_visitor_status
ir_variable_replacement_visitor::visit_leave(ir_call *ir)
{
- foreach_iter(exec_list_iterator, iter, *ir) {
- ir_rvalue *param = (ir_rvalue *)iter.get();
+ foreach_list_safe(n, &ir->actual_parameters) {
+ ir_rvalue *param = (ir_rvalue *) n;
ir_rvalue *new_param = param;
replace_rvalue(&new_param);