aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-10 10:49:59 +0200
committermarha <marha@users.sourceforge.net>2012-04-10 10:49:59 +0200
commitc6f80401dc533b04341afe8d596960d1bc25efce (patch)
tree2826007946218a8370d2eebc6aa32083618e2bfe /mesalib/src/glsl/ir.h
parent31706e67674f308e3e7f2a8aaf02f1e0a00fbade (diff)
downloadvcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.tar.gz
vcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.tar.bz2
vcxsrv-c6f80401dc533b04341afe8d596960d1bc25efce.zip
fontconfig mesa xkeyboard-config xserver pixman git update 10 Apr 2012
Diffstat (limited to 'mesalib/src/glsl/ir.h')
-rw-r--r--mesalib/src/glsl/ir.h83
1 files changed, 48 insertions, 35 deletions
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index 1faae3c72..b1ae6db74 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -88,7 +88,6 @@ enum ir_node_type {
class ir_instruction : public exec_node {
public:
enum ir_node_type ir_type;
- const struct glsl_type *type;
/** ir_print_visitor helper for debugging. */
void print(void) const;
@@ -127,16 +126,27 @@ protected:
ir_instruction()
{
ir_type = ir_type_unset;
- type = NULL;
}
};
+/**
+ * The base class for all "values"/expression trees.
+ */
class ir_rvalue : public ir_instruction {
public:
- virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const = 0;
+ const struct glsl_type *type;
+
+ virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const;
+
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
- virtual ir_constant *constant_expression_value() = 0;
+ virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+
+ virtual ir_constant *constant_expression_value();
virtual ir_rvalue * as_rvalue()
{
@@ -209,6 +219,14 @@ public:
*/
virtual bool is_negative_one() const;
+
+ /**
+ * Return a generic value of error_type.
+ *
+ * Allocation will be performed with 'mem_ctx' as ralloc owner.
+ */
+ static ir_rvalue *error_value(void *mem_ctx);
+
protected:
ir_rvalue();
};
@@ -303,6 +321,11 @@ public:
glsl_interp_qualifier determine_interpolation_mode(bool flat_shade);
/**
+ * Declared type of the variable
+ */
+ const struct glsl_type *type;
+
+ /**
* Delcared name of the variable
*/
const char *name;
@@ -460,6 +483,12 @@ public:
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
/**
+ * Attempt to evaluate this function as a constant expression, given
+ * a list of the actual parameters. Returns NULL for non-built-ins.
+ */
+ ir_constant *constant_expression_value(exec_list *actual_parameters);
+
+ /**
* Get the name of the function for which this is a signature
*/
const char *function_name() const;
@@ -999,16 +1028,18 @@ public:
/**
- * IR instruction representing a function call
+ * HIR instruction representing a high-level function call, containing a list
+ * of parameters and returning a value in the supplied temporary.
*/
-class ir_call : public ir_rvalue {
+class ir_call : public ir_instruction {
public:
- ir_call(ir_function_signature *callee, exec_list *actual_parameters)
- : callee(callee)
+ ir_call(ir_function_signature *callee,
+ ir_dereference_variable *return_deref,
+ exec_list *actual_parameters)
+ : return_deref(return_deref), callee(callee)
{
ir_type = ir_type_call;
assert(callee->return_type != NULL);
- type = callee->return_type;
actual_parameters->move_nodes_to(& this->actual_parameters);
this->use_builtin = callee->is_builtin;
}
@@ -1030,13 +1061,6 @@ public:
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
/**
- * Get a generic ir_call object when an error occurs
- *
- * Any allocation will be performed with 'ctx' as ralloc owner.
- */
- static ir_call *get_error_instruction(void *ctx);
-
- /**
* Get an iterator for the set of acutal parameters
*/
exec_list_iterator iterator()
@@ -1053,38 +1077,27 @@ public:
}
/**
- * Get the function signature bound to this function call
+ * Generates an inline version of the function before @ir,
+ * storing the return value in return_deref.
*/
- ir_function_signature *get_callee()
- {
- return callee;
- }
+ void generate_inline(ir_instruction *ir);
/**
- * Set the function call target
+ * Storage for the function's return value.
+ * This must be NULL if the return type is void.
*/
- void set_callee(ir_function_signature *sig);
+ ir_dereference_variable *return_deref;
/**
- * Generates an inline version of the function before @ir,
- * returning the return value of the function.
+ * The specific function signature being called.
*/
- ir_rvalue *generate_inline(ir_instruction *ir);
+ ir_function_signature *callee;
/* List of ir_rvalue of paramaters passed in this call. */
exec_list actual_parameters;
/** Should this call only bind to a built-in function? */
bool use_builtin;
-
-private:
- ir_call()
- : callee(NULL)
- {
- this->ir_type = ir_type_call;
- }
-
- ir_function_signature *callee;
};