Lines Matching refs:ir

31  * in the ir tree.  ir_variable does appear multiple times: Once as a
37 #include "ir.h"
61 virtual ir_visitor_status visit(ir_dereference_variable *ir);
62 virtual ir_visitor_status visit(ir_if *ir);
64 virtual ir_visitor_status visit_leave(ir_loop *ir);
65 virtual ir_visitor_status visit_enter(ir_function *ir);
66 virtual ir_visitor_status visit_leave(ir_function *ir);
67 virtual ir_visitor_status visit_enter(ir_function_signature *ir);
69 virtual ir_visitor_status visit_leave(ir_expression *ir);
70 virtual ir_visitor_status visit_leave(ir_swizzle *ir);
72 virtual ir_visitor_status visit_enter(ir_assignment *ir);
74 static void validate_ir(ir_instruction *ir, void *data);
83 ir_validate::visit(ir_dereference_variable *ir)
85 if ((ir->var == NULL) || (ir->var->as_variable() == NULL)) {
87 (void *) ir, (void *) ir->var);
91 if (hash_table_find(ht, ir->var) == NULL) {
94 (void *) ir, ir->var->name, (void *) ir->var);
98 this->validate_ir(ir, this->data);
104 ir_validate::visit(ir_if *ir)
106 if (ir->condition->type != glsl_type::bool_type) {
108 ir->condition->type->name);
109 ir->print();
119 ir_validate::visit_leave(ir_loop *ir)
121 if (ir->counter != NULL) {
122 if ((ir->from == NULL) || (ir->from == NULL) || (ir->increment == NULL)) {
128 (void *) ir->counter, (void *) ir->from, (void *) ir->to,
129 (void *) ir->increment);
133 if ((ir->cmp < ir_binop_less) || (ir->cmp > ir_binop_nequal)) {
134 printf("ir_loop has invalid comparitor %d\n", ir->cmp);
138 if ((ir->from != NULL) || (ir->from != NULL) || (ir->increment != NULL)) {
144 (void *) ir->counter, (void *) ir->from, (void *) ir->to,
145 (void *) ir->increment);
155 ir_validate::visit_enter(ir_function *ir)
163 ir->name, (void *) ir,
172 this->current_function = ir;
174 this->validate_ir(ir, this->data);
180 ir_validate::visit_leave(ir_function *ir)
182 assert(hieralloc_parent(ir->name) == ir);
189 ir_validate::visit_enter(ir_function_signature *ir)
191 if (this->current_function != ir->function()) {
195 (void *) ir,
197 ir->function_name(), (void *) ir->function());
201 this->validate_ir(ir, this->data);
207 ir_validate::visit_leave(ir_expression *ir)
209 switch (ir->operation) {
211 assert(ir->operands[0]->type == ir->type);
214 assert(ir->type->base_type == GLSL_TYPE_BOOL);
215 assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
224 assert(ir->type == ir->operands[0]->type);
231 assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
232 assert(ir->type == ir->operands[0]->type);
236 assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
237 assert(ir->type->base_type == GLSL_TYPE_INT);
240 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
241 assert(ir->type->base_type == GLSL_TYPE_FLOAT);
244 assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
245 assert(ir->type->base_type == GLSL_TYPE_BOOL);
248 assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
249 assert(ir->type->base_type == GLSL_TYPE_FLOAT);
252 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
253 assert(ir->type->base_type == GLSL_TYPE_BOOL);
256 assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
257 assert(ir->type->base_type == GLSL_TYPE_INT);
260 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
261 assert(ir->type->base_type == GLSL_TYPE_FLOAT);
265 assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
266 assert(ir->type == glsl_type::bool_type);
280 assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
281 assert(ir->operands[0]->type == ir->type);
296 if (ir->operands[0]->type->is_scalar())
297 assert(ir->operands[1]->type == ir->type);
298 else if (ir->operands[1]->type->is_scalar())
299 assert(ir->operands[0]->type == ir->type);
300 else if (ir->operands[0]->type->is_vector() &&
301 ir->operands[1]->type->is_vector()) {
302 assert(ir->operands[0]->type == ir->operands[1]->type);
303 assert(ir->operands[0]->type == ir->type);
318 assert(ir->type->base_type == GLSL_TYPE_BOOL);
319 assert(ir->operands[0]->type == ir->operands[1]->type);
320 assert(ir->operands[0]->type->is_vector()
321 || ir->operands[0]->type->is_scalar());
322 assert(ir->operands[0]->type->vector_elements
323 == ir->type->vector_elements);
331 assert(ir->type == glsl_type::bool_type);
332 assert(ir->operands[0]->type == ir->operands[1]->type);
337 assert(ir->operands[0]->type->is_integer() &&
338 ir->operands[1]->type->is_integer());
339 if (ir->operands[0]->type->is_scalar()) {
340 assert(ir->operands[1]->type->is_scalar());
342 if (ir->operands[0]->type->is_vector() &&
343 ir->operands[1]->type->is_vector()) {
344 assert(ir->operands[0]->type->components() ==
345 ir->operands[1]->type->components());
347 assert(ir->type == ir->operands[0]->type);
353 assert(ir->operands[0]->type->base_type ==
354 ir->operands[1]->type->base_type);
355 assert(ir->type->is_integer());
356 if (ir->operands[0]->type->is_vector() &&
357 ir->operands[1]->type->is_vector()) {
358 assert(ir->operands[0]->type->vector_elements ==
359 ir->operands[1]->type->vector_elements);
366 assert(ir->type == glsl_type::bool_type);
367 assert(ir->operands[0]->type == glsl_type::bool_type);
368 assert(ir->operands[1]->type == glsl_type::bool_type);
372 assert(ir->type == glsl_type::float_type);
373 assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
374 assert(ir->operands[0]->type->is_vector());
375 assert(ir->operands[0]->type == ir->operands[1]->type);
386 assert(ir->type->is_vector());
387 switch (ir->type->vector_elements) {
389 assert(ir->operands[0]->type->is_scalar());
390 assert(ir->operands[0]->type->base_type == ir->type->base_type);
391 assert(ir->operands[1]->type->is_scalar());
392 assert(ir->operands[1]->type->base_type == ir->type->base_type);
393 assert(ir->operands[2] == NULL);
394 assert(ir->operands[3] == NULL);
397 assert(ir->operands[0]->type->is_scalar());
398 assert(ir->operands[0]->type->base_type == ir->type->base_type);
399 assert(ir->operands[1]->type->is_scalar());
400 assert(ir->operands[1]->type->base_type == ir->type->base_type);
401 assert(ir->operands[2]->type->is_scalar());
402 assert(ir->operands[2]->type->base_type == ir->type->base_type);
403 assert(ir->operands[3] == NULL);
406 assert(ir->operands[0]->type->is_scalar());
407 assert(ir->operands[0]->type->base_type == ir->type->base_type);
408 assert(ir->operands[1]->type->is_scalar());
409 assert(ir->operands[1]->type->base_type == ir->type->base_type);
410 assert(ir->operands[2]->type->is_scalar());
411 assert(ir->operands[2]->type->base_type == ir->type->base_type);
412 assert(ir->operands[3]->type->is_scalar());
413 assert(ir->operands[3]->type->base_type == ir->type->base_type);
428 ir_validate::visit_leave(ir_swizzle *ir)
430 int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w};
432 for (unsigned int i = 0; i < ir->type->vector_elements; i++) {
433 if (chans[i] >= ir->val->type->vector_elements) {
435 "in the value.\n", (void *) ir);
436 ir->print();
445 ir_validate::visit(ir_variable *ir)
452 if (ir->name)
453 assert(hieralloc_parent(ir->name) == ir);
455 hash_table_insert(ht, ir, ir);
460 ir_validate::visit_enter(ir_assignment *ir)
462 const ir_dereference *const lhs = ir->lhs;
464 if (ir->write_mask == 0) {
467 ir->print();
473 if (ir->write_mask & (1 << i))
477 if (lhs_components != ir->rhs->type->vector_elements) {
480 lhs_components, ir->rhs->type->vector_elements);
481 ir->print();
486 this->validate_ir(ir, this->data);
492 ir_validate::validate_ir(ir_instruction *ir, void *data)
496 if (hash_table_find(ht, ir)) {
497 printf("Instruction node present twice in ir tree:\n");
498 ir->print();
502 hash_table_insert(ht, ir, ir);
506 check_node_type(ir_instruction *ir, void *data)
510 if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) {
512 ir->print(); printf("\n");
514 assert(ir->type != glsl_type::error_type);
525 ir_instruction *ir = (ir_instruction *)iter.get();
527 visit_tree(ir, check_node_type, NULL);