From: Kenneth Graunke Date: Wed, 21 Sep 2011 01:08:11 +0000 (-0700) Subject: glsl: Remove ir_call::get_callee() and set_callee(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82065fa20ee3f2880a070f1f4f75509b910cedde;p=mesa.git glsl: Remove ir_call::get_callee() and set_callee(). Previously, set_callee() performed some assertions about the type of the ir_call; protecting the bare pointer ensured these checks would be run. However, ir_call no longer has a type, so the getter and setter methods don't actually do anything useful. Remove them in favor of accessing callee directly, as is done with most other fields in our IR. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt Reviewed-by: Ian Romanick --- diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 3595e742f78..1ba87515ea7 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1467,11 +1467,6 @@ ir_rvalue::error_value(void *mem_ctx) return v; } -void -ir_call::set_callee(ir_function_signature *sig) -{ - this->callee = sig; -} void visit_exec_list(exec_list *list, ir_visitor *visitor) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 054e2acaadb..6adfaa38e06 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1071,19 +1071,6 @@ public: return callee->function_name(); } - /** - * Get the function signature bound to this function call - */ - ir_function_signature *get_callee() - { - return callee; - } - - /** - * Set the function call target - */ - void set_callee(ir_function_signature *sig); - /** * Generates an inline version of the function before @ir, * storing the return value in return_deref. @@ -1096,14 +1083,16 @@ public: */ ir_dereference_variable *return_deref; + /** + * The specific function signature being called. + */ + ir_function_signature *callee; + /* List of ir_rvalue of paramaters passed in this call. */ exec_list actual_parameters; /** Should this call only bind to a built-in function? */ bool use_builtin; - -private: - ir_function_signature *callee; }; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 8a9701c9496..26b0d8f5f3f 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -398,9 +398,9 @@ public: * table. If it is found, replace it with the value from the table. */ ir_function_signature *sig = - (ir_function_signature *) hash_table_find(this->ht, ir->get_callee()); + (ir_function_signature *) hash_table_find(this->ht, ir->callee); if (sig != NULL) - ir->set_callee(sig); + ir->callee = sig; /* Since this may be used before function call parameters are flattened, * the children also need to be processed. diff --git a/src/glsl/ir_function_can_inline.cpp b/src/glsl/ir_function_can_inline.cpp index c367c30e44f..7b15d5df178 100644 --- a/src/glsl/ir_function_can_inline.cpp +++ b/src/glsl/ir_function_can_inline.cpp @@ -59,7 +59,7 @@ bool can_inline(ir_call *call) { ir_function_can_inline_visitor v; - const ir_function_signature *callee = call->get_callee(); + const ir_function_signature *callee = call->callee; if (!callee->is_defined) return false; diff --git a/src/glsl/ir_function_detect_recursion.cpp b/src/glsl/ir_function_detect_recursion.cpp index 890bc455f44..0a5e647cd88 100644 --- a/src/glsl/ir_function_detect_recursion.cpp +++ b/src/glsl/ir_function_detect_recursion.cpp @@ -217,7 +217,7 @@ public: if (this->current == NULL) return visit_continue; - function *const target = this->get_function(call->get_callee()); + function *const target = this->get_function(call->callee); /* Create a link from the caller to the callee. */ diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index 66dd84f73f3..a7c82010b18 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -541,7 +541,7 @@ ir_validate::visit_enter(ir_assignment *ir) ir_visitor_status ir_validate::visit_enter(ir_call *ir) { - ir_function_signature *const callee = ir->get_callee(); + ir_function_signature *const callee = ir->callee; if (callee->ir_type != ir_type_function_signature) { printf("IR called by ir_call is not ir_function_signature!\n"); diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index acee3271249..6b3e154488a 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -68,7 +68,7 @@ public: * Doing so will modify the original shader. This may prevent that * shader from being linkable in other programs. */ - const ir_function_signature *const callee = ir->get_callee(); + const ir_function_signature *const callee = ir->callee; assert(callee != NULL); const char *const name = callee->function_name(); @@ -79,7 +79,7 @@ public: find_matching_signature(name, &callee->parameters, &linked, 1, ir->use_builtin); if (sig != NULL) { - ir->set_callee(sig); + ir->callee = sig; return visit_continue; } @@ -168,7 +168,7 @@ public: */ linked_sig->accept(this); - ir->set_callee(linked_sig); + ir->callee = linked_sig; return visit_continue; } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index d56eb97e45a..49b6b8f4a5e 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -101,7 +101,7 @@ public: virtual ir_visitor_status visit_enter(ir_call *ir) { - exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *sig_param = (ir_variable *)sig_iter.get(); diff --git a/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp index 143e378f97b..0316914714f 100644 --- a/src/glsl/lower_clip_distance.cpp +++ b/src/glsl/lower_clip_distance.cpp @@ -276,7 +276,7 @@ lower_clip_distance_visitor::visit_leave(ir_call *ir) { void *ctx = ralloc_parent(ir); - const exec_node *formal_param_node = ir->get_callee()->parameters.head; + const exec_node *formal_param_node = ir->callee->parameters.head; const exec_node *actual_param_node = ir->actual_parameters.head; while (!actual_param_node->is_tail_sentinel()) { ir_variable *formal_param = (ir_variable *) formal_param_node; diff --git a/src/glsl/opt_constant_folding.cpp b/src/glsl/opt_constant_folding.cpp index db8cd5cee6d..dcad59997f1 100644 --- a/src/glsl/opt_constant_folding.cpp +++ b/src/glsl/opt_constant_folding.cpp @@ -118,7 +118,7 @@ ir_visitor_status ir_constant_folding_visitor::visit_enter(ir_call *ir) { /* Attempt to constant fold parameters */ - exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *sig_param = (ir_variable *)sig_iter.get(); diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index af77e490689..d3812637df0 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -259,7 +259,7 @@ ir_visitor_status ir_constant_propagation_visitor::visit_enter(ir_call *ir) { /* Do constant propagation on call parameters, but skip any out params */ - exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_param_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_rvalue *param = (ir_rvalue *)iter.get(); diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index 18c28018234..f3bc8675efd 100644 --- a/src/glsl/opt_constant_variable.cpp +++ b/src/glsl/opt_constant_variable.cpp @@ -128,7 +128,7 @@ ir_visitor_status ir_constant_variable_visitor::visit_enter(ir_call *ir) { /* Mark any out parameters as assigned to */ - exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, *ir) { ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp index efa3afda35a..923619db45a 100644 --- a/src/glsl/opt_copy_propagation.cpp +++ b/src/glsl/opt_copy_propagation.cpp @@ -181,7 +181,7 @@ ir_visitor_status ir_copy_propagation_visitor::visit_enter(ir_call *ir) { /* Do copy propagation on call parameters, but skip any out params */ - exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_param_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_instruction *ir = (ir_instruction *)iter.get(); diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp index ebfd4fd3fe1..314db4e187f 100644 --- a/src/glsl/opt_copy_propagation_elements.cpp +++ b/src/glsl/opt_copy_propagation_elements.cpp @@ -288,7 +288,7 @@ ir_visitor_status ir_copy_propagation_elements_visitor::visit_enter(ir_call *ir) { /* Do copy propagation on call parameters, but skip any out params */ - exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_param_iter = ir->callee->parameters.iterator(); foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_instruction *ir = (ir_instruction *)iter.get(); diff --git a/src/glsl/opt_dead_functions.cpp b/src/glsl/opt_dead_functions.cpp index 51c77e3b947..017a28639b8 100644 --- a/src/glsl/opt_dead_functions.cpp +++ b/src/glsl/opt_dead_functions.cpp @@ -103,7 +103,7 @@ ir_dead_functions_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_dead_functions_visitor::visit_enter(ir_call *ir) { - signature_entry *entry = this->get_signature_entry(ir->get_callee()); + signature_entry *entry = this->get_signature_entry(ir->callee); entry->used = true; diff --git a/src/glsl/opt_tree_grafting.cpp b/src/glsl/opt_tree_grafting.cpp index e70a2240fca..d86eab80e50 100644 --- a/src/glsl/opt_tree_grafting.cpp +++ b/src/glsl/opt_tree_grafting.cpp @@ -202,7 +202,7 @@ ir_tree_grafting_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_tree_grafting_visitor::visit_enter(ir_call *ir) { - exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + exec_list_iterator sig_iter = ir->callee->parameters.iterator(); /* Reminder: iterating ir_call iterates its parameters. */ foreach_iter(exec_list_iterator, iter, *ir) { ir_variable *sig_param = (ir_variable *)sig_iter.get(); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 6a90d5ad7e8..697313fc36e 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2002,7 +2002,7 @@ void ir_to_mesa_visitor::visit(ir_call *ir) { ir_to_mesa_instruction *call_inst; - ir_function_signature *sig = ir->get_callee(); + ir_function_signature *sig = ir->callee; function_entry *entry = get_function_signature(sig); int i; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b0227855c67..6745554211b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2439,7 +2439,7 @@ void glsl_to_tgsi_visitor::visit(ir_call *ir) { glsl_to_tgsi_instruction *call_inst; - ir_function_signature *sig = ir->get_callee(); + ir_function_signature *sig = ir->callee; function_entry *entry = get_function_signature(sig); int i;