Add ir_call call to represent function calls.
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 3c4b69f..1fea729 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -725,7 +725,7 @@
*/
(void) instructions;
(void) state;
- return NULL;
+ return ir_call::get_error_instruction();
}
ir_instruction *
diff --git a/ir.cpp b/ir.cpp
index 3166cdc..5aec70b 100644
--- a/ir.cpp
+++ b/ir.cpp
@@ -108,3 +108,13 @@
{
/* empty */
}
+
+
+ir_call *
+ir_call::get_error_instruction()
+{
+ ir_call *call = new ir_call;
+
+ call->type = glsl_error_type;
+ return call;
+}
diff --git a/ir.h b/ir.h
index 7de7c38..136b45b 100644
--- a/ir.h
+++ b/ir.h
@@ -39,7 +39,8 @@
ir_op_label,
ir_op_constant,
ir_op_func_sig,
- ir_op_func
+ ir_op_func,
+ ir_op_call,
};
/**
@@ -277,6 +278,33 @@
};
+/**
+ * IR instruction representing a function call
+ */
+class ir_call : public ir_instruction {
+public:
+ ir_call()
+ : ir_instruction(ir_op_call), callee(NULL)
+ {
+ /* empty */
+ }
+
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
+ /**
+ * Get a generic ir_call object when an error occurs
+ */
+ static ir_call *get_error_instruction();
+
+private:
+ ir_function_signature *callee;
+ exec_list actual_parameters;
+};
+
+
struct ir_swizzle_mask {
unsigned x:2;
unsigned y:2;
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp
index c09de83..b1c718d 100644
--- a/ir_print_visitor.cpp
+++ b/ir_print_visitor.cpp
@@ -132,3 +132,13 @@
printf(" (FINISHME: value goes here)\n");
printf(")\n");
}
+
+
+void
+ir_print_visitor::visit(ir_call *ir)
+{
+ (void) ir;
+
+ printf("(call FINISHME: function name here\n");
+ printf(" (FINISHME: function paramaters here))\n");
+}
diff --git a/ir_print_visitor.h b/ir_print_visitor.h
index 778d4ee..b76de50 100644
--- a/ir_print_visitor.h
+++ b/ir_print_visitor.h
@@ -60,6 +60,7 @@
virtual void visit(ir_dereference *);
virtual void visit(ir_assignment *);
virtual void visit(ir_constant *);
+ virtual void visit(ir_call *);
/*@}*/
};
diff --git a/ir_visitor.h b/ir_visitor.h
index 43246d1..a2b2dd6 100644
--- a/ir_visitor.h
+++ b/ir_visitor.h
@@ -52,6 +52,7 @@
virtual void visit(class ir_dereference *) = 0;
virtual void visit(class ir_assignment *) = 0;
virtual void visit(class ir_constant *) = 0;
+ virtual void visit(class ir_call *) = 0;
/*@}*/
};