summaryrefslogtreecommitdiff
path: root/builtin_function.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-04-21 12:30:22 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-21 15:36:36 -0700
commit9fa99f3b6c84fe927ba97e6584cd919f097a6c9a (patch)
tree453be040c7a1948bbb4d9eadbac8ad8ba8c887cd /builtin_function.cpp
parentf96c52ba2e290e3ba5f14cd7f87ba5b4382a1785 (diff)
Refactor IR function representation.
Now, ir_function is emitted as part of the IR instructions, rather than simply existing in the symbol table. Individual ir_function_signatures are not emitted themselves, but only as part of ir_function.
Diffstat (limited to 'builtin_function.cpp')
-rw-r--r--builtin_function.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/builtin_function.cpp b/builtin_function.cpp
index bdd745062b..4243340b3d 100644
--- a/builtin_function.cpp
+++ b/builtin_function.cpp
@@ -267,9 +267,6 @@ generate_function_instance(ir_function *f,
ir_function_signature *const sig = new ir_function_signature(ret_type);
f->add_signature(sig);
- ir_label *const label = new ir_label(name, sig);
- instructions->push_tail(label);
- sig->definition = label;
static const char *arg_names[] = {
"arg0",
"arg1",
@@ -287,6 +284,7 @@ generate_function_instance(ir_function *f,
}
generate(&sig->body, declarations, type);
+ sig->is_defined = true;
}
void
@@ -306,6 +304,8 @@ make_gentype_function(glsl_symbol_table *symtab, exec_list *instructions,
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, n_args, generate,
float_type, float_type);
generate_function_instance(f, name, instructions, n_args, generate,
@@ -424,6 +424,8 @@ generate_vec_compare_function(glsl_symbol_table *symtab,
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 2, generate,
bvec2_type, vec2_type);
generate_function_instance(f, name, instructions, 2, generate,
@@ -487,6 +489,8 @@ generate_length_functions(glsl_symbol_table *symtab, exec_list *instructions)
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 1, generate_length,
float_type, float_type);
generate_function_instance(f, name, instructions, 1, generate_length,
@@ -527,6 +531,8 @@ generate_dot_functions(glsl_symbol_table *symtab, exec_list *instructions)
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 2, generate_dot,
float_type, float_type);
generate_function_instance(f, name, instructions, 2, generate_dot,
@@ -689,6 +695,8 @@ generate_any_functions(glsl_symbol_table *symtab, exec_list *instructions)
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 1, generate_any_bvec2,
glsl_type::bool_type, bvec2_type);
generate_function_instance(f, name, instructions, 1, generate_any_bvec3,
@@ -709,6 +717,8 @@ generate_all_functions(glsl_symbol_table *symtab, exec_list *instructions)
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 1, generate_all_bvec2,
glsl_type::bool_type, bvec2_type);
generate_function_instance(f, name, instructions, 1, generate_all_bvec3,
@@ -729,6 +739,8 @@ generate_not_functions(glsl_symbol_table *symtab, exec_list *instructions)
bool added = symtab->add_function(name, f);
assert(added);
+ instructions->push_tail(f);
+
generate_function_instance(f, name, instructions, 1, generate_not,
bvec2_type, bvec2_type);
generate_function_instance(f, name, instructions, 1, generate_not,