Introduce .editorconfig
[mesa.git] / src / gallium / drivers / vc4 / vc4_qir.c
1 /*
2 * Copyright © 2014 Broadcom
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "util/u_memory.h"
25 #include "util/ralloc.h"
26
27 #include "vc4_qir.h"
28 #include "vc4_qpu.h"
29
30 struct qir_op_info {
31 const char *name;
32 uint8_t ndst, nsrc;
33 bool has_side_effects;
34 };
35
36 static const struct qir_op_info qir_op_info[] = {
37 [QOP_MOV] = { "mov", 1, 1 },
38 [QOP_FMOV] = { "fmov", 1, 1 },
39 [QOP_MMOV] = { "mmov", 1, 1 },
40 [QOP_FADD] = { "fadd", 1, 2 },
41 [QOP_FSUB] = { "fsub", 1, 2 },
42 [QOP_FMUL] = { "fmul", 1, 2 },
43 [QOP_MUL24] = { "mul24", 1, 2 },
44 [QOP_V8MULD] = {"v8muld", 1, 2 },
45 [QOP_V8MIN] = {"v8min", 1, 2 },
46 [QOP_V8MAX] = {"v8max", 1, 2 },
47 [QOP_V8ADDS] = {"v8adds", 1, 2 },
48 [QOP_V8SUBS] = {"v8subs", 1, 2 },
49 [QOP_FMIN] = { "fmin", 1, 2 },
50 [QOP_FMAX] = { "fmax", 1, 2 },
51 [QOP_FMINABS] = { "fminabs", 1, 2 },
52 [QOP_FMAXABS] = { "fmaxabs", 1, 2 },
53 [QOP_FTOI] = { "ftoi", 1, 1 },
54 [QOP_ITOF] = { "itof", 1, 1 },
55 [QOP_ADD] = { "add", 1, 2 },
56 [QOP_SUB] = { "sub", 1, 2 },
57 [QOP_SHR] = { "shr", 1, 2 },
58 [QOP_ASR] = { "asr", 1, 2 },
59 [QOP_SHL] = { "shl", 1, 2 },
60 [QOP_MIN] = { "min", 1, 2 },
61 [QOP_MAX] = { "max", 1, 2 },
62 [QOP_AND] = { "and", 1, 2 },
63 [QOP_OR] = { "or", 1, 2 },
64 [QOP_XOR] = { "xor", 1, 2 },
65 [QOP_NOT] = { "not", 1, 1 },
66
67 [QOP_RCP] = { "rcp", 1, 1 },
68 [QOP_RSQ] = { "rsq", 1, 1 },
69 [QOP_EXP2] = { "exp2", 1, 1 },
70 [QOP_LOG2] = { "log2", 1, 1 },
71 [QOP_TLB_COLOR_READ] = { "tlb_color_read", 1, 0 },
72 [QOP_MS_MASK] = { "ms_mask", 0, 1, true },
73 [QOP_VARY_ADD_C] = { "vary_add_c", 1, 1 },
74
75 [QOP_FRAG_Z] = { "frag_z", 1, 0 },
76 [QOP_FRAG_W] = { "frag_w", 1, 0 },
77
78 [QOP_TEX_S] = { "tex_s", 0, 2, true },
79 [QOP_TEX_T] = { "tex_t", 0, 2, true },
80 [QOP_TEX_R] = { "tex_r", 0, 2, true },
81 [QOP_TEX_B] = { "tex_b", 0, 2, true },
82 [QOP_TEX_DIRECT] = { "tex_direct", 0, 2, true },
83 [QOP_TEX_RESULT] = { "tex_result", 1, 0, true },
84
85 [QOP_LOAD_IMM] = { "load_imm", 0, 1 },
86 [QOP_LOAD_IMM_U2] = { "load_imm_u2", 0, 1 },
87 [QOP_LOAD_IMM_I2] = { "load_imm_i2", 0, 1 },
88
89 [QOP_ROT_MUL] = { "rot_mul", 0, 2 },
90
91 [QOP_BRANCH] = { "branch", 0, 0, true },
92 [QOP_UNIFORMS_RESET] = { "uniforms_reset", 0, 2, true },
93 };
94
95 static const char *
96 qir_get_op_name(enum qop qop)
97 {
98 if (qop < ARRAY_SIZE(qir_op_info) && qir_op_info[qop].name)
99 return qir_op_info[qop].name;
100 else
101 return "???";
102 }
103
104 int
105 qir_get_op_nsrc(enum qop qop)
106 {
107 if (qop < ARRAY_SIZE(qir_op_info) && qir_op_info[qop].name)
108 return qir_op_info[qop].nsrc;
109 else
110 abort();
111 }
112
113 /**
114 * Returns whether the instruction has any side effects that must be
115 * preserved.
116 */
117 bool
118 qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
119 {
120 switch (inst->dst.file) {
121 case QFILE_TLB_Z_WRITE:
122 case QFILE_TLB_COLOR_WRITE:
123 case QFILE_TLB_COLOR_WRITE_MS:
124 case QFILE_TLB_STENCIL_SETUP:
125 return true;
126 default:
127 break;
128 }
129
130 return qir_op_info[inst->op].has_side_effects;
131 }
132
133 bool
134 qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst)
135 {
136 /* We can dead-code eliminate varyings, because we only tell the VS
137 * about the live ones at the end. But we have to preserve the
138 * point/line coordinates reads, because they're generated by
139 * fixed-function hardware.
140 */
141 for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
142 if (inst->src[i].file == QFILE_VARY &&
143 c->input_slots[inst->src[i].index].slot == 0xff) {
144 return true;
145 }
146
147 if (inst->src[i].file == QFILE_VPM)
148 return true;
149 }
150
151 if (inst->dst.file == QFILE_VPM)
152 return true;
153
154 return false;
155 }
156
157 bool
158 qir_is_mul(struct qinst *inst)
159 {
160 switch (inst->op) {
161 case QOP_MMOV:
162 case QOP_FMUL:
163 case QOP_MUL24:
164 case QOP_V8MULD:
165 case QOP_V8MIN:
166 case QOP_V8MAX:
167 case QOP_V8ADDS:
168 case QOP_V8SUBS:
169 case QOP_ROT_MUL:
170 return true;
171 default:
172 return false;
173 }
174 }
175
176 bool
177 qir_is_float_input(struct qinst *inst)
178 {
179 switch (inst->op) {
180 case QOP_FMOV:
181 case QOP_FMUL:
182 case QOP_FADD:
183 case QOP_FSUB:
184 case QOP_FMIN:
185 case QOP_FMAX:
186 case QOP_FMINABS:
187 case QOP_FMAXABS:
188 case QOP_FTOI:
189 return true;
190 default:
191 return false;
192 }
193 }
194
195 bool
196 qir_is_raw_mov(struct qinst *inst)
197 {
198 return ((inst->op == QOP_MOV ||
199 inst->op == QOP_FMOV ||
200 inst->op == QOP_MMOV) &&
201 inst->cond == QPU_COND_ALWAYS &&
202 !inst->dst.pack &&
203 !inst->src[0].pack);
204 }
205
206 bool
207 qir_is_tex(struct qinst *inst)
208 {
209 return inst->op >= QOP_TEX_S && inst->op <= QOP_TEX_DIRECT;
210 }
211
212 bool
213 qir_depends_on_flags(struct qinst *inst)
214 {
215 if (inst->op == QOP_BRANCH) {
216 return inst->cond != QPU_COND_BRANCH_ALWAYS;
217 } else {
218 return (inst->cond != QPU_COND_ALWAYS &&
219 inst->cond != QPU_COND_NEVER);
220 }
221 }
222
223 bool
224 qir_writes_r4(struct qinst *inst)
225 {
226 switch (inst->op) {
227 case QOP_TEX_RESULT:
228 case QOP_TLB_COLOR_READ:
229 case QOP_RCP:
230 case QOP_RSQ:
231 case QOP_EXP2:
232 case QOP_LOG2:
233 return true;
234 default:
235 return false;
236 }
237 }
238
239 uint8_t
240 qir_channels_written(struct qinst *inst)
241 {
242 if (qir_is_mul(inst)) {
243 switch (inst->dst.pack) {
244 case QPU_PACK_MUL_NOP:
245 case QPU_PACK_MUL_8888:
246 return 0xf;
247 case QPU_PACK_MUL_8A:
248 return 0x1;
249 case QPU_PACK_MUL_8B:
250 return 0x2;
251 case QPU_PACK_MUL_8C:
252 return 0x4;
253 case QPU_PACK_MUL_8D:
254 return 0x8;
255 }
256 } else {
257 switch (inst->dst.pack) {
258 case QPU_PACK_A_NOP:
259 case QPU_PACK_A_8888:
260 case QPU_PACK_A_8888_SAT:
261 case QPU_PACK_A_32_SAT:
262 return 0xf;
263 case QPU_PACK_A_8A:
264 case QPU_PACK_A_8A_SAT:
265 return 0x1;
266 case QPU_PACK_A_8B:
267 case QPU_PACK_A_8B_SAT:
268 return 0x2;
269 case QPU_PACK_A_8C:
270 case QPU_PACK_A_8C_SAT:
271 return 0x4;
272 case QPU_PACK_A_8D:
273 case QPU_PACK_A_8D_SAT:
274 return 0x8;
275 case QPU_PACK_A_16A:
276 case QPU_PACK_A_16A_SAT:
277 return 0x3;
278 case QPU_PACK_A_16B:
279 case QPU_PACK_A_16B_SAT:
280 return 0xc;
281 }
282 }
283 unreachable("Bad pack field");
284 }
285
286 static void
287 qir_print_reg(struct vc4_compile *c, struct qreg reg, bool write)
288 {
289 static const char *files[] = {
290 [QFILE_TEMP] = "t",
291 [QFILE_VARY] = "v",
292 [QFILE_UNIF] = "u",
293 [QFILE_TLB_COLOR_WRITE] = "tlb_c",
294 [QFILE_TLB_COLOR_WRITE_MS] = "tlb_c_ms",
295 [QFILE_TLB_Z_WRITE] = "tlb_z",
296 [QFILE_TLB_STENCIL_SETUP] = "tlb_stencil",
297 [QFILE_FRAG_X] = "frag_x",
298 [QFILE_FRAG_Y] = "frag_y",
299 [QFILE_FRAG_REV_FLAG] = "frag_rev_flag",
300 [QFILE_QPU_ELEMENT] = "elem",
301 };
302
303 switch (reg.file) {
304
305 case QFILE_NULL:
306 fprintf(stderr, "null");
307 break;
308
309 case QFILE_LOAD_IMM:
310 fprintf(stderr, "0x%08x (%f)", reg.index, uif(reg.index));
311 break;
312
313 case QFILE_SMALL_IMM:
314 if ((int)reg.index >= -16 && (int)reg.index <= 15)
315 fprintf(stderr, "%d", reg.index);
316 else
317 fprintf(stderr, "%f", uif(reg.index));
318 break;
319
320 case QFILE_VPM:
321 if (write) {
322 fprintf(stderr, "vpm");
323 } else {
324 fprintf(stderr, "vpm%d.%d",
325 reg.index / 4, reg.index % 4);
326 }
327 break;
328
329 case QFILE_TLB_COLOR_WRITE:
330 case QFILE_TLB_COLOR_WRITE_MS:
331 case QFILE_TLB_Z_WRITE:
332 case QFILE_TLB_STENCIL_SETUP:
333 fprintf(stderr, "%s", files[reg.file]);
334 break;
335
336 default:
337 fprintf(stderr, "%s%d", files[reg.file], reg.index);
338 break;
339 }
340
341 if (reg.file == QFILE_UNIF &&
342 c->uniform_contents[reg.index] == QUNIFORM_CONSTANT) {
343 fprintf(stderr, " (0x%08x / %f)",
344 c->uniform_data[reg.index],
345 uif(c->uniform_data[reg.index]));
346 }
347 }
348
349 void
350 qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
351 {
352 fprintf(stderr, "%s", qir_get_op_name(inst->op));
353 if (inst->op == QOP_BRANCH)
354 vc4_qpu_disasm_cond_branch(stderr, inst->cond);
355 else
356 vc4_qpu_disasm_cond(stderr, inst->cond);
357 if (inst->sf)
358 fprintf(stderr, ".sf");
359 fprintf(stderr, " ");
360
361 if (inst->op != QOP_BRANCH) {
362 qir_print_reg(c, inst->dst, true);
363 if (inst->dst.pack) {
364 if (inst->dst.pack) {
365 if (qir_is_mul(inst))
366 vc4_qpu_disasm_pack_mul(stderr, inst->dst.pack);
367 else
368 vc4_qpu_disasm_pack_a(stderr, inst->dst.pack);
369 }
370 }
371 }
372
373 for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
374 fprintf(stderr, ", ");
375 qir_print_reg(c, inst->src[i], false);
376 vc4_qpu_disasm_unpack(stderr, inst->src[i].pack);
377 }
378 }
379
380 void
381 qir_dump(struct vc4_compile *c)
382 {
383 int ip = 0;
384
385 qir_for_each_block(block, c) {
386 fprintf(stderr, "BLOCK %d:\n", block->index);
387 qir_for_each_inst(inst, block) {
388 if (c->temp_start) {
389 bool first = true;
390
391 for (int i = 0; i < c->num_temps; i++) {
392 if (c->temp_start[i] != ip)
393 continue;
394
395 if (first) {
396 first = false;
397 } else {
398 fprintf(stderr, ", ");
399 }
400 fprintf(stderr, "S%4d", i);
401 }
402
403 if (first)
404 fprintf(stderr, " ");
405 else
406 fprintf(stderr, " ");
407 }
408
409 if (c->temp_end) {
410 bool first = true;
411
412 for (int i = 0; i < c->num_temps; i++) {
413 if (c->temp_end[i] != ip)
414 continue;
415
416 if (first) {
417 first = false;
418 } else {
419 fprintf(stderr, ", ");
420 }
421 fprintf(stderr, "E%4d", i);
422 }
423
424 if (first)
425 fprintf(stderr, " ");
426 else
427 fprintf(stderr, " ");
428 }
429
430 qir_dump_inst(c, inst);
431 fprintf(stderr, "\n");
432 ip++;
433 }
434 if (block->successors[1]) {
435 fprintf(stderr, "-> BLOCK %d, %d\n",
436 block->successors[0]->index,
437 block->successors[1]->index);
438 } else if (block->successors[0]) {
439 fprintf(stderr, "-> BLOCK %d\n",
440 block->successors[0]->index);
441 }
442 }
443 }
444
445 struct qreg
446 qir_get_temp(struct vc4_compile *c)
447 {
448 struct qreg reg;
449
450 reg.file = QFILE_TEMP;
451 reg.index = c->num_temps++;
452 reg.pack = 0;
453
454 if (c->num_temps > c->defs_array_size) {
455 uint32_t old_size = c->defs_array_size;
456 c->defs_array_size = MAX2(old_size * 2, 16);
457 c->defs = reralloc(c, c->defs, struct qinst *,
458 c->defs_array_size);
459 memset(&c->defs[old_size], 0,
460 sizeof(c->defs[0]) * (c->defs_array_size - old_size));
461 }
462
463 return reg;
464 }
465
466 struct qinst *
467 qir_inst(enum qop op, struct qreg dst, struct qreg src0, struct qreg src1)
468 {
469 struct qinst *inst = CALLOC_STRUCT(qinst);
470
471 inst->op = op;
472 inst->dst = dst;
473 inst->src = calloc(2, sizeof(inst->src[0]));
474 inst->src[0] = src0;
475 inst->src[1] = src1;
476 inst->cond = QPU_COND_ALWAYS;
477
478 return inst;
479 }
480
481 struct qinst *
482 qir_inst4(enum qop op, struct qreg dst,
483 struct qreg a,
484 struct qreg b,
485 struct qreg c,
486 struct qreg d)
487 {
488 struct qinst *inst = CALLOC_STRUCT(qinst);
489
490 inst->op = op;
491 inst->dst = dst;
492 inst->src = calloc(4, sizeof(*inst->src));
493 inst->src[0] = a;
494 inst->src[1] = b;
495 inst->src[2] = c;
496 inst->src[3] = d;
497
498 return inst;
499 }
500
501 static void
502 qir_emit(struct vc4_compile *c, struct qinst *inst)
503 {
504 list_addtail(&inst->link, &c->cur_block->instructions);
505 }
506
507 /* Updates inst to write to a new temporary, emits it, and notes the def. */
508 struct qreg
509 qir_emit_def(struct vc4_compile *c, struct qinst *inst)
510 {
511 assert(inst->dst.file == QFILE_NULL);
512
513 inst->dst = qir_get_temp(c);
514
515 if (inst->dst.file == QFILE_TEMP)
516 c->defs[inst->dst.index] = inst;
517
518 qir_emit(c, inst);
519
520 return inst->dst;
521 }
522
523 struct qinst *
524 qir_emit_nondef(struct vc4_compile *c, struct qinst *inst)
525 {
526 if (inst->dst.file == QFILE_TEMP)
527 c->defs[inst->dst.index] = NULL;
528
529 qir_emit(c, inst);
530
531 return inst;
532 }
533
534 bool
535 qir_reg_equals(struct qreg a, struct qreg b)
536 {
537 return a.file == b.file && a.index == b.index && a.pack == b.pack;
538 }
539
540 struct qblock *
541 qir_new_block(struct vc4_compile *c)
542 {
543 struct qblock *block = rzalloc(c, struct qblock);
544
545 list_inithead(&block->instructions);
546 list_inithead(&block->qpu_inst_list);
547
548 block->predecessors = _mesa_set_create(block,
549 _mesa_hash_pointer,
550 _mesa_key_pointer_equal);
551
552 block->index = c->next_block_index++;
553
554 return block;
555 }
556
557 void
558 qir_set_emit_block(struct vc4_compile *c, struct qblock *block)
559 {
560 c->cur_block = block;
561 list_addtail(&block->link, &c->blocks);
562 }
563
564 struct qblock *
565 qir_entry_block(struct vc4_compile *c)
566 {
567 return list_first_entry(&c->blocks, struct qblock, link);
568 }
569
570 struct qblock *
571 qir_exit_block(struct vc4_compile *c)
572 {
573 return list_last_entry(&c->blocks, struct qblock, link);
574 }
575
576 void
577 qir_link_blocks(struct qblock *predecessor, struct qblock *successor)
578 {
579 _mesa_set_add(successor->predecessors, predecessor);
580 if (predecessor->successors[0]) {
581 assert(!predecessor->successors[1]);
582 predecessor->successors[1] = successor;
583 } else {
584 predecessor->successors[0] = successor;
585 }
586 }
587
588 struct vc4_compile *
589 qir_compile_init(void)
590 {
591 struct vc4_compile *c = rzalloc(NULL, struct vc4_compile);
592
593 list_inithead(&c->blocks);
594 qir_set_emit_block(c, qir_new_block(c));
595
596 c->output_position_index = -1;
597 c->output_color_index = -1;
598 c->output_point_size_index = -1;
599 c->output_sample_mask_index = -1;
600
601 c->def_ht = _mesa_hash_table_create(c, _mesa_hash_pointer,
602 _mesa_key_pointer_equal);
603
604 return c;
605 }
606
607 void
608 qir_remove_instruction(struct vc4_compile *c, struct qinst *qinst)
609 {
610 if (qinst->dst.file == QFILE_TEMP)
611 c->defs[qinst->dst.index] = NULL;
612
613 list_del(&qinst->link);
614 free(qinst->src);
615 free(qinst);
616 }
617
618 struct qreg
619 qir_follow_movs(struct vc4_compile *c, struct qreg reg)
620 {
621 int pack = reg.pack;
622
623 while (reg.file == QFILE_TEMP &&
624 c->defs[reg.index] &&
625 (c->defs[reg.index]->op == QOP_MOV ||
626 c->defs[reg.index]->op == QOP_FMOV ||
627 c->defs[reg.index]->op == QOP_MMOV)&&
628 !c->defs[reg.index]->dst.pack &&
629 !c->defs[reg.index]->src[0].pack) {
630 reg = c->defs[reg.index]->src[0];
631 }
632
633 reg.pack = pack;
634 return reg;
635 }
636
637 void
638 qir_compile_destroy(struct vc4_compile *c)
639 {
640 qir_for_each_block(block, c) {
641 while (!list_empty(&block->instructions)) {
642 struct qinst *qinst =
643 list_first_entry(&block->instructions,
644 struct qinst, link);
645 qir_remove_instruction(c, qinst);
646 }
647 }
648
649 ralloc_free(c);
650 }
651
652 const char *
653 qir_get_stage_name(enum qstage stage)
654 {
655 static const char *names[] = {
656 [QSTAGE_FRAG] = "FS",
657 [QSTAGE_VERT] = "VS",
658 [QSTAGE_COORD] = "CS",
659 };
660
661 return names[stage];
662 }
663
664 struct qreg
665 qir_uniform(struct vc4_compile *c,
666 enum quniform_contents contents,
667 uint32_t data)
668 {
669 for (int i = 0; i < c->num_uniforms; i++) {
670 if (c->uniform_contents[i] == contents &&
671 c->uniform_data[i] == data) {
672 return qir_reg(QFILE_UNIF, i);
673 }
674 }
675
676 uint32_t uniform = c->num_uniforms++;
677
678 if (uniform >= c->uniform_array_size) {
679 c->uniform_array_size = MAX2(MAX2(16, uniform + 1),
680 c->uniform_array_size * 2);
681
682 c->uniform_data = reralloc(c, c->uniform_data,
683 uint32_t,
684 c->uniform_array_size);
685 c->uniform_contents = reralloc(c, c->uniform_contents,
686 enum quniform_contents,
687 c->uniform_array_size);
688 }
689
690 c->uniform_contents[uniform] = contents;
691 c->uniform_data[uniform] = data;
692
693 return qir_reg(QFILE_UNIF, uniform);
694 }
695
696 void
697 qir_SF(struct vc4_compile *c, struct qreg src)
698 {
699 struct qinst *last_inst = NULL;
700
701 if (!list_empty(&c->cur_block->instructions))
702 last_inst = (struct qinst *)c->cur_block->instructions.prev;
703
704 /* We don't have any way to guess which kind of MOV is implied. */
705 assert(!src.pack);
706
707 if (src.file != QFILE_TEMP ||
708 !c->defs[src.index] ||
709 last_inst != c->defs[src.index]) {
710 last_inst = qir_MOV_dest(c, qir_reg(QFILE_NULL, 0), src);
711 last_inst = (struct qinst *)c->cur_block->instructions.prev;
712 }
713 last_inst->sf = true;
714 }
715
716 #define OPTPASS(func) \
717 do { \
718 bool stage_progress = func(c); \
719 if (stage_progress) { \
720 progress = true; \
721 if (print_opt_debug) { \
722 fprintf(stderr, \
723 "QIR opt pass %2d: %s progress\n", \
724 pass, #func); \
725 } \
726 qir_validate(c); \
727 } \
728 } while (0)
729
730 void
731 qir_optimize(struct vc4_compile *c)
732 {
733 bool print_opt_debug = false;
734 int pass = 1;
735
736 while (true) {
737 bool progress = false;
738
739 OPTPASS(qir_opt_algebraic);
740 OPTPASS(qir_opt_constant_folding);
741 OPTPASS(qir_opt_copy_propagation);
742 OPTPASS(qir_opt_peephole_sf);
743 OPTPASS(qir_opt_dead_code);
744 OPTPASS(qir_opt_small_immediates);
745 OPTPASS(qir_opt_vpm);
746
747 if (!progress)
748 break;
749
750 pass++;
751 }
752 }