static bool
constant_fold(struct vc4_compile *c, struct qinst *inst)
{
- int nsrc = qir_get_op_nsrc(inst->op);
+ int nsrc = qir_get_nsrc(inst);
uint32_t ui[nsrc];
for (int i = 0; i < nsrc; i++) {
bool debug = false;
bool progress = false;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file != QFILE_TEMP)
continue;
* this instruction doesn't already use it.
*/
bool already_has_unpack = false;
- for (int j = 0; j < qir_get_op_nsrc(inst->op); j++) {
+ for (int j = 0; j < qir_get_nsrc(inst); j++) {
if (inst->src[j].pack)
already_has_unpack = true;
}
static bool
has_nonremovable_reads(struct vc4_compile *c, struct qinst *inst)
{
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_VPM) {
uint32_t attr = inst->src[i].index / 4;
uint32_t offset = (inst->src[i].index % 4) * 4;
bool *used = calloc(c->num_temps, sizeof(bool));
qir_for_each_inst_inorder(inst, c) {
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP)
used[inst->src[i].index] = true;
}
continue;
}
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file != QFILE_VPM)
continue;
uint32_t attr = inst->src[i].index / 4;
*/
switch (writer->dst.file) {
case QFILE_TEMP:
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP &&
inst->src[i].index == writer->dst.index) {
return true;
return false;
}
- for (int i = 0; i < qir_get_op_nsrc(a->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(a); i++) {
if (!qir_reg_equals(a->src[i], b->src[i]) ||
src_file_varies_on_reread(a->src[i]) ||
src_file_varies_on_reread(b->src[i])) {
* elsewhere).
*/
bool uses_small_imm = false;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_SMALL_IMM)
uses_small_imm = true;
}
if (uses_small_imm)
continue;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
struct qreg src = qir_follow_movs(c, inst->src[i]);
if (src.file != QFILE_UNIF ||
break;
}
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP) {
uint32_t temp = inst->src[i].index;
use_count[temp]++;
qir_is_tex(inst))
continue;
- for (int j = 0; j < qir_get_op_nsrc(inst->op); j++) {
+ for (int j = 0; j < qir_get_nsrc(inst); j++) {
if (inst->src[j].file != QFILE_TEMP ||
inst->src[j].pack)
continue;
}
uint32_t temps = 0;
- for (int k = 0; k < qir_get_op_nsrc(inst->op); k++) {
+ for (int k = 0; k < qir_get_nsrc(inst); k++) {
if (inst->src[k].file == QFILE_TEMP)
temps++;
}
memset(input_live, 0, sizeof(input_live));
qir_for_each_inst_inorder(inst, c) {
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_VARY)
input_live[inst->src[i].index] = true;
}
}
int
-qir_get_op_nsrc(enum qop qop)
+qir_get_nsrc(struct qinst *inst)
{
- if (qop < ARRAY_SIZE(qir_op_info) && qir_op_info[qop].name)
- return qir_op_info[qop].nsrc;
- else
- abort();
+ assert(qir_op_info[inst->op].name);
+ return qir_op_info[inst->op].nsrc;
}
/**
* point/line coordinates reads, because they're generated by
* fixed-function hardware.
*/
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_VARY &&
c->input_slots[inst->src[i].index].slot == 0xff) {
return true;
}
}
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
fprintf(stderr, ", ");
qir_print_reg(c, inst->src[i], false);
vc4_qpu_disasm_unpack(stderr, inst->src[i].pack);
struct qreg qir_get_temp(struct vc4_compile *c);
void qir_calculate_live_intervals(struct vc4_compile *c);
-int qir_get_op_nsrc(enum qop qop);
+int qir_get_nsrc(struct qinst *inst);
bool qir_reg_equals(struct qreg a, struct qreg b);
bool qir_has_side_effects(struct vc4_compile *c, struct qinst *inst);
bool qir_has_side_effect_reads(struct vc4_compile *c, struct qinst *inst);
if (qir_is_tex(inst))
return true;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_UNIF)
return true;
}
_mesa_hash_table_clear(partial_update_ht, NULL);
qir_for_each_inst(inst, block) {
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++)
+ for (int i = 0; i < qir_get_nsrc(inst); i++)
qir_setup_use(c, block, ip, inst->src[i]);
qir_setup_def(c, block, ip, partial_update_ht, inst);
{
uint32_t count = 0;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file != QFILE_UNIF)
continue;
* ht.
*/
qir_for_each_inst_inorder(inst, c) {
- uint32_t nsrc = qir_get_op_nsrc(inst->op);
+ uint32_t nsrc = qir_get_nsrc(inst);
if (qir_get_instruction_uniform_count(inst) <= 1)
continue;
struct qinst *mov = NULL;
qir_for_each_inst(inst, block) {
- uint32_t nsrc = qir_get_op_nsrc(inst->op);
+ uint32_t nsrc = qir_get_nsrc(inst);
uint32_t count = qir_get_instruction_uniform_count(inst);
* ignore uniforms accesses, because qir_reorder_uniforms() happens
* after this.
*/
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
switch (inst->src[i].file) {
case QFILE_TEMP:
add_dep(dir,
calculate_deps(&state, n);
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
switch (inst->src[i].file) {
case QFILE_UNIF:
add_dep(state.dir, state.last_uniforms_reset, n);
state->temp_writes[inst->dst.index] == 1)
cost--;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP &&
!BITSET_TEST(state->temp_live, inst->src[i].index)) {
cost++;
}
/* Update our tracking of register pressure. */
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP)
BITSET_SET(state->temp_live, inst->src[i].index);
}
break;
}
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
struct qreg src = inst->src[i];
switch (src.file) {
uint64_t unpack = 0;
struct qpu_reg src[ARRAY_SIZE(qinst->src)];
- for (int i = 0; i < qir_get_op_nsrc(qinst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(qinst); i++) {
int index = qinst->src[i].index;
switch (qinst->src[i].file) {
case QFILE_NULL:
* argument slot as well so that we don't take up
* another raddr just to get unused data.
*/
- if (qir_get_op_nsrc(qinst->op) == 1)
+ if (qir_get_nsrc(qinst) == 1)
src[1] = src[0];
fixup_raddr_conflict(block, dst, &src[0], &src[1],
* can only be done from regfile A, while float unpacks can be
* either A or R4.
*/
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP &&
inst->src[i].pack) {
if (qir_is_float_input(inst)) {
qir_for_each_inst_inorder(inst, c) {
uint32_t new = ~0;
- for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) {
+ for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file != QFILE_UNIF)
continue;