aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp4
-rw-r--r--src/compiler/glsl/ir.cpp22
-rw-r--r--src/compiler/glsl/ir.h13
-rw-r--r--src/compiler/glsl/ir_builder_print_visitor.cpp8
-rw-r--r--src/compiler/glsl/ir_clone.cpp2
-rw-r--r--src/compiler/glsl/ir_constant_expression.cpp2
-rw-r--r--src/compiler/glsl/ir_equals.cpp2
-rw-r--r--src/compiler/glsl/ir_hv_accept.cpp2
-rw-r--r--src/compiler/glsl/ir_print_visitor.cpp2
-rw-r--r--src/compiler/glsl/ir_rvalue_visitor.cpp2
-rw-r--r--src/compiler/glsl/ir_validate.cpp8
-rw-r--r--src/compiler/glsl/lower_instructions.cpp32
-rw-r--r--src/compiler/glsl/lower_int64.cpp4
-rw-r--r--src/compiler/glsl/lower_mat_op_to_vec.cpp8
-rw-r--r--src/compiler/glsl/lower_ubo_reference.cpp2
-rw-r--r--src/compiler/glsl/lower_vec_index_to_cond_assign.cpp2
-rw-r--r--src/compiler/glsl/lower_vector.cpp2
-rw-r--r--src/compiler/glsl/opt_algebraic.cpp4
-rw-r--r--src/compiler/glsl/opt_constant_folding.cpp2
-rw-r--r--src/compiler/glsl/opt_tree_grafting.cpp2
20 files changed, 98 insertions, 27 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 331438a1835..e5166855e81 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1494,11 +1494,11 @@ nir_visitor::visit(ir_expression *ir)
}
nir_ssa_def *srcs[4];
- for (unsigned i = 0; i < ir->get_num_operands(); i++)
+ for (unsigned i = 0; i < ir->num_operands; i++)
srcs[i] = evaluate_rvalue(ir->operands[i]);
glsl_base_type types[4];
- for (unsigned i = 0; i < ir->get_num_operands(); i++)
+ for (unsigned i = 0; i < ir->num_operands; i++)
if (supports_ints)
types[i] = ir->operands[i]->type->base_type;
else
diff --git a/src/compiler/glsl/ir.cpp b/src/compiler/glsl/ir.cpp
index 78889bd6d3f..51b875058b1 100644
--- a/src/compiler/glsl/ir.cpp
+++ b/src/compiler/glsl/ir.cpp
@@ -203,11 +203,16 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
this->operands[1] = op1;
this->operands[2] = op2;
this->operands[3] = op3;
+ init_num_operands();
+
#ifndef NDEBUG
- int num_operands = get_num_operands(this->operation);
- for (int i = num_operands; i < 4; i++) {
+ for (unsigned i = num_operands; i < 4; i++) {
assert(this->operands[i] == NULL);
}
+
+ for (unsigned i = 0; i < num_operands; i++) {
+ assert(this->operands[i] != NULL);
+ }
#endif
}
@@ -221,6 +226,9 @@ ir_expression::ir_expression(int op, ir_rvalue *op0)
this->operands[3] = NULL;
assert(op <= ir_last_unop);
+ init_num_operands();
+ assert(num_operands == 1);
+ assert(this->operands[0]);
switch (this->operation) {
case ir_unop_bit_not:
@@ -425,6 +433,11 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
this->operands[3] = NULL;
assert(op > ir_last_unop);
+ init_num_operands();
+ assert(num_operands == 2);
+ for (unsigned i = 0; i < num_operands; i++) {
+ assert(this->operands[i] != NULL);
+ }
switch (this->operation) {
case ir_binop_all_equal:
@@ -519,6 +532,11 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
this->operands[3] = NULL;
assert(op > ir_last_binop && op <= ir_last_triop);
+ init_num_operands();
+ assert(num_operands == 3);
+ for (unsigned i = 0; i < num_operands; i++) {
+ assert(this->operands[i] != NULL);
+ }
switch (this->operation) {
case ir_triop_fma:
diff --git a/src/compiler/glsl/ir.h b/src/compiler/glsl/ir.h
index 840c06e10ac..58e6356566f 100644
--- a/src/compiler/glsl/ir.h
+++ b/src/compiler/glsl/ir.h
@@ -1579,8 +1579,21 @@ public:
virtual ir_variable *variable_referenced() const;
+ /**
+ * Determine the number of operands used by an expression
+ */
+ void init_num_operands()
+ {
+ if (operation == ir_quadop_vector) {
+ num_operands = this->type->vector_elements;
+ } else {
+ num_operands = get_num_operands(operation);
+ }
+ }
+
ir_expression_operation operation;
ir_rvalue *operands[4];
+ uint8_t num_operands;
};
diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index 02f15e74ee5..3e30c5d7af3 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -117,7 +117,7 @@ is_simple_operand(const ir_rvalue *ir, unsigned depth = 1)
case ir_type_expression: {
const ir_expression *expr = (ir_expression *) ir;
- for (unsigned i = 0; i < expr->get_num_operands(); i++) {
+ for (unsigned i = 0; i < expr->num_operands; i++) {
if (!is_simple_operand(expr->operands[i], depth - 1))
return false;
}
@@ -485,7 +485,7 @@ ir_builder_print_visitor::visit_enter(ir_assignment *ir)
return visit_continue;
if (rhs_expr != NULL) {
- const unsigned num_op = rhs_expr->get_num_operands();
+ const unsigned num_op = rhs_expr->num_operands;
for (unsigned i = 0; i < num_op; i++) {
if (is_simple_operand(rhs_expr->operands[i]))
@@ -538,7 +538,7 @@ ir_builder_print_visitor::visit_leave(ir_assignment *ir)
void
ir_builder_print_visitor::print_without_declaration(const ir_expression *ir)
{
- const unsigned num_op = ir->get_num_operands();
+ const unsigned num_op = ir->num_operands;
static const char *const arity[] = {
"", "unop", "binop", "triop", "quadop"
@@ -594,7 +594,7 @@ ir_builder_print_visitor::print_without_declaration(const ir_expression *ir)
ir_visitor_status
ir_builder_print_visitor::visit_enter(ir_expression *ir)
{
- const unsigned num_op = ir->get_num_operands();
+ const unsigned num_op = ir->num_operands;
for (unsigned i = 0; i < num_op; i++) {
if (is_simple_operand(ir->operands[i]))
diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp
index a64c7afa944..941e0865cb5 100644
--- a/src/compiler/glsl/ir_clone.cpp
+++ b/src/compiler/glsl/ir_clone.cpp
@@ -160,7 +160,7 @@ ir_expression::clone(void *mem_ctx, struct hash_table *ht) const
ir_rvalue *op[ARRAY_SIZE(this->operands)] = { NULL, };
unsigned int i;
- for (i = 0; i < get_num_operands(); i++) {
+ for (i = 0; i < num_operands; i++) {
op[i] = this->operands[i]->clone(mem_ctx, ht);
}
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index cd3cd1bb592..d4a8b7d020c 100644
--- a/src/compiler/glsl/ir_constant_expression.cpp
+++ b/src/compiler/glsl/ir_constant_expression.cpp
@@ -638,7 +638,7 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
memset(&data, 0, sizeof(data));
- for (unsigned operand = 0; operand < this->get_num_operands(); operand++) {
+ for (unsigned operand = 0; operand < this->num_operands; operand++) {
op[operand] = this->operands[operand]->constant_expression_value(variable_context);
if (!op[operand])
return NULL;
diff --git a/src/compiler/glsl/ir_equals.cpp b/src/compiler/glsl/ir_equals.cpp
index 81980eb50a7..f7359e23904 100644
--- a/src/compiler/glsl/ir_equals.cpp
+++ b/src/compiler/glsl/ir_equals.cpp
@@ -202,7 +202,7 @@ ir_expression::equals(const ir_instruction *ir, enum ir_node_type ignore) const
if (operation != other->operation)
return false;
- for (unsigned i = 0; i < get_num_operands(); i++) {
+ for (unsigned i = 0; i < num_operands; i++) {
if (!operands[i]->equals(other->operands[i], ignore))
return false;
}
diff --git a/src/compiler/glsl/ir_hv_accept.cpp b/src/compiler/glsl/ir_hv_accept.cpp
index 7bbc2163d30..bf3f3d4f042 100644
--- a/src/compiler/glsl/ir_hv_accept.cpp
+++ b/src/compiler/glsl/ir_hv_accept.cpp
@@ -137,7 +137,7 @@ ir_expression::accept(ir_hierarchical_visitor *v)
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
- for (unsigned i = 0; i < this->get_num_operands(); i++) {
+ for (unsigned i = 0; i < this->num_operands; i++) {
switch (this->operands[i]->accept(v)) {
case visit_continue:
break;
diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
index 86ddea68861..a32a4109190 100644
--- a/src/compiler/glsl/ir_print_visitor.cpp
+++ b/src/compiler/glsl/ir_print_visitor.cpp
@@ -291,7 +291,7 @@ void ir_print_visitor::visit(ir_expression *ir)
fprintf(f, " %s ", ir_expression_operation_strings[ir->operation]);
- for (unsigned i = 0; i < ir->get_num_operands(); i++) {
+ for (unsigned i = 0; i < ir->num_operands; i++) {
ir->operands[i]->accept(this);
}
diff --git a/src/compiler/glsl/ir_rvalue_visitor.cpp b/src/compiler/glsl/ir_rvalue_visitor.cpp
index d052606f4db..72dd6201ec9 100644
--- a/src/compiler/glsl/ir_rvalue_visitor.cpp
+++ b/src/compiler/glsl/ir_rvalue_visitor.cpp
@@ -39,7 +39,7 @@ ir_rvalue_base_visitor::rvalue_visit(ir_expression *ir)
{
unsigned int operand;
- for (operand = 0; operand < ir->get_num_operands(); operand++) {
+ for (operand = 0; operand < ir->num_operands; operand++) {
handle_rvalue(&ir->operands[operand]);
}
diff --git a/src/compiler/glsl/ir_validate.cpp b/src/compiler/glsl/ir_validate.cpp
index 6e2f3e5b50d..397cd080b19 100644
--- a/src/compiler/glsl/ir_validate.cpp
+++ b/src/compiler/glsl/ir_validate.cpp
@@ -236,6 +236,14 @@ ir_validate::visit_enter(ir_function_signature *ir)
ir_visitor_status
ir_validate::visit_leave(ir_expression *ir)
{
+ for (unsigned i = ir->num_operands; i < 4; i++) {
+ assert(ir->operands[i] == NULL);
+ }
+
+ for (unsigned i = 0; i < ir->num_operands; i++) {
+ assert(ir->operands[i] != NULL);
+ }
+
switch (ir->operation) {
case ir_unop_bit_not:
assert(ir->operands[0]->type == ir->type);
diff --git a/src/compiler/glsl/lower_instructions.cpp b/src/compiler/glsl/lower_instructions.cpp
index 697bb84344e..dfce900a16b 100644
--- a/src/compiler/glsl/lower_instructions.cpp
+++ b/src/compiler/glsl/lower_instructions.cpp
@@ -193,6 +193,7 @@ void
lower_instructions_visitor::sub_to_add_neg(ir_expression *ir)
{
ir->operation = ir_binop_add;
+ ir->init_num_operands();
ir->operands[1] = new(ir) ir_expression(ir_unop_neg, ir->operands[1]->type,
ir->operands[1], NULL);
this->progress = true;
@@ -211,6 +212,7 @@ lower_instructions_visitor::div_to_mul_rcp(ir_expression *ir)
/* op0 / op1 -> op0 * (1.0 / op1) */
ir->operation = ir_binop_mul;
+ ir->init_num_operands();
ir->operands[1] = expr;
this->progress = true;
@@ -261,6 +263,7 @@ lower_instructions_visitor::int_div_to_mul_rcp(ir_expression *ir)
ir->operation = ir_unop_i2u;
ir->operands[0] = new(ir) ir_expression(ir_unop_f2i, op0);
}
+ ir->init_num_operands();
ir->operands[1] = NULL;
this->progress = true;
@@ -272,6 +275,7 @@ lower_instructions_visitor::exp_to_exp2(ir_expression *ir)
ir_constant *log2_e = new(ir) ir_constant(float(M_LOG2E));
ir->operation = ir_unop_exp2;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_expression(ir_binop_mul, ir->operands[0]->type,
ir->operands[0], log2_e);
this->progress = true;
@@ -285,6 +289,7 @@ lower_instructions_visitor::pow_to_exp2(ir_expression *ir)
ir->operands[0]);
ir->operation = ir_unop_exp2;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_expression(ir_binop_mul, ir->operands[1]->type,
ir->operands[1], log2_x);
ir->operands[1] = NULL;
@@ -295,6 +300,7 @@ void
lower_instructions_visitor::log_to_log2(ir_expression *ir)
{
ir->operation = ir_binop_mul;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_expression(ir_unop_log2, ir->operands[0]->type,
ir->operands[0], NULL);
ir->operands[1] = new(ir) ir_constant(float(1.0 / M_LOG2E));
@@ -345,6 +351,7 @@ lower_instructions_visitor::mod_to_floor(ir_expression *ir)
floor_expr);
ir->operation = ir_binop_sub;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_dereference_variable(x);
ir->operands[1] = mul_expr;
this->progress = true;
@@ -465,12 +472,14 @@ lower_instructions_visitor::ldexp_to_arith(ir_expression *ir)
if (!lowering(INSERT_TO_SHIFTS)) {
ir_constant *exp_width = new(ir) ir_constant(8, vec_elem);
ir->operation = ir_unop_bitcast_i2f;
+ ir->init_num_operands();
ir->operands[0] = bitfield_insert(bitcast_f2i(x), resulting_biased_exp,
exp_shift_clone, exp_width);
ir->operands[1] = NULL;
} else {
ir_constant *sign_mantissa_mask = new(ir) ir_constant(0x807fffffu, vec_elem);
ir->operation = ir_unop_bitcast_u2f;
+ ir->init_num_operands();
ir->operands[0] = bit_or(bit_and(bitcast_f2u(x), sign_mantissa_mask),
lshift(i2u(resulting_biased_exp), exp_shift_clone));
}
@@ -595,6 +604,7 @@ lower_instructions_visitor::dldexp_to_arith(ir_expression *ir)
}
ir->operation = ir_quadop_vector;
+ ir->init_num_operands();
ir->operands[0] = results[0];
ir->operands[1] = results[1];
ir->operands[2] = results[2];
@@ -671,6 +681,7 @@ lower_instructions_visitor::dfrexp_sig_to_arith(ir_expression *ir)
/* Put the dvec back together */
ir->operation = ir_quadop_vector;
+ ir->init_num_operands();
ir->operands[0] = results[0];
ir->operands[1] = results[1];
ir->operands[2] = results[2];
@@ -724,6 +735,7 @@ lower_instructions_visitor::dfrexp_exp_to_arith(ir_expression *ir)
/* For non-zero inputs, shift the exponent down and apply bias. */
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_dereference_variable(is_not_zero);
ir->operands[1] = add(exponent_bias, u2i(rshift(high_words, exponent_shift)));
ir->operands[2] = izero;
@@ -744,6 +756,7 @@ lower_instructions_visitor::carry_to_arith(ir_expression *ir)
ir_rvalue *x_clone = ir->operands[0]->clone(ir, NULL);
ir->operation = ir_unop_i2u;
+ ir->init_num_operands();
ir->operands[0] = b2i(less(add(ir->operands[0], ir->operands[1]), x_clone));
ir->operands[1] = NULL;
@@ -761,6 +774,7 @@ lower_instructions_visitor::borrow_to_arith(ir_expression *ir)
*/
ir->operation = ir_unop_i2u;
+ ir->init_num_operands();
ir->operands[0] = b2i(less(ir->operands[0], ir->operands[1]));
ir->operands[1] = NULL;
@@ -777,6 +791,7 @@ lower_instructions_visitor::sat_to_clamp(ir_expression *ir)
*/
ir->operation = ir_binop_min;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_expression(ir_binop_max, ir->operands[0]->type,
ir->operands[0],
new(ir) ir_constant(0.0f));
@@ -807,6 +822,7 @@ lower_instructions_visitor::double_dot_to_fma(ir_expression *ir)
}
ir->operation = ir_triop_fma;
+ ir->init_num_operands();
ir->operands[0] = swizzle(ir->operands[0], 0, 1);
ir->operands[1] = swizzle(ir->operands[1], 0, 1);
ir->operands[2] = new(ir) ir_dereference_variable(temp);
@@ -833,6 +849,7 @@ lower_instructions_visitor::double_lrp(ir_expression *ir)
}
ir->operation = ir_triop_fma;
+ ir->init_num_operands();
ir->operands[0] = swizzle(op2, swizval, op0->type->vector_elements);
ir->operands[2] = mul(sub(one, op2->clone(ir, NULL)), op0);
@@ -857,6 +874,7 @@ lower_instructions_visitor::dceil_to_dfrac(ir_expression *ir)
i.insert_before(assign(frtemp, fract(ir->operands[0])));
ir->operation = ir_binop_add;
+ ir->init_num_operands();
ir->operands[0] = sub(ir->operands[0]->clone(ir, NULL), frtemp);
ir->operands[1] = csel(nequal(frtemp, zero), one, zero->clone(ir, NULL));
@@ -871,6 +889,7 @@ lower_instructions_visitor::dfloor_to_dfrac(ir_expression *ir)
* result = sub(x, frtemp);
*/
ir->operation = ir_binop_sub;
+ ir->init_num_operands();
ir->operands[1] = fract(ir->operands[0]->clone(ir, NULL));
this->progress = true;
@@ -910,6 +929,7 @@ lower_instructions_visitor::dround_even_to_dfrac(ir_expression *ir)
i.insert_before(assign(t2, sub(temp, frtemp)));
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = equal(fract(ir->operands[0]->clone(ir, NULL)),
p5->clone(ir, NULL));
ir->operands[1] = csel(equal(fract(mul(t2, p5->clone(ir, NULL))),
@@ -945,6 +965,7 @@ lower_instructions_visitor::dtrunc_to_dfrac(ir_expression *ir)
i.insert_before(assign(temp, sub(arg->clone(ir, NULL), frtemp)));
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = gequal(arg->clone(ir, NULL), zero);
ir->operands[1] = new (ir) ir_dereference_variable(temp);
ir->operands[2] = add(temp,
@@ -968,6 +989,7 @@ lower_instructions_visitor::dsign_to_csel(ir_expression *ir)
ir_constant *neg_one = new(ir) ir_constant(-1.0, arg->type->vector_elements);
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = less(arg->clone(ir, NULL),
zero->clone(ir, NULL));
ir->operands[1] = neg_one;
@@ -1017,6 +1039,7 @@ lower_instructions_visitor::bit_count_to_math(ir_expression *ir)
/* int(((temp + (temp >> 4) & 0xF0F0F0Fu) * 0x1010101u) >> 24); */
ir->operation = ir_unop_u2i;
+ ir->init_num_operands();
ir->operands[0] = rshift(mul(bit_and(add(temp, rshift(temp, c4)), c0F0F0F0F),
c01010101),
c24);
@@ -1060,6 +1083,7 @@ lower_instructions_visitor::extract_to_shifts(ir_expression *ir)
* (value >> offset) & mask;
*/
ir->operation = ir_binop_bit_and;
+ ir->init_num_operands();
ir->operands[0] = rshift(ir->operands[0], ir->operands[1]);
ir->operands[1] = mask;
ir->operands[2] = NULL;
@@ -1090,6 +1114,7 @@ lower_instructions_visitor::extract_to_shifts(ir_expression *ir)
* (bits == 0) ? 0 : e;
*/
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = equal(c0, bits);
ir->operands[1] = c0->clone(ir, NULL);
ir->operands[2] = expr;
@@ -1156,6 +1181,7 @@ lower_instructions_visitor::insert_to_shifts(ir_expression *ir)
/* (base & ~mask) | ((insert << offset) & mask) */
ir->operation = ir_binop_bit_or;
+ ir->init_num_operands();
ir->operands[0] = bit_and(ir->operands[0], bit_not(mask));
ir->operands[1] = bit_and(lshift(ir->operands[1], offset), mask);
ir->operands[2] = NULL;
@@ -1239,10 +1265,12 @@ lower_instructions_visitor::reverse_to_shifts(ir_expression *ir)
if (ir->operands[0]->type->base_type == GLSL_TYPE_UINT) {
ir->operation = ir_binop_bit_or;
+ ir->init_num_operands();
ir->operands[0] = rshift(temp, c16);
ir->operands[1] = lshift(temp, c16->clone(ir, NULL));
} else {
ir->operation = ir_unop_u2i;
+ ir->init_num_operands();
ir->operands[0] = bit_or(rshift(temp, c16),
lshift(temp, c16->clone(ir, NULL)));
}
@@ -1323,6 +1351,7 @@ lower_instructions_visitor::find_lsb_to_float_cast(ir_expression *ir)
* small.
*/
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = equal(lsb_only, c0);
ir->operands[1] = cminus1;
ir->operands[2] = new(ir) ir_dereference_variable(lsb);
@@ -1423,6 +1452,7 @@ lower_instructions_visitor::find_msb_to_float_cast(ir_expression *ir)
* be negative. It will only be negative (-0x7f, in fact) if temp is 0.
*/
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = less(msb, c0);
ir->operands[1] = cminus1;
ir->operands[2] = new(ir) ir_dereference_variable(msb);
@@ -1555,6 +1585,7 @@ lower_instructions_visitor::imul_high_to_mul(ir_expression *ir)
assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
ir->operation = ir_binop_add;
+ ir->init_num_operands();
ir->operands[0] = add(hi, rshift(t1, c16->clone(ir, NULL)));
ir->operands[1] = rshift(t2, c16->clone(ir, NULL));
} else {
@@ -1577,6 +1608,7 @@ lower_instructions_visitor::imul_high_to_mul(ir_expression *ir)
u2i(_carry(bit_not(lo), c1)))));
ir->operation = ir_triop_csel;
+ ir->init_num_operands();
ir->operands[0] = new(ir) ir_dereference_variable(different_signs);
ir->operands[1] = new(ir) ir_dereference_variable(neg_hi);
ir->operands[2] = u2i(hi);
diff --git a/src/compiler/glsl/lower_int64.cpp b/src/compiler/glsl/lower_int64.cpp
index 9770d314af6..b6bf9cee7d3 100644
--- a/src/compiler/glsl/lower_int64.cpp
+++ b/src/compiler/glsl/lower_int64.cpp
@@ -258,7 +258,7 @@ lower_64bit::lower_op_to_function_call(ir_instruction *base_ir,
ir_expression *ir,
ir_function_signature *callee)
{
- const unsigned num_operands = ir->get_num_operands();
+ const unsigned num_operands = ir->num_operands;
ir_variable *src[4][4];
ir_variable *dst[4];
void *const mem_ctx = ralloc_parent(ir);
@@ -319,7 +319,7 @@ lower_64bit_visitor::handle_op(ir_expression *ir,
const char *function_name,
function_generator generator)
{
- for (unsigned i = 0; i < ir->get_num_operands(); i++)
+ for (unsigned i = 0; i < ir->num_operands; i++)
if (!ir->operands[i]->type->is_integer_64())
return ir;
diff --git a/src/compiler/glsl/lower_mat_op_to_vec.cpp b/src/compiler/glsl/lower_mat_op_to_vec.cpp
index 9a27029de31..88c5d6679d2 100644
--- a/src/compiler/glsl/lower_mat_op_to_vec.cpp
+++ b/src/compiler/glsl/lower_mat_op_to_vec.cpp
@@ -76,7 +76,7 @@ mat_op_to_vec_predicate(ir_instruction *ir)
if (!expr)
return false;
- for (i = 0; i < expr->get_num_operands(); i++) {
+ for (i = 0; i < expr->num_operands; i++) {
if (expr->operands[i]->type->is_matrix())
return true;
}
@@ -294,7 +294,7 @@ ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_dereference *result,
static bool
has_matrix_operand(const ir_expression *expr, unsigned &columns)
{
- for (unsigned i = 0; i < expr->get_num_operands(); i++) {
+ for (unsigned i = 0; i < expr->num_operands; i++) {
if (expr->operands[i]->type->is_matrix()) {
columns = expr->operands[i]->type->matrix_columns;
return true;
@@ -318,7 +318,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign)
if (!has_matrix_operand(orig_expr, matrix_columns))
return visit_continue;
- assert(orig_expr->get_num_operands() <= 2);
+ assert(orig_expr->num_operands <= 2);
mem_ctx = ralloc_parent(orig_assign);
@@ -329,7 +329,7 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign)
/* Store the expression operands in temps so we can use them
* multiple times.
*/
- for (i = 0; i < orig_expr->get_num_operands(); i++) {
+ for (i = 0; i < orig_expr->num_operands; i++) {
ir_assignment *assign;
ir_dereference *deref = orig_expr->operands[i]->as_dereference();
diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp
index 163c25e706a..a63d80c1394 100644
--- a/src/compiler/glsl/lower_ubo_reference.cpp
+++ b/src/compiler/glsl/lower_ubo_reference.cpp
@@ -627,7 +627,7 @@ lower_ubo_reference_visitor::check_ssbo_unsized_array_length_expression(ir_expre
return;
}
- for (unsigned i = 0; i < ir->get_num_operands(); i++) {
+ for (unsigned i = 0; i < ir->num_operands; i++) {
if (ir->operands[i]->ir_type != ir_type_expression)
continue;
ir_expression *expr = (ir_expression *) ir->operands[i];
diff --git a/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp b/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
index 784db085924..ea8b5922ceb 100644
--- a/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_vec_index_to_cond_assign.cpp
@@ -165,7 +165,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_expression *ir)
{
unsigned int i;
- for (i = 0; i < ir->get_num_operands(); i++) {
+ for (i = 0; i < ir->num_operands; i++) {
ir->operands[i] = convert_vector_extract_to_cond_assign(ir->operands[i]);
}
diff --git a/src/compiler/glsl/lower_vector.cpp b/src/compiler/glsl/lower_vector.cpp
index a658410ae6f..72192b1b258 100644
--- a/src/compiler/glsl/lower_vector.cpp
+++ b/src/compiler/glsl/lower_vector.cpp
@@ -133,7 +133,7 @@ lower_vector_visitor::handle_rvalue(ir_rvalue **rvalue)
*/
void *const mem_ctx = expr;
- assert(expr->type->vector_elements == expr->get_num_operands());
+ assert(expr->type->vector_elements == expr->num_operands);
/* Generate a temporary with the same type as the ir_quadop_operation.
*/
diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp
index b44ab595ecb..382b4617d1b 100644
--- a/src/compiler/glsl/opt_algebraic.cpp
+++ b/src/compiler/glsl/opt_algebraic.cpp
@@ -328,8 +328,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
}
- assert(ir->get_num_operands() <= 4);
- for (unsigned i = 0; i < ir->get_num_operands(); i++) {
+ assert(ir->num_operands <= 4);
+ for (unsigned i = 0; i < ir->num_operands; i++) {
if (ir->operands[i]->type->is_matrix())
return ir;
diff --git a/src/compiler/glsl/opt_constant_folding.cpp b/src/compiler/glsl/opt_constant_folding.cpp
index 97dcc7e1acb..e72aec78f68 100644
--- a/src/compiler/glsl/opt_constant_folding.cpp
+++ b/src/compiler/glsl/opt_constant_folding.cpp
@@ -74,7 +74,7 @@ ir_constant_fold(ir_rvalue **rvalue)
*/
ir_expression *expr = (*rvalue)->as_expression();
if (expr) {
- for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
+ for (unsigned int i = 0; i < expr->num_operands; i++) {
if (!expr->operands[i]->as_constant())
return false;
}
diff --git a/src/compiler/glsl/opt_tree_grafting.cpp b/src/compiler/glsl/opt_tree_grafting.cpp
index b0a16041918..6b5d93af661 100644
--- a/src/compiler/glsl/opt_tree_grafting.cpp
+++ b/src/compiler/glsl/opt_tree_grafting.cpp
@@ -232,7 +232,7 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir)
ir_visitor_status
ir_tree_grafting_visitor::visit_enter(ir_expression *ir)
{
- for (unsigned int i = 0; i < ir->get_num_operands(); i++) {
+ for (unsigned int i = 0; i < ir->num_operands; i++) {
if (do_graft(&ir->operands[i]))
return visit_stop;
}