To match how the newer iterators work.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5048>
/* iterator for an instructions's sources (reg), also returns src #: */
#define foreach_src_n(__srcreg, __n, __instr) \
if ((__instr)->regs_count) \
- for (unsigned __cnt = (__instr)->regs_count - 1, __n = 0; __n < __cnt; __n++) \
- if ((__srcreg = (__instr)->regs[__n + 1]))
+ for (struct ir3_register *__srcreg = (void *)~0; __srcreg; __srcreg = NULL) \
+ for (unsigned __cnt = (__instr)->regs_count - 1, __n = 0; __n < __cnt; __n++) \
+ if ((__srcreg = (__instr)->regs[__n + 1]))
/* iterator for an instructions's sources (reg): */
#define foreach_src(__srcreg, __instr) \
static inline bool
check_src_cond(struct ir3_instruction *instr, bool (*cond)(struct ir3_instruction *))
{
- struct ir3_register *reg;
-
/* Note that this is also used post-RA so skip the ssa iterator: */
foreach_src (reg, instr) {
struct ir3_instruction *src = reg->instr;
foreach_block (block, &ir->block_list) {
foreach_instr_safe (instr, &block->instr_list) {
- struct ir3_register *reg;
-
foreach_src (reg, instr) {
struct ir3_instruction *src = reg->instr;
static void
instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr)
{
- struct ir3_register *reg;
-
if (instr->regs_count == 0)
return;
if (assigner->barrier_class & IR3_BARRIER_ARRAY_W) {
struct ir3_register *dst = assigner->regs[0];
- struct ir3_register *src;
debug_assert(dst->flags & IR3_REG_ARRAY);
unsigned delay = 0;
if (is_meta(assigner)) {
- struct ir3_register *src;
foreach_src (src, assigner) {
unsigned d;
bool soft, bool pred)
{
unsigned delay = 0;
- struct ir3_register *src;
foreach_src_n (src, i, instr) {
unsigned d = 0;
list_inithead(&block->instr_list);
foreach_instr_safe (n, &instr_list) {
- struct ir3_register *reg;
unsigned i;
n->flags &= ~(IR3_INSTR_SS | IR3_INSTR_SY);
* resulting in undefined results:
*/
for (i = 0; i < n->regs_count; i++) {
- reg = n->regs[i];
+ struct ir3_register *reg = n->regs[i];
if (reg_gpr(reg)) {
}
if (n->regs_count > 0) {
- reg = n->regs[0];
+ struct ir3_register *reg = n->regs[0];
if (regmask_get(&state->needs_ss_war, reg)) {
n->flags |= IR3_INSTR_SS;
last_input_needs_ss = false;
calculate_deps(struct ir3_postsched_deps_state *state,
struct ir3_postsched_node *node)
{
- struct ir3_register *reg;
int b;
/* Add dependencies on instructions that previously (or next,
/* And then after we update the state for what this instruction
* wrote:
*/
- reg = node->instr->regs[0];
+ struct ir3_register *reg = node->instr->regs[0];
if (reg->flags & IR3_REG_RELATIV) {
/* mark the entire array as written: */
struct ir3_array *arr = ir3_lookup_array(state->ctx->ir, reg->array.id);
{
foreach_block (block, &ir->block_list) {
foreach_instr_safe (instr, &block->instr_list) {
- struct ir3_register *reg;
foreach_src (reg, instr) {
if (!reg->instr)
* need to find the distance between where actual array starts
* and collect.. that probably doesn't happen currently.
*/
- struct ir3_register *src;
int dsz, doff;
/* note: don't use foreach_ssa_src as this gets called once
ra_block_alloc(struct ir3_ra_ctx *ctx, struct ir3_block *block)
{
foreach_instr (instr, &block->instr_list) {
- struct ir3_register *reg;
if (writes_gpr(instr)) {
if (should_assign(ctx, instr)) {
precolor(ctx, instr);
- struct ir3_register *src;
foreach_src (src, instr) {
if (!src->instr)
continue;
debug_assert(dst->num == (src->num + instr->split.off));
} else if (instr->opc == OPC_META_COLLECT) {
struct ir3_register *dst = instr->regs[0];
- struct ir3_register *src;
foreach_src_n (src, n, instr) {
debug_assert(dst->num == (src->num - n));
ctx->namecnt = ctx->nameidx = 0;
- struct ir3_register *reg;
foreach_src (reg, instr) {
if (reg->flags & IR3_REG_ARRAY) {
struct ir3_array *arr =