- /* Compute the live ranges so we can figure out interference.
- */
- uint32_t ip = 0;
- list_for_each_entry(struct qinst, inst, &c->instructions, link) {
- if (inst->dst.file == QFILE_TEMP) {
- def[inst->dst.index] = MIN2(ip, def[inst->dst.index]);
- use[inst->dst.index] = ip;
- }
-
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
- if (inst->src[i].file == QFILE_TEMP)
- use[inst->src[i].index] = ip;
- }
-
- switch (inst->op) {
- case QOP_FRAG_Z:
- case QOP_FRAG_W:
- /* The payload registers have values implicitly loaded
- * at the start of the program.
- */
- def[inst->dst.index] = 0;
- break;
- default:
- break;
- }
-
- ip++;
- }
+ /* Compute the live ranges so we can figure out interference. */
+ qir_calculate_live_intervals(c);