glsl: initialise killed_all field.
[mesa.git] / src / glsl / link_functions.cpp
index 7ba760daa1ae47c3fe92912670edce8936529047..6b3e154488aef5e53d10466bb5bc7f48f3aaa9ed 100644 (file)
@@ -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;
       }
 
@@ -91,8 +91,8 @@ public:
       if (sig == NULL) {
         /* FINISHME: Log the full signature of unresolved function.
          */
-        linker_error_printf(this->prog, "unresolved reference to function "
-                            "`%s'\n", name);
+        linker_error(this->prog, "unresolved reference to function `%s'\n",
+                     name);
         this->success = false;
         return visit_stop;
       }
@@ -104,10 +104,12 @@ public:
       if (f == NULL) {
         f = new(linked) ir_function(name);
 
-        /* Add the new function to the linked IR.
+        /* Add the new function to the linked IR.  Put it at the end
+          * so that it comes after any global variable declarations
+          * that it refers to.
          */
         linked->symbols->add_function(f);
-        linked->ir->push_head(f);
+        linked->ir->push_tail(f);
       }
 
       ir_function_signature *linked_sig =
@@ -166,7 +168,7 @@ public:
        */
       linked_sig->accept(this);
 
-      ir->set_callee(linked_sig);
+      ir->callee = linked_sig;
 
       return visit_continue;
    }