glsl: Move is_built_in flag from ir_function_signature to ir_function.

Also rename it to "is_builtin" for consistency.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 31e40ca..8779ec7 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -982,7 +982,6 @@
    : return_type(return_type), is_defined(false), _function(NULL)
 {
    this->ir_type = ir_type_function_signature;
-   this->is_built_in = false;
 }
 
 
@@ -1034,6 +1033,7 @@
 {
    this->ir_type = ir_type_function;
    this->name = talloc_strdup(this, name);
+   this->is_builtin = false;
 }
 
 
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 500b152..0f887a9 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -342,9 +342,6 @@
    /** Whether or not this function has a body (which may be empty). */
    unsigned is_defined:1;
 
-   /** Whether or not this function signature is a built-in. */
-   unsigned is_built_in:1;
-
    /** Body of instructions in the function. */
    struct exec_list body;
 
@@ -410,6 +407,9 @@
     */
    const char *name;
 
+   /** Whether or not this function is a built-in. */
+   unsigned is_builtin:1;
+
    /**
     * List of ir_function_signature for each overloaded function with this name.
     */
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 0a9e25a..1d690a4 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -249,6 +249,8 @@
 {
    ir_function *copy = new(mem_ctx) ir_function(this->name);
 
+   copy->is_builtin = this->is_builtin;
+
    foreach_list_const(node, &this->signatures) {
       const ir_function_signature *const sig =
 	 (const ir_function_signature *const) node;
@@ -271,7 +273,6 @@
       new(mem_ctx) ir_function_signature(this->return_type);
 
    copy->is_defined = this->is_defined;
-   copy->is_built_in = this->is_built_in;
 
    /* Clone the parameter list.
     */
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index f1c175c..5ec60c5 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -785,7 +785,7 @@
     * "Function calls to user-defined functions (non-built-in functions)
     *  cannot be used to form constant expressions."
     */
-   if (!this->callee->is_built_in)
+   if (!this->callee->function()->is_builtin)
       return NULL;
 
    unsigned num_parameters = 0;
diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp
index e553e12..a39b384 100644
--- a/src/glsl/ir_import_prototypes.cpp
+++ b/src/glsl/ir_import_prototypes.cpp
@@ -59,6 +59,7 @@
       this->function = this->symbols->get_function(ir->name);
       if (!this->function) {
 	 this->function = new(this->mem_ctx) ir_function(ir->name);
+	 this->function->is_builtin = ir->is_builtin;
 
 	 list->push_tail(this->function);
 
@@ -86,7 +87,6 @@
 	 new(mem_ctx) ir_function_signature(ir->return_type);
 
       copy->is_defined = false;
-      copy->is_built_in = ir->is_built_in;
 
       /* Clone the parameter list, but NOT the body.
        */
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 83e6403..f47ad87 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -153,14 +153,8 @@
 
 void ir_print_visitor::visit(ir_function *ir)
 {
-   bool found_non_builtin_proto = false;
-
-   foreach_iter(exec_list_iterator, iter, *ir) {
-      ir_function_signature *const sig = (ir_function_signature *) iter.get();
-      if (sig->is_defined || !sig->is_built_in)
-	 found_non_builtin_proto = true;
-   }
-   if (!found_non_builtin_proto)
+   /* Don't print built-in functions as part of the IR. */
+   if (ir->is_builtin)
       return;
 
    printf("(function %s\n", ir->name);
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 3e221c0..366db32 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -209,6 +209,7 @@
    ir_function *f = st->symbols->get_function(name->value());
    if (f == NULL) {
       f = new(ctx) ir_function(name->value());
+      f->is_builtin = true;
       added = st->symbols->add_function(f->name, f);
       assert(added);
    }
@@ -281,7 +282,6 @@
    if (sig == NULL && skip_body) {
       /* If scanning for prototypes, generate a new signature. */
       sig = new(ctx) ir_function_signature(return_type);
-      sig->is_built_in = true;
       f->add_signature(sig);
    } else if (sig != NULL) {
       const char *badvar = sig->qualifiers_match(&hir_parameters);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 0348bd0..3de069b 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -726,14 +726,14 @@
 	       ir_function_signature *sig =
 		  (ir_function_signature *) iter.get();
 
-	       if (!sig->is_defined || sig->is_built_in)
+	       if (!sig->is_defined || f->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_built_in) {
+		   && !other_sig->function()->is_builtin) {
 		  linker_error_printf(prog,
 				      "function `%s' is multiply defined",
 				      f->name);