aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_validate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/ir_validate.cpp')
-rw-r--r--src/glsl/ir_validate.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 44d7549ea28..0fc3baf8690 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -70,6 +70,7 @@ public:
virtual ir_visitor_status visit_leave(ir_swizzle *ir);
virtual ir_visitor_status visit_enter(ir_assignment *ir);
+ virtual ir_visitor_status visit_enter(ir_call *ir);
static void validate_ir(ir_instruction *ir, void *data);
@@ -173,6 +174,19 @@ ir_validate::visit_enter(ir_function *ir)
this->validate_ir(ir, this->data);
+ /* Verify that all of the things stored in the list of signatures are,
+ * in fact, function signatures.
+ */
+ foreach_list(node, &ir->signatures) {
+ ir_instruction *sig = (ir_instruction *) node;
+
+ if (sig->ir_type != ir_type_function_signature) {
+ printf("Non-signature in signature list of function `%s'\n",
+ ir->name);
+ abort();
+ }
+ }
+
return visit_continue;
}
@@ -198,6 +212,12 @@ ir_validate::visit_enter(ir_function_signature *ir)
abort();
}
+ if (ir->return_type == NULL) {
+ printf("Function signature %p for function %s has NULL return type.\n",
+ (void *) ir, ir->function_name());
+ abort();
+ }
+
this->validate_ir(ir, this->data);
return visit_continue;
@@ -488,6 +508,19 @@ ir_validate::visit_enter(ir_assignment *ir)
return visit_continue;
}
+ir_visitor_status
+ir_validate::visit_enter(ir_call *ir)
+{
+ ir_function_signature *const callee = ir->get_callee();
+
+ if (callee->ir_type != ir_type_function_signature) {
+ printf("IR called by ir_call is not ir_function_signature!\n");
+ abort();
+ }
+
+ return visit_continue;
+}
+
void
ir_validate::validate_ir(ir_instruction *ir, void *data)
{