Spilling can mess with this considerably.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
unsigned first_tag = 0;
mir_foreach_block_from(ctx, initial_block, v) {
- midgard_bundle *initial_bundle =
- util_dynarray_element(&v->bundles, midgard_bundle, 0);
+ if (v->quadword_count) {
+ midgard_bundle *initial_bundle =
+ util_dynarray_element(&v->bundles, midgard_bundle, 0);
- if (initial_bundle) {
first_tag = initial_bundle->tag;
break;
}
/* Blend constant was backwards as well. blend_offset if set is
* strictly positive, as an offset of zero would imply constants before
- * any instructions which is invalid in Midgard */
+ * any instructions which is invalid in Midgard. TODO: blend constants
+ * are broken if you spill since then quadword_count becomes invalid
+ * XXX */
if (blend_offset)
ctx->blend_constant_offset = ((ctx->quadword_count + block->quadword_count) - blend_offset - 1) * 0x10;
memcpy(bundles + before, &new, sizeof(new));
list_addtail(&new.instructions[0]->link, &before_bundle->instructions[0]->link);
+ block->quadword_count += quadword_size(new.tag);
}
void
midgard_bundle new = mir_bundle_for_op(ctx, ins);
memcpy(bundles + after + 1, &new, sizeof(new));
list_add(&new.instructions[0]->link, &after_bundle->instructions[after_bundle->instruction_count - 1]->link);
+ block->quadword_count += quadword_size(new.tag);
}
/* Flip the first-two arguments of a (binary) op. Currently ALU