This may grow in the near future.
*/
#include <string.h>
+#include "main/compiler.h"
#include "ir.h"
#include "glsl_types.h"
extern "C" {
ir_expression *
ir_expression::clone(void *mem_ctx, struct hash_table *ht) const
{
- ir_rvalue *op[2] = {NULL, NULL};
+ ir_rvalue *op[Elements(this->operands)] = { NULL, };
unsigned int i;
for (i = 0; i < get_num_operands(); i++) {
if (this->type->is_error())
return NULL;
- ir_constant *op[2] = { NULL, NULL };
+ ir_constant *op[Elements(this->operands)] = { NULL, };
ir_constant_data data;
memset(&data, 0, sizeof(data));
printf(" %s ", ir->operator_string());
- if (ir->operands[0])
- ir->operands[0]->accept(this);
+ for (unsigned i = 0; i < ir->get_num_operands(); i++) {
+ ir->operands[i]->accept(this);
+ }
- if (ir->operands[1])
- ir->operands[1]->accept(this);
printf(") ");
}
if (!has_matrix_operand(orig_expr, matrix_columns))
return visit_continue;
+ assert(orig_expr->get_num_operands() <= 2);
+
mem_ctx = talloc_parent(orig_assign);
ir_dereference_variable *lhs_deref =
ir_expression *temp;
unsigned int i;
+ assert(ir->get_num_operands() <= 2);
for (i = 0; i < ir->get_num_operands(); i++) {
if (ir->operands[i]->type->is_matrix())
return ir;
fs_reg op[2], temp;
fs_inst *inst;
+ assert(ir->get_num_operands() <= 2);
for (operand = 0; operand < ir->get_num_operands(); operand++) {
ir->operands[operand]->accept(this);
if (this->result.file == BAD_FILE) {
fs_reg op[2];
fs_inst *inst;
+ assert(expr->get_num_operands() <= 2);
for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
assert(expr->operands[i]->type->is_scalar());
fs_inst *inst;
fs_reg temp;
+ assert(expr->get_num_operands() <= 2);
for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
assert(expr->operands[i]->type->is_scalar());
ir_to_mesa_visitor::visit(ir_expression *ir)
{
unsigned int operand;
- struct ir_to_mesa_src_reg op[2];
+ struct ir_to_mesa_src_reg op[Elements(ir->operands)];
struct ir_to_mesa_src_reg result_src;
struct ir_to_mesa_dst_reg result_dst;