mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 22:08:26 +02:00
Use ir_function::add_signature to create link between function and signature
ir_function_signature now has a pointer back to the ir_function that owns it.
This commit is contained in:
parent
4ef183e51d
commit
6a15d5b514
4 changed files with 18 additions and 6 deletions
|
|
@ -1530,7 +1530,7 @@ ast_function_definition::hir(exec_list *instructions,
|
||||||
*/
|
*/
|
||||||
if (signature == NULL) {
|
if (signature == NULL) {
|
||||||
signature = new ir_function_signature(return_type);
|
signature = new ir_function_signature(return_type);
|
||||||
f->signatures.push_tail(signature);
|
f->add_signature(signature);
|
||||||
} else {
|
} else {
|
||||||
/* Destroy all of the previous parameter information. The previous
|
/* Destroy all of the previous parameter information. The previous
|
||||||
* parameter information comes from the function prototype, and it can
|
* parameter information comes from the function prototype, and it can
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ generate_function_instance(ir_function *f,
|
||||||
ir_variable *declarations[17];
|
ir_variable *declarations[17];
|
||||||
|
|
||||||
ir_function_signature *const sig = new ir_function_signature(type);
|
ir_function_signature *const sig = new ir_function_signature(type);
|
||||||
f->signatures.push_tail(sig);
|
f->add_signature(sig);
|
||||||
|
|
||||||
ir_label *const label = new ir_label(name);
|
ir_label *const label = new ir_label(name);
|
||||||
instructions->push_tail(label);
|
instructions->push_tail(label);
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ glsl_type::generate_constructor_prototype(glsl_symbol_table *symtab) const
|
||||||
assert(added);
|
assert(added);
|
||||||
|
|
||||||
ir_function_signature *const sig = new ir_function_signature(this);
|
ir_function_signature *const sig = new ir_function_signature(this);
|
||||||
f->signatures.push_tail(sig);
|
f->add_signature(sig);
|
||||||
|
|
||||||
for (unsigned i = 0; i < length; i++) {
|
for (unsigned i = 0; i < length; i++) {
|
||||||
char *const param_name = (char *) malloc(10);
|
char *const param_name = (char *) malloc(10);
|
||||||
|
|
@ -433,7 +433,7 @@ generate_constructor(glsl_symbol_table *symtab, const struct glsl_type *types,
|
||||||
* appropriate from-scalars constructor.
|
* appropriate from-scalars constructor.
|
||||||
*/
|
*/
|
||||||
ir_function_signature *const sig = new ir_function_signature(& types[i]);
|
ir_function_signature *const sig = new ir_function_signature(& types[i]);
|
||||||
f->signatures.push_tail(sig);
|
f->add_signature(sig);
|
||||||
|
|
||||||
sig->definition =
|
sig->definition =
|
||||||
generate_constructor_intro(& types[i], 1, & sig->parameters,
|
generate_constructor_intro(& types[i], 1, & sig->parameters,
|
||||||
|
|
@ -444,7 +444,7 @@ generate_constructor(glsl_symbol_table *symtab, const struct glsl_type *types,
|
||||||
|
|
||||||
ir_function_signature *const vec_sig =
|
ir_function_signature *const vec_sig =
|
||||||
new ir_function_signature(& types[i]);
|
new ir_function_signature(& types[i]);
|
||||||
f->signatures.push_tail(vec_sig);
|
f->add_signature(vec_sig);
|
||||||
|
|
||||||
vec_sig->definition =
|
vec_sig->definition =
|
||||||
generate_constructor_intro(& types[i], types[i].vector_elements,
|
generate_constructor_intro(& types[i], types[i].vector_elements,
|
||||||
|
|
@ -458,7 +458,7 @@ generate_constructor(glsl_symbol_table *symtab, const struct glsl_type *types,
|
||||||
|
|
||||||
ir_function_signature *const mat_sig =
|
ir_function_signature *const mat_sig =
|
||||||
new ir_function_signature(& types[i]);
|
new ir_function_signature(& types[i]);
|
||||||
f->signatures.push_tail(mat_sig);
|
f->add_signature(mat_sig);
|
||||||
|
|
||||||
mat_sig->definition =
|
mat_sig->definition =
|
||||||
generate_constructor_intro(& types[i],
|
generate_constructor_intro(& types[i],
|
||||||
|
|
|
||||||
12
ir.h
12
ir.h
|
|
@ -160,6 +160,12 @@ public:
|
||||||
* Pointer to the label that begins the function definition.
|
* Pointer to the label that begins the function definition.
|
||||||
*/
|
*/
|
||||||
ir_label *definition;
|
ir_label *definition;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** Function of which this signature is one overload. */
|
||||||
|
class ir_function *function;
|
||||||
|
|
||||||
|
friend class ir_function;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -175,6 +181,12 @@ public:
|
||||||
v->visit(this);
|
v->visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void add_signature(ir_function_signature *sig)
|
||||||
|
{
|
||||||
|
sig->function = this;
|
||||||
|
signatures.push_tail(sig);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a signature that matches a set of actual parameters.
|
* Find a signature that matches a set of actual parameters.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue