#include "main/imports.h"
#include "main/simple_list.h"
#include "ir.h"
+#include "ir_visitor.h"
#include "glsl_types.h"
ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
ir_rvalue *condition)
- : ir_rvalue()
{
this->lhs = lhs;
this->rhs = rhs;
ir_expression::ir_expression(int op, const struct glsl_type *type,
ir_rvalue *op0, ir_rvalue *op1)
- : ir_rvalue()
{
this->type = type;
this->operation = ir_expression_operation(op);
return num_operands[this->operation];
}
-ir_label::ir_label(const char *label)
- : ir_instruction(), label(label)
+ir_label::ir_label(const char *label, ir_function_signature *signature)
+ : label(label), signature(signature)
{
/* empty */
}
ir_constant::ir_constant(const struct glsl_type *type, const void *data)
- : ir_rvalue()
{
unsigned size = 0;
}
ir_constant::ir_constant(float f)
- : ir_rvalue()
{
this->type = glsl_type::float_type;
this->value.f[0] = f;
}
ir_constant::ir_constant(unsigned int u)
- : ir_rvalue()
{
this->type = glsl_type::uint_type;
this->value.u[0] = u;
}
ir_constant::ir_constant(int i)
- : ir_rvalue()
{
this->type = glsl_type::int_type;
this->value.i[0] = i;
}
ir_constant::ir_constant(bool b)
- : ir_rvalue()
{
this->type = glsl_type::bool_type;
this->value.b[0] = b;
ir_dereference::ir_dereference(ir_instruction *var)
- : ir_rvalue()
{
this->mode = ir_reference_variable;
this->var = var;
ir_dereference::ir_dereference(ir_instruction *var,
ir_rvalue *array_index)
- : ir_rvalue(), mode(ir_reference_array),
- var(var)
+ : mode(ir_reference_array), var(var)
{
type = glsl_type::error_type;
if (vt->is_array()) {
type = vt->element_type();
- } else if (vt->is_matrix() || vt->is_vector()) {
+ } else if (vt->is_matrix()) {
+ type = vt->column_type();
+ } else if (vt->is_vector()) {
type = vt->get_base_type();
}
}
{
this->type = type;
this->name = name;
+ this->constant_value = NULL;
if (type && type->base_type == GLSL_TYPE_SAMPLER)
this->read_only = true;
ir_function_signature::ir_function_signature(const glsl_type *return_type)
- : ir_instruction(), return_type(return_type), definition(NULL)
+ : return_type(return_type), definition(NULL)
{
/* empty */
}
ir_function::ir_function(const char *name)
- : ir_instruction(), name(name)
+ : name(name)
{
/* empty */
}
call->type = glsl_type::error_type;
return call;
}
+
+void
+visit_exec_list(exec_list *list, ir_visitor *visitor)
+{
+ foreach_iter(exec_list_iterator, iter, *list) {
+ ((ir_instruction *)iter.get())->accept(visitor);
+ }
+}
+