};
+/**
+ * \name Jump-like IR instructions.
+ *
+ * These include \c break, \c continue, \c return, and \c discard.
+ */
+/*@{*/
+class ir_jump : public ir_instruction {
+protected:
+ ir_jump()
+ : ir_instruction(ir_op_jump)
+ {
+ /* empty */
+ }
+};
+
+class ir_return : public ir_jump {
+public:
+ ir_return()
+ : value(NULL)
+ {
+ /* empty */
+ }
+
+ ir_return(ir_expression *value)
+ : value(value)
+ {
+ /* empty */
+ }
+
+ ir_expression *get_value() const
+ {
+ return value;
+ }
+
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
+private:
+ ir_expression *value;
+};
+/*@}*/
+
+
struct ir_swizzle_mask {
unsigned x:2;
unsigned y:2;
printf("(call FINISHME: function name here\n");
printf(" (FINISHME: function paramaters here))\n");
}
+
+
+void
+ir_print_visitor::visit(ir_return *ir)
+{
+ printf("(return");
+
+ ir_expression *const value = ir->get_value();
+ if (value) {
+ printf(" ");
+ value->accept(this);
+ }
+
+ printf(")\n");
+}
virtual void visit(ir_assignment *);
virtual void visit(ir_constant *);
virtual void visit(ir_call *);
+ virtual void visit(ir_return *);
/*@}*/
};
virtual void visit(class ir_assignment *) = 0;
virtual void visit(class ir_constant *) = 0;
virtual void visit(class ir_call *) = 0;
+ virtual void visit(class ir_return *) = 0;
/*@}*/
};