Lines Matching refs:ir
31 * in the ir tree. ir_variable does appear multiple times: Once as a
36 #include "ir.h"
63 virtual ir_visitor_status visit(ir_dereference_variable *ir);
65 virtual ir_visitor_status visit_enter(ir_discard *ir);
66 virtual ir_visitor_status visit_enter(ir_if *ir);
68 virtual ir_visitor_status visit_enter(ir_function *ir);
69 virtual ir_visitor_status visit_leave(ir_function *ir);
70 virtual ir_visitor_status visit_enter(ir_function_signature *ir);
72 virtual ir_visitor_status visit_leave(ir_expression *ir);
73 virtual ir_visitor_status visit_leave(ir_swizzle *ir);
77 virtual ir_visitor_status visit_enter(ir_assignment *ir);
78 virtual ir_visitor_status visit_enter(ir_call *ir);
80 static void validate_ir(ir_instruction *ir, void *data);
90 ir_validate::visit(ir_dereference_variable *ir)
92 if ((ir->var == NULL) || (ir->var->as_variable() == NULL)) {
94 (void *) ir, (void *) ir->var);
98 if (_mesa_set_search(ir_set, ir->var) == NULL) {
101 (void *) ir, ir->var->name, (void *) ir->var);
105 this->validate_ir(ir, this->data_enter);
111 ir_validate::visit_enter(class ir_dereference_array *ir)
113 if (!ir->array->type->is_array() && !ir->array->type->is_matrix() &&
114 !ir->array->type->is_vector()) {
117 (void *) ir);
118 ir->print();
123 if (!ir->array_index->type->is_scalar()) {
125 (void *) ir, ir->array_index->type->name);
129 if (!ir->array_index->type->is_integer()) {
131 (void *) ir, ir->array_index->type->name);
139 ir_validate::visit_enter(ir_discard *ir)
141 if (ir->condition && ir->condition->type != glsl_type::bool_type) {
143 ir->condition->type->name);
144 ir->print();
153 ir_validate::visit_enter(ir_if *ir)
155 if (ir->condition->type != glsl_type::bool_type) {
157 ir->condition->type->name);
158 ir->print();
168 ir_validate::visit_enter(ir_function *ir)
176 ir->name, (void *) ir,
185 this->current_function = ir;
187 this->validate_ir(ir, this->data_enter);
192 foreach_in_list(ir_instruction, sig, &ir->signatures) {
195 ir->name);
204 ir_validate::visit_leave(ir_function *ir)
206 assert(ralloc_parent(ir->name) == ir);
213 ir_validate::visit_enter(ir_function_signature *ir)
215 if (this->current_function != ir->function()) {
219 (void *) ir,
221 ir->function_name(), (void *) ir->function());
225 if (ir->return_type == NULL) {
227 (void *) ir, ir->function_name());
231 this->validate_ir(ir, this->data_enter);
237 ir_validate::visit_leave(ir_expression *ir)
239 for (unsigned i = ir->num_operands; i < 4; i++) {
240 assert(ir->operands[i] == NULL);
243 for (unsigned i = 0; i < ir->num_operands; i++) {
244 assert(ir->operands[i] != NULL);
247 switch (ir->operation) {
249 assert(ir->operands[0]->type == ir->type);
252 assert(ir->type->is_boolean());
253 assert(ir->operands[0]->type->is_boolean());
257 assert(ir->type == ir->operands[0]->type);
262 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT ||
263 ir->operands[0]->type->is_float() ||
264 ir->operands[0]->type->is_double() ||
265 ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
266 assert(ir->type == ir->operands[0]->type);
272 assert(ir->type->is_float() ||
273 ir->type->is_double());
274 assert(ir->type == ir->operands[0]->type);
282 assert(ir->operands[0]->type->is_float());
283 assert(ir->type == ir->operands[0]->type);
287 assert(ir->operands[0]->type->is_float());
288 assert(ir->type->base_type == GLSL_TYPE_INT);
291 assert(ir->operands[0]->type->is_float());
292 assert(ir->type->base_type == GLSL_TYPE_UINT);
295 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
296 assert(ir->type->is_float());
299 assert(ir->operands[0]->type->is_float());
300 assert(ir->type->is_boolean());
303 assert(ir->operands[0]->type->is_boolean());
304 assert(ir->type->is_float());
307 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
308 assert(ir->type->is_boolean());
311 assert(ir->operands[0]->type->is_boolean());
312 assert(ir->type->base_type == GLSL_TYPE_INT);
315 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
316 assert(ir->type->is_float());
319 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
320 assert(ir->type->base_type == GLSL_TYPE_UINT);
323 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
324 assert(ir->type->base_type == GLSL_TYPE_INT);
327 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
328 assert(ir->type->is_float());
331 assert(ir->operands[0]->type->is_float());
332 assert(ir->type->base_type == GLSL_TYPE_INT);
335 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
336 assert(ir->type->is_float());
339 assert(ir->operands[0]->type->is_float());
340 assert(ir->type->base_type == GLSL_TYPE_UINT);
344 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
345 assert(ir->type->is_double());
348 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
349 assert(ir->type->is_double());
352 assert(ir->operands[0]->type->is_double());
353 assert(ir->type->base_type == GLSL_TYPE_UINT64);
356 assert(ir->operands[0]->type->is_double());
357 assert(ir->type->base_type == GLSL_TYPE_INT64);
360 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
361 assert(ir->type->base_type == GLSL_TYPE_INT);
364 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
365 assert(ir->type->base_type == GLSL_TYPE_INT);
368 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
369 assert(ir->type->base_type == GLSL_TYPE_UINT);
372 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
373 assert(ir->type->base_type == GLSL_TYPE_UINT);
376 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
377 assert(ir->type->is_boolean());
380 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
381 assert(ir->type->is_float());
384 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
385 assert(ir->type->is_float());
388 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
389 assert(ir->type->is_double());
392 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
393 assert(ir->type->is_double());
396 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
397 assert(ir->type->base_type == GLSL_TYPE_INT64);
400 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
401 assert(ir->type->base_type == GLSL_TYPE_INT64);
404 assert(ir->operands[0]->type->is_boolean());
405 assert(ir->type->base_type == GLSL_TYPE_INT64);
408 assert(ir->operands[0]->type->is_float());
409 assert(ir->type->base_type == GLSL_TYPE_INT64);
412 assert(ir->operands[0]->type->is_double());
413 assert(ir->type->base_type == GLSL_TYPE_INT64);
416 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
417 assert(ir->type->base_type == GLSL_TYPE_UINT64);
420 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
421 assert(ir->type->base_type == GLSL_TYPE_UINT64);
424 assert(ir->operands[0]->type->is_float());
425 assert(ir->type->base_type == GLSL_TYPE_UINT64);
428 assert(ir->operands[0]->type->is_double());
429 assert(ir->type->base_type == GLSL_TYPE_UINT64);
432 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT64);
433 assert(ir->type->base_type == GLSL_TYPE_INT64);
436 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT64);
437 assert(ir->type->base_type == GLSL_TYPE_UINT64);
444 assert(ir->operands[0]->type->is_float() ||
445 ir->operands[0]->type->is_double());
446 assert(ir->operands[0]->type == ir->type);
456 assert(ir->operands[0]->type->is_float());
457 assert(ir->operands[0]->type == ir->type);
463 assert(ir->type == glsl_type::uint_type);
464 assert(ir->operands[0]->type == glsl_type::vec2_type);
469 assert(ir->type == glsl_type::uint_type);
470 assert(ir->operands[0]->type == glsl_type::vec4_type);
474 assert(ir->type == glsl_type::double_type);
475 assert(ir->operands[0]->type == glsl_type::uvec2_type);
479 assert(ir->type == glsl_type::int64_t_type);
480 assert(ir->operands[0]->type == glsl_type::ivec2_type);
484 assert(ir->type == glsl_type::uint64_t_type);
485 assert(ir->operands[0]->type == glsl_type::uvec2_type);
489 assert(ir->type->is_sampler());
490 assert(ir->operands[0]->type == glsl_type::uvec2_type);
494 assert(ir->type->is_image());
495 assert(ir->operands[0]->type == glsl_type::uvec2_type);
501 assert(ir->type == glsl_type::vec2_type);
502 assert(ir->operands[0]->type == glsl_type::uint_type);
507 assert(ir->type == glsl_type::vec4_type);
508 assert(ir->operands[0]->type == glsl_type::uint_type);
512 assert(ir->type == glsl_type::uvec2_type);
513 assert(ir->operands[0]->type == glsl_type::double_type);
517 assert(ir->type == glsl_type::ivec2_type);
518 assert(ir->operands[0]->type == glsl_type::int64_t_type);
522 assert(ir->type == glsl_type::uvec2_type);
523 assert(ir->operands[0]->type == glsl_type::uint64_t_type);
527 assert(ir->type == glsl_type::uvec2_type);
528 assert(ir->operands[0]->type->is_sampler());
532 assert(ir->type == glsl_type::uvec2_type);
533 assert(ir->operands[0]->type->is_image());
537 assert(ir->operands[0]->type == ir->type);
538 assert(ir->type->is_integer());
544 assert(ir->operands[0]->type->vector_elements == ir->type->vector_elements);
545 assert(ir->operands[0]->type->is_integer());
546 assert(ir->type->base_type == GLSL_TYPE_INT);
554 assert(ir->operands[0]->type == ir->type);
555 assert(ir->operands[0]->type->is_float());
559 assert(ir->type == glsl_type::int_type);
560 assert(ir->operands[0]->type == glsl_type::uint_type);
564 assert(ir->type == glsl_type::int_type);
565 assert(ir->operands[0]->type->is_array());
566 assert(ir->operands[0]->type->is_unsized_array());
570 assert(ir->operands[0]->type->is_double());
571 assert(ir->type->is_float());
574 assert(ir->operands[0]->type->is_float());
575 assert(ir->type->is_double());
578 assert(ir->operands[0]->type->is_double());
579 assert(ir->type->base_type == GLSL_TYPE_INT);
582 assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
583 assert(ir->type->is_double());
586 assert(ir->operands[0]->type->is_double());
587 assert(ir->type->base_type == GLSL_TYPE_UINT);
590 assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT);
591 assert(ir->type->is_double());
594 assert(ir->operands[0]->type->is_double());
595 assert(ir->type->is_boolean());
599 assert(ir->operands[0]->type->is_float() ||
600 ir->operands[0]->type->is_double());
601 assert(ir->type->is_double());
604 assert(ir->operands[0]->type->is_float() ||
605 ir->operands[0]->type->is_double());
606 assert(ir->type->base_type == GLSL_TYPE_INT);
609 assert(ir->operands[0]->type->base_type == GLSL_TYPE_SUBROUTINE);
610 assert(ir->type->base_type == GLSL_TYPE_INT);
621 assert(ir->operands[0]->type->base_type ==
622 ir->operands[1]->type->base_type);
624 if (ir->operation == ir_binop_mul &&
625 (ir->type->base_type == GLSL_TYPE_UINT64 ||
626 ir->type->base_type == GLSL_TYPE_INT64) &&
627 (ir->operands[0]->type->base_type == GLSL_TYPE_INT ||
628 ir->operands[1]->type->base_type == GLSL_TYPE_INT ||
629 ir->operands[0]->type->base_type == GLSL_TYPE_UINT ||
630 ir->operands[1]->type->base_type == GLSL_TYPE_UINT)) {
631 assert(ir->operands[0]->type == ir->operands[1]->type);
635 if (ir->operands[0]->type->is_scalar())
636 assert(ir->operands[1]->type == ir->type);
637 else if (ir->operands[1]->type->is_scalar())
638 assert(ir->operands[0]->type == ir->type);
639 else if (ir->operands[0]->type->is_vector() &&
640 ir->operands[1]->type->is_vector()) {
641 assert(ir->operands[0]->type == ir->operands[1]->type);
642 assert(ir->operands[0]->type == ir->type);
647 assert(ir->type == ir->operands[0]->type);
648 assert(ir->type == ir->operands[1]->type);
649 assert(ir->type->is_integer());
654 assert(ir->type == ir->operands[0]->type);
655 assert(ir->type == ir->operands[1]->type);
656 assert(ir->type->base_type == GLSL_TYPE_UINT);
668 assert(ir->type->is_boolean());
669 assert(ir->operands[0]->type == ir->operands[1]->type);
670 assert(ir->operands[0]->type->is_vector()
671 || ir->operands[0]->type->is_scalar());
672 assert(ir->operands[0]->type->vector_elements
673 == ir->type->vector_elements);
681 assert(ir->type == glsl_type::bool_type);
682 assert(ir->operands[0]->type == ir->operands[1]->type);
687 assert(ir->operands[0]->type->is_integer_32_64() &&
688 ir->operands[1]->type->is_integer());
689 if (ir->operands[0]->type->is_scalar()) {
690 assert(ir->operands[1]->type->is_scalar());
692 if (ir->operands[0]->type->is_vector() &&
693 ir->operands[1]->type->is_vector()) {
694 assert(ir->operands[0]->type->components() ==
695 ir->operands[1]->type->components());
697 assert(ir->type == ir->operands[0]->type);
703 assert(ir->operands[0]->type->base_type ==
704 ir->operands[1]->type->base_type);
705 assert(ir->type->is_integer_32_64());
706 if (ir->operands[0]->type->is_vector() &&
707 ir->operands[1]->type->is_vector()) {
708 assert(ir->operands[0]->type->vector_elements ==
709 ir->operands[1]->type->vector_elements);
716 assert(ir->type->is_boolean());
717 assert(ir->operands[0]->type->is_boolean());
718 assert(ir->operands[1]->type->is_boolean());
722 assert(ir->type == glsl_type::float_type ||
723 ir->type == glsl_type::double_type);
724 assert(ir->operands[0]->type->is_float() ||
725 ir->operands[0]->type->is_double());
726 assert(ir->operands[0]->type->is_vector());
727 assert(ir->operands[0]->type == ir->operands[1]->type);
731 assert(ir->operands[0]->type == glsl_type::uint_type);
733 assert(ir->operands[1]->type == glsl_type::uint_type);
737 assert(ir->operands[0]->type == ir->type);
738 assert(ir->operands[0]->type->is_float() ||
739 ir->operands[0]->type->is_double());
740 assert(ir->operands[1]->type->base_type == GLSL_TYPE_INT);
741 assert(ir->operands[0]->type->components() ==
742 ir->operands[1]->type->components());
746 assert(ir->operands[0]->type->is_vector());
747 assert(ir->operands[1]->type->is_scalar()
748 && ir->operands[1]->type->is_integer());
752 assert(ir->operands[0]->type == ir->type);
753 assert(ir->operands[0]->type->is_float());
754 assert(ir->operands[1]->type->components() == 2);
755 assert(ir->operands[1]->type->is_float());
759 assert(ir->operands[0]->type == ir->type);
760 assert(ir->operands[0]->type->is_float());
761 assert(ir->operands[1]->type == glsl_type::int_type);
765 assert(ir->type->is_float() ||
766 ir->type->is_double());
767 assert(ir->type == ir->operands[0]->type);
768 assert(ir->type == ir->operands[1]->type);
769 assert(ir->type == ir->operands[2]->type);
773 assert(ir->operands[0]->type->is_float() ||
774 ir->operands[0]->type->is_double());
775 assert(ir->operands[0]->type == ir->operands[1]->type);
776 assert(ir->operands[2]->type == ir->operands[0]->type ||
777 ir->operands[2]->type == glsl_type::float_type ||
778 ir->operands[2]->type == glsl_type::double_type);
782 assert(ir->operands[0]->type->is_boolean());
783 assert(ir->type->vector_elements == ir->operands[0]->type->vector_elements);
784 assert(ir->type == ir->operands[1]->type);
785 assert(ir->type == ir->operands[2]->type);
789 assert(ir->type->is_integer());
790 assert(ir->operands[0]->type == ir->type);
791 assert(ir->operands[1]->type == ir->type);
792 assert(ir->operands[2]->type == ir->type);
796 assert(ir->operands[0]->type->is_vector());
797 assert(ir->operands[1]->type->is_scalar());
798 assert(ir->operands[0]->type->base_type == ir->operands[1]->type->base_type);
799 assert(ir->operands[2]->type->is_scalar()
800 && ir->operands[2]->type->is_integer());
801 assert(ir->type == ir->operands[0]->type);
805 assert(ir->type->is_integer());
806 assert(ir->operands[0]->type == ir->type);
807 assert(ir->operands[1]->type == ir->type);
808 assert(ir->operands[2]->type == ir->type);
809 assert(ir->operands[3]->type == ir->type);
820 assert(ir->type->is_vector());
821 switch (ir->type->vector_elements) {
823 assert(ir->operands[0]->type->is_scalar());
824 assert(ir->operands[0]->type->base_type == ir->type->base_type);
825 assert(ir->operands[1]->type->is_scalar());
826 assert(ir->operands[1]->type->base_type == ir->type->base_type);
827 assert(ir->operands[2] == NULL);
828 assert(ir->operands[3] == NULL);
831 assert(ir->operands[0]->type->is_scalar());
832 assert(ir->operands[0]->type->base_type == ir->type->base_type);
833 assert(ir->operands[1]->type->is_scalar());
834 assert(ir->operands[1]->type->base_type == ir->type->base_type);
835 assert(ir->operands[2]->type->is_scalar());
836 assert(ir->operands[2]->type->base_type == ir->type->base_type);
837 assert(ir->operands[3] == NULL);
840 assert(ir->operands[0]->type->is_scalar());
841 assert(ir->operands[0]->type->base_type == ir->type->base_type);
842 assert(ir->operands[1]->type->is_scalar());
843 assert(ir->operands[1]->type->base_type == ir->type->base_type);
844 assert(ir->operands[2]->type->is_scalar());
845 assert(ir->operands[2]->type->base_type == ir->type->base_type);
846 assert(ir->operands[3]->type->is_scalar());
847 assert(ir->operands[3]->type->base_type == ir->type->base_type);
862 ir_validate::visit_leave(ir_swizzle *ir)
864 unsigned int chans[4] = {ir->mask.x, ir->mask.y, ir->mask.z, ir->mask.w};
866 for (unsigned int i = 0; i < ir->type->vector_elements; i++) {
867 if (chans[i] >= ir->val->type->vector_elements) {
869 "in the value.\n", (void *) ir);
870 ir->print();
879 ir_validate::visit(ir_variable *ir)
886 if (ir->name && ir->is_name_ralloced())
887 assert(ralloc_parent(ir->name) == ir);
889 _mesa_set_add(ir_set, ir);
895 if (ir->type->array_size() > 0) {
896 if (ir->data.max_array_access >= (int)ir->type->length) {
898 ir->data.max_array_access, ir->type->length - 1);
899 ir->print();
908 if (ir->is_interface_instance()) {
910 ir->get_interface_type()->fields.structure;
911 for (unsigned i = 0; i < ir->get_interface_type()->length; i++) {
915 ir->get_max_ifc_array_access();
923 ir->print();
930 if (ir->constant_initializer != NULL && !ir->data.has_initializer) {
933 ir->print();
937 if (ir->data.mode == ir_var_uniform
938 && is_gl_identifier(ir->name)
939 && ir->get_state_slots() == NULL) {
941 ir->print();
949 ir_validate::visit_enter(ir_assignment *ir)
951 const ir_dereference *const lhs = ir->lhs;
953 if (ir->write_mask == 0) {
956 ir->print();
962 if (ir->write_mask & (1 << i))
966 if (lhs_components != ir->rhs->type->vector_elements) {
969 lhs_components, ir->rhs->type->vector_elements);
970 ir->print();
975 this->validate_ir(ir, this->data_enter);
981 ir_validate::visit_enter(ir_call *ir)
983 ir_function_signature *const callee = ir->callee;
990 if (ir->return_deref) {
991 if (ir->return_deref->type != callee->return_type) {
993 callee->return_type->name, ir->return_deref->type->name);
1002 const exec_node *actual_param_node = ir->actual_parameters.get_head_raw();
1034 ir->print();
1042 ir_validate::validate_ir(ir_instruction *ir, void *data)
1046 if (_mesa_set_search(ir_set, ir)) {
1047 printf("Instruction node present twice in ir tree:\n");
1048 ir->print();
1052 _mesa_set_add(ir_set, ir);
1056 check_node_type(ir_instruction *ir, void *data)
1060 if (ir->ir_type >= ir_type_max) {
1062 ir->print(); printf("\n");
1064 ir_rvalue *value = ir->as_rvalue();
1081 foreach_in_list(ir_instruction, ir, instructions) {
1082 visit_tree(ir, check_node_type, NULL);