glsl: Convert ir_function_signature::is_builtin to a method.
A signature is a built-in if and only if builtin_info != NULL, so we don't actually need a separate flag bit. Making a boolean-valued method allows existing code to ask the same question while not worrying about the internal representation. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
@@ -1585,11 +1585,17 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type,
|
||||
_function(NULL)
|
||||
{
|
||||
this->ir_type = ir_type_function_signature;
|
||||
this->is_builtin = builtin_info != NULL;
|
||||
this->origin = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ir_function_signature::is_builtin() const
|
||||
{
|
||||
return builtin_info != NULL;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
modes_match(unsigned a, unsigned b)
|
||||
{
|
||||
@@ -1661,7 +1667,7 @@ ir_function::has_user_signature()
|
||||
{
|
||||
foreach_list(n, &this->signatures) {
|
||||
ir_function_signature *const sig = (ir_function_signature *) n;
|
||||
if (!sig->is_builtin)
|
||||
if (!sig->is_builtin())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@@ -684,7 +684,7 @@ public:
|
||||
unsigned is_defined:1;
|
||||
|
||||
/** Whether or not this function signature is a built-in. */
|
||||
unsigned is_builtin:1;
|
||||
bool is_builtin() const;
|
||||
|
||||
/** Body of instructions in the function. */
|
||||
struct exec_list body;
|
||||
@@ -1321,7 +1321,7 @@ public:
|
||||
ir_type = ir_type_call;
|
||||
assert(callee->return_type != NULL);
|
||||
actual_parameters->move_nodes_to(& this->actual_parameters);
|
||||
this->use_builtin = callee->is_builtin;
|
||||
this->use_builtin = callee->is_builtin();
|
||||
}
|
||||
|
||||
virtual ir_call *clone(void *mem_ctx, struct hash_table *ht) const;
|
||||
|
@@ -329,7 +329,6 @@ ir_function_signature::clone_prototype(void *mem_ctx, struct hash_table *ht) con
|
||||
new(mem_ctx) ir_function_signature(this->return_type);
|
||||
|
||||
copy->is_defined = false;
|
||||
copy->is_builtin = this->is_builtin;
|
||||
copy->builtin_info = this->builtin_info;
|
||||
copy->origin = this;
|
||||
|
||||
|
@@ -1840,7 +1840,7 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s
|
||||
* "Function calls to user-defined functions (non-built-in functions)
|
||||
* cannot be used to form constant expressions."
|
||||
*/
|
||||
if (!this->is_builtin)
|
||||
if (!this->is_builtin())
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
|
@@ -116,7 +116,7 @@ public:
|
||||
f->exact_matching_signature(&callee->parameters);
|
||||
if ((linked_sig == NULL)
|
||||
|| ((linked_sig != NULL)
|
||||
&& (linked_sig->is_builtin != ir->use_builtin))) {
|
||||
&& (linked_sig->is_builtin() != ir->use_builtin))) {
|
||||
linked_sig = new(linked) ir_function_signature(callee->return_type);
|
||||
f->add_signature(linked_sig);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,
|
||||
* signature that we found isn't a built-in, keep looking. Also keep
|
||||
* looking if we expect a non-built-in but found a built-in.
|
||||
*/
|
||||
if (use_builtin != sig->is_builtin)
|
||||
if (use_builtin != sig->is_builtin())
|
||||
continue;
|
||||
|
||||
return sig;
|
||||
|
@@ -1163,14 +1163,14 @@ link_intrastage_shaders(void *mem_ctx,
|
||||
ir_function_signature *sig =
|
||||
(ir_function_signature *) iter.get();
|
||||
|
||||
if (!sig->is_defined || sig->is_builtin)
|
||||
if (!sig->is_defined || sig->is_builtin())
|
||||
continue;
|
||||
|
||||
ir_function_signature *other_sig =
|
||||
other->exact_matching_signature(& sig->parameters);
|
||||
|
||||
if ((other_sig != NULL) && other_sig->is_defined
|
||||
&& !other_sig->is_builtin) {
|
||||
&& !other_sig->is_builtin()) {
|
||||
linker_error(prog, "function `%s' is multiply defined",
|
||||
f->name);
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user