util: Remove tmp argument from BITSET_FOREACH_SET macro

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3499>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3499>
This commit is contained in:
Matt Turner 2020-01-21 15:07:24 -08:00 committed by Marge Bot
parent d3eb2a0951
commit 4413537c80
9 changed files with 21 additions and 34 deletions

View File

@ -132,8 +132,7 @@ nir_phi_builder_add_value(struct nir_phi_builder *pb, unsigned num_components,
pb->iter_count++;
BITSET_WORD tmp;
BITSET_FOREACH_SET(i, tmp, defs, pb->num_blocks) {
BITSET_FOREACH_SET(i, defs, pb->num_blocks) {
if (pb->work[i] < pb->iter_count)
pb->W[w_end++] = pb->blocks[i];
pb->work[i] = pb->iter_count;

View File

@ -814,13 +814,12 @@ live_defs(nir_function_impl *impl, struct live_def *defs, unsigned *live_map)
/* apply live_in/live_out to ranges */
nir_foreach_block(block, impl) {
BITSET_WORD tmp;
int i;
BITSET_FOREACH_SET(i, tmp, block->live_in, state.num_defs)
BITSET_FOREACH_SET(i, block->live_in, state.num_defs)
range_include(&state.defs[i], block_live_index[block->index]);
BITSET_FOREACH_SET(i, tmp, block->live_out, state.num_defs)
BITSET_FOREACH_SET(i, block->live_out, state.num_defs)
range_include(&state.defs[i], block_live_index[block->index + 1]);
}

View File

@ -191,14 +191,13 @@ static void add_all_interferences(struct regalloc_ctx *ctx,
BITSET_WORD *live_regs)
{
int live_node;
BITSET_WORD tmp;
BITSET_FOREACH_SET(live_node, tmp, live_nodes, ctx->comp->cur_index) {
BITSET_FOREACH_SET(live_node, live_nodes, ctx->comp->cur_index) {
add_interference(ctx, i,
live_node + ctx->comp->cur_reg);
}
int live_reg;
BITSET_FOREACH_SET(live_reg, tmp, ctx->live, ctx->comp->cur_index) {
BITSET_FOREACH_SET(live_reg, ctx->live, ctx->comp->cur_index) {
add_interference(ctx, i, live_reg);
}
@ -211,11 +210,10 @@ static void print_liveness(struct regalloc_ctx *ctx,
return;
int live_idx;
BITSET_WORD tmp;
BITSET_FOREACH_SET(live_idx, tmp, live_reg, ctx->comp->cur_reg) {
BITSET_FOREACH_SET(live_idx, live_reg, ctx->comp->cur_reg) {
printf("reg%d ", live_idx);
}
BITSET_FOREACH_SET(live_idx, tmp, live_val, ctx->comp->cur_index) {
BITSET_FOREACH_SET(live_idx, live_val, ctx->comp->cur_index) {
printf("%d ", live_idx);
}
printf("\n");
@ -446,8 +444,7 @@ static void assign_regs(struct regalloc_ctx *ctx)
block->live_out_phys = 0;
int reg_idx;
BITSET_WORD tmp;
BITSET_FOREACH_SET(reg_idx, tmp, block->live_out, ctx->comp->cur_reg) {
BITSET_FOREACH_SET(reg_idx, block->live_out, ctx->comp->cur_reg) {
if (BITSET_TEST(block->def_out, reg_idx)) {
block->live_out_phys |= (1ull << ctx->registers[reg_idx].assigned_color);
}

View File

@ -353,8 +353,7 @@ TEST_P(validation_test, invalid_type_encoding)
* encodings are rejected by the validator.
*/
int e;
BITSET_WORD tmp;
BITSET_FOREACH_SET(e, tmp, invalid_encodings, num_encodings) {
BITSET_FOREACH_SET(e, invalid_encodings, num_encodings) {
if (file == FIXED_GRF) {
brw_MOV(p, g0, g0);
brw_inst_set_src0_vstride(&devinfo, last_inst, BRW_VERTICAL_STRIDE_4);
@ -432,8 +431,7 @@ TEST_P(validation_test, invalid_type_encoding_3src_a16)
* encodings are rejected by the validator.
*/
int e;
BITSET_WORD tmp;
BITSET_FOREACH_SET(e, tmp, invalid_encodings, num_encodings) {
BITSET_FOREACH_SET(e, invalid_encodings, num_encodings) {
for (unsigned i = 0; i < 2; i++) {
if (i == 0) {
brw_MAD(p, g0, g0, g0, g0);
@ -525,8 +523,7 @@ TEST_P(validation_test, invalid_type_encoding_3src_a1)
* encodings are rejected by the validator.
*/
int e;
BITSET_WORD tmp;
BITSET_FOREACH_SET(e, tmp, invalid_encodings, num_encodings) {
BITSET_FOREACH_SET(e, invalid_encodings, num_encodings) {
const unsigned hw_type = e & 0x7;
const unsigned exec_type = e >> 3;

View File

@ -568,9 +568,8 @@ perf_monitor_result_size(const struct gl_context *ctx,
for (group = 0; group < ctx->PerfMonitor.NumGroups; group++) {
const struct gl_perf_monitor_group *g = &ctx->PerfMonitor.Groups[group];
BITSET_WORD tmp;
BITSET_FOREACH_SET(counter, tmp, m->ActiveCounters[group], g->NumCounters) {
BITSET_FOREACH_SET(counter, m->ActiveCounters[group], g->NumCounters) {
const struct gl_perf_monitor_counter *c = &g->Counters[counter];
size += sizeof(uint32_t); /* Group ID */

View File

@ -88,9 +88,8 @@ init_perf_monitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
for (gid = 0; gid < ctx->PerfMonitor.NumGroups; gid++) {
const struct gl_perf_monitor_group *g = &ctx->PerfMonitor.Groups[gid];
const struct st_perf_monitor_group *stg = &st->perfmon[gid];
BITSET_WORD tmp;
BITSET_FOREACH_SET(cid, tmp, m->ActiveCounters[gid], g->NumCounters) {
BITSET_FOREACH_SET(cid, m->ActiveCounters[gid], g->NumCounters) {
const struct st_perf_monitor_counter *stc = &stg->counters[cid];
struct st_perf_counter_object *cntr =
&stm->active_counters[stm->num_active_counters];

View File

@ -300,8 +300,7 @@ mir_update_worklist(
* where possible. */
unsigned i;
BITSET_WORD tmp;
BITSET_FOREACH_SET(i, tmp, done->dependents, count) {
BITSET_FOREACH_SET(i, done->dependents, count) {
assert(instructions[i]->nr_dependencies);
if (!(--instructions[i]->nr_dependencies))
@ -482,7 +481,6 @@ mir_choose_instruction(
/* Iterate to find the best instruction satisfying the predicate */
unsigned i;
BITSET_WORD tmp;
signed best_index = -1;
bool best_conditional = false;
@ -494,11 +492,11 @@ mir_choose_instruction(
unsigned max_active = 0;
unsigned max_distance = 6;
BITSET_FOREACH_SET(i, tmp, worklist, count) {
BITSET_FOREACH_SET(i, worklist, count) {
max_active = MAX2(max_active, i);
}
BITSET_FOREACH_SET(i, tmp, worklist, count) {
BITSET_FOREACH_SET(i, worklist, count) {
if ((max_active - i) >= max_distance)
continue;

View File

@ -133,13 +133,13 @@ __bitset_next_set(unsigned i, BITSET_WORD *tmp,
* Iterates over each set bit in a set
*
* @param __i iteration variable, bit number
* @param __tmp an internally-used temporary bitset
* @param __set the bitset to iterate (will not be modified)
* @param __size number of bits in the set to consider
*/
#define BITSET_FOREACH_SET(__i, __tmp, __set, __size) \
for (__tmp = *(__set), __i = 0; \
(__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
#define BITSET_FOREACH_SET(__i, __set, __size) \
for (BITSET_WORD __tmp = *(__set), *__foo = &__tmp; __foo != NULL; __foo = NULL) \
for (__i = 0; \
(__i = __bitset_next_set(__i, &__tmp, __set, __size)) < __size;)
#ifdef __cplusplus

View File

@ -342,10 +342,9 @@ void
ra_make_reg_conflicts_transitive(struct ra_regs *regs, unsigned int r)
{
struct ra_reg *reg = &regs->regs[r];
BITSET_WORD tmp;
int c;
BITSET_FOREACH_SET(c, tmp, reg->conflicts, regs->count) {
BITSET_FOREACH_SET(c, reg->conflicts, regs->count) {
struct ra_reg *other = &regs->regs[c];
unsigned i;
for (i = 0; i < BITSET_WORDS(regs->count); i++)