diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-11 14:34:27 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-11 14:35:37 -0800 |
commit | ed45ec6a515f3529f12fc23d51621e435d3b6cdf (patch) | |
tree | fb93422ea1e1d075709d29340c414fbdb740061d | |
parent | d27ec2461bca2625d09a3592ec8cc4137d4347f3 (diff) |
Add ir_call call to represent function calls.
-rw-r--r-- | ast_to_hir.cpp | 2 | ||||
-rw-r--r-- | ir.cpp | 10 | ||||
-rw-r--r-- | ir.h | 30 | ||||
-rw-r--r-- | ir_print_visitor.cpp | 10 | ||||
-rw-r--r-- | ir_print_visitor.h | 1 | ||||
-rw-r--r-- | ir_visitor.h | 1 |
6 files changed, 52 insertions, 2 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 3c4b69fdc2..1fea7299db 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -725,7 +725,7 @@ ast_function_expression::hir(exec_list *instructions, */ (void) instructions; (void) state; - return NULL; + return ir_call::get_error_instruction(); } ir_instruction * @@ -108,3 +108,13 @@ ir_function::ir_function(void) { /* empty */ } + + +ir_call * +ir_call::get_error_instruction() +{ + ir_call *call = new ir_call; + + call->type = glsl_error_type; + return call; +} @@ -39,7 +39,8 @@ enum ir_opcodes { ir_op_label, ir_op_constant, ir_op_func_sig, - ir_op_func + ir_op_func, + ir_op_call, }; /** @@ -277,6 +278,33 @@ public: }; +/** + * 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 c09de83ffd..b1c718d99e 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -132,3 +132,13 @@ void ir_print_visitor::visit(ir_constant *ir) 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 778d4ee00d..b76de50461 100644 --- a/ir_print_visitor.h +++ b/ir_print_visitor.h @@ -60,6 +60,7 @@ public: 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 43246d1058..a2b2dd678b 100644 --- a/ir_visitor.h +++ b/ir_visitor.h @@ -52,6 +52,7 @@ public: 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; /*@}*/ }; |