diff --git a/src/asahi/compiler/agx_dce.c b/src/asahi/compiler/agx_dce.c index ae75c46cb37..41f78592fd0 100644 --- a/src/asahi/compiler/agx_dce.c +++ b/src/asahi/compiler/agx_dce.c @@ -12,7 +12,7 @@ void agx_dce(agx_context *ctx, bool partial) { - BITSET_WORD *seen = calloc(BITSET_WORDS(ctx->alloc), sizeof(BITSET_WORD)); + BITSET_WORD *seen = BITSET_CALLOC(ctx->alloc); agx_foreach_block(ctx, block) { if (block->loop_header) { diff --git a/src/asahi/compiler/agx_optimizer.c b/src/asahi/compiler/agx_optimizer.c index d7a81ae955c..67f1d155fde 100644 --- a/src/asahi/compiler/agx_optimizer.c +++ b/src/asahi/compiler/agx_optimizer.c @@ -599,7 +599,7 @@ void agx_optimizer_backward(agx_context *ctx) { agx_instr **uses = calloc(ctx->alloc, sizeof(*uses)); - BITSET_WORD *multiple = calloc(BITSET_WORDS(ctx->alloc), sizeof(*multiple)); + BITSET_WORD *multiple = BITSET_CALLOC(ctx->alloc); agx_foreach_block_rev(ctx, block) { /* Phi sources are logically read at the end of predecessor, so process diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index bbd88ab05be..dfb032aee3b 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -1461,7 +1461,7 @@ agx_ra(agx_context *ctx) enum ra_class *classes = calloc(ctx->alloc, sizeof(enum ra_class)); agx_instr **src_to_collect_phi = calloc(ctx->alloc, sizeof(agx_instr *)); enum agx_size *sizes = calloc(ctx->alloc, sizeof(enum agx_size)); - BITSET_WORD *visited = calloc(BITSET_WORDS(ctx->alloc), sizeof(BITSET_WORD)); + BITSET_WORD *visited = BITSET_CALLOC(ctx->alloc); unsigned max_ncomps = 1; agx_foreach_instr_global(ctx, I) { diff --git a/src/asahi/compiler/agx_validate.c b/src/asahi/compiler/agx_validate.c index 990ce4449f1..788b5e5ecb5 100644 --- a/src/asahi/compiler/agx_validate.c +++ b/src/asahi/compiler/agx_validate.c @@ -512,7 +512,7 @@ agx_validate(agx_context *ctx, const char *after) } { - BITSET_WORD *defs = calloc(sizeof(BITSET_WORD), BITSET_WORDS(ctx->alloc)); + BITSET_WORD *defs = BITSET_CALLOC(ctx->alloc); agx_foreach_instr_global(ctx, I) { if (!agx_validate_defs(I, defs)) { diff --git a/src/compiler/nir/nir_lower_int_to_float.c b/src/compiler/nir/nir_lower_int_to_float.c index dc107de07e5..67d2a5291e9 100644 --- a/src/compiler/nir/nir_lower_int_to_float.c +++ b/src/compiler/nir/nir_lower_int_to_float.c @@ -262,10 +262,8 @@ nir_lower_int_to_float_impl(nir_function_impl *impl) nir_builder b = nir_builder_create(impl); nir_index_ssa_defs(impl); - float_types = calloc(BITSET_WORDS(impl->ssa_alloc), - sizeof(BITSET_WORD)); - int_types = calloc(BITSET_WORDS(impl->ssa_alloc), - sizeof(BITSET_WORD)); + float_types = BITSET_CALLOC(impl->ssa_alloc); + int_types = BITSET_CALLOC(impl->ssa_alloc); nir_gather_types(impl, float_types, int_types); nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_opt_preamble.c b/src/compiler/nir/nir_opt_preamble.c index d620d881cd1..76d8e8f0f63 100644 --- a/src/compiler/nir/nir_opt_preamble.c +++ b/src/compiler/nir/nir_opt_preamble.c @@ -931,8 +931,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, * we did. */ ctx.reconstructed_ifs = _mesa_pointer_set_create(NULL); - ctx.reconstructed_defs = calloc(BITSET_WORDS(impl->ssa_alloc), - sizeof(BITSET_WORD)); + ctx.reconstructed_defs = BITSET_CALLOC(impl->ssa_alloc); analyze_reconstructed(&ctx, impl); /* If we make progress analyzing speculation, we need to re-analyze diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index c9fbaab976f..8c6d698a757 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -2433,8 +2433,8 @@ print_function_impl(nir_function_impl *impl, print_state *state, bool print_name * nir_print don't modify the shader. If needed, a limit for ssa_alloc * can be added. */ - state->float_types = calloc(BITSET_WORDS(impl->ssa_alloc), sizeof(BITSET_WORD)); - state->int_types = calloc(BITSET_WORDS(impl->ssa_alloc), sizeof(BITSET_WORD)); + state->float_types = BITSET_CALLOC(impl->ssa_alloc); + state->int_types = BITSET_CALLOC(impl->ssa_alloc); nir_gather_types(impl, state->float_types, state->int_types); } diff --git a/src/compiler/nir/nir_trivialize_registers.c b/src/compiler/nir/nir_trivialize_registers.c index a32341fad32..49ed608ab88 100644 --- a/src/compiler/nir/nir_trivialize_registers.c +++ b/src/compiler/nir/nir_trivialize_registers.c @@ -136,8 +136,7 @@ trivialize_loads(nir_function_impl *impl, nir_block *block) { struct trivialize_src_state state = { .block = block, - .trivial_loads = calloc(BITSET_WORDS(impl->ssa_alloc), - sizeof(BITSET_WORD)), + .trivial_loads = BITSET_CALLOC(impl->ssa_alloc), }; nir_foreach_instr_safe(instr, block) { diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 41e80aef235..59cfa753290 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -339,8 +339,7 @@ dri2_wl_formats_init(struct dri2_wl_formats *formats) * represent all the formats of dri2_wl_visuals. We use BITSET_WORDS for * this task. */ formats->num_formats = ARRAY_SIZE(dri2_wl_visuals); - formats->formats_bitmap = calloc(BITSET_WORDS(formats->num_formats), - sizeof(*formats->formats_bitmap)); + formats->formats_bitmap = BITSET_CALLOC(formats->num_formats); if (!formats->formats_bitmap) goto err; diff --git a/src/panfrost/compiler/bi_opt_dce.c b/src/panfrost/compiler/bi_opt_dce.c index 4af84c12461..b86abbcfeb6 100644 --- a/src/panfrost/compiler/bi_opt_dce.c +++ b/src/panfrost/compiler/bi_opt_dce.c @@ -33,8 +33,7 @@ void bi_opt_dce(bi_context *ctx, bool partial) { - BITSET_WORD *seen = - calloc(BITSET_WORDS(ctx->ssa_alloc), sizeof(BITSET_WORD)); + BITSET_WORD *seen = BITSET_CALLOC(ctx->ssa_alloc); bi_foreach_block(ctx, block) { if (block->loop_header) { diff --git a/src/panfrost/compiler/bi_opt_mod_props.c b/src/panfrost/compiler/bi_opt_mod_props.c index 67c44905d9e..bb4e092caa2 100644 --- a/src/panfrost/compiler/bi_opt_mod_props.c +++ b/src/panfrost/compiler/bi_opt_mod_props.c @@ -407,7 +407,7 @@ bi_opt_mod_prop_backward(bi_context *ctx) { unsigned count = ctx->ssa_alloc; bi_instr **uses = calloc(count, sizeof(*uses)); - BITSET_WORD *multiple = calloc(BITSET_WORDS(count), sizeof(*multiple)); + BITSET_WORD *multiple = BITSET_CALLOC(count); bi_foreach_block_rev(ctx, block) { /* Watch out for PHI instructions in loops! diff --git a/src/panfrost/compiler/bi_ra.c b/src/panfrost/compiler/bi_ra.c index ad8ee7a410c..fe981c3a0e8 100644 --- a/src/panfrost/compiler/bi_ra.c +++ b/src/panfrost/compiler/bi_ra.c @@ -596,8 +596,7 @@ static signed bi_choose_spill_node(bi_context *ctx, struct lcra_state *l) { /* Pick a node satisfying bi_spill_register's preconditions */ - BITSET_WORD *no_spill = - calloc(sizeof(BITSET_WORD), BITSET_WORDS(l->node_count)); + BITSET_WORD *no_spill = BITSET_CALLOC(l->node_count); bi_foreach_instr_global(ctx, ins) { bi_foreach_dest(ins, d) { @@ -1042,10 +1041,8 @@ bi_out_of_ssa(bi_context *ctx) * algorithm is quadratic. This will go away when we go out of SSA after * RA. */ - BITSET_WORD *used = - calloc(sizeof(BITSET_WORD), BITSET_WORDS(ctx->ssa_alloc)); - BITSET_WORD *multiple_uses = - calloc(sizeof(BITSET_WORD), BITSET_WORDS(ctx->ssa_alloc)); + BITSET_WORD *used = BITSET_CALLOC(ctx->ssa_alloc); + BITSET_WORD *multiple_uses = BITSET_CALLOC(ctx->ssa_alloc); bi_foreach_instr_global(ctx, I) { bi_foreach_ssa_src(I, s) { diff --git a/src/panfrost/compiler/bifrost/bi_schedule.c b/src/panfrost/compiler/bifrost/bi_schedule.c index 794339ed085..1cba7dd8108 100644 --- a/src/panfrost/compiler/bifrost/bi_schedule.c +++ b/src/panfrost/compiler/bifrost/bi_schedule.c @@ -231,7 +231,7 @@ bi_create_dependency_graph(struct bi_worklist st, bool inorder, bool is_blend) /* Initialize dependency graph */ for (unsigned i = 0; i < st.count; ++i) { - st.dependents[i] = calloc(BITSET_WORDS(st.count), sizeof(BITSET_WORD)); + st.dependents[i] = BITSET_CALLOC(st.count); st.dep_counts[i] = 0; } @@ -510,7 +510,7 @@ bi_initialize_worklist(bi_block *block, bool inorder, bool is_blend) st.dep_counts = calloc(st.count, sizeof(st.dep_counts[0])); bi_create_dependency_graph(st, inorder, is_blend); - st.worklist = calloc(BITSET_WORDS(st.count), sizeof(BITSET_WORD)); + st.worklist = BITSET_CALLOC(st.count); for (unsigned i = 0; i < st.count; ++i) { if (st.dep_counts[i] == 0) diff --git a/src/panfrost/midgard/midgard_helper_invocations.c b/src/panfrost/midgard/midgard_helper_invocations.c index 58cd29a42ec..324ad4fd744 100644 --- a/src/panfrost/midgard/midgard_helper_invocations.c +++ b/src/panfrost/midgard/midgard_helper_invocations.c @@ -190,7 +190,7 @@ mir_analyze_helper_requirements(compiler_context *ctx) { mir_compute_temp_count(ctx); unsigned temp_count = ctx->temp_count; - BITSET_WORD *deps = calloc(sizeof(BITSET_WORD), BITSET_WORDS(temp_count)); + BITSET_WORD *deps = BITSET_CALLOC(temp_count); /* Initialize with the sources of instructions consuming * derivatives */ diff --git a/src/panfrost/midgard/midgard_nir_type_csel.c b/src/panfrost/midgard/midgard_nir_type_csel.c index c8e58203538..d6759331cfe 100644 --- a/src/panfrost/midgard/midgard_nir_type_csel.c +++ b/src/panfrost/midgard/midgard_nir_type_csel.c @@ -29,8 +29,7 @@ midgard_nir_type_csel(nir_shader *shader) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_index_ssa_defs(impl); - BITSET_WORD *float_types = - calloc(BITSET_WORDS(impl->ssa_alloc), sizeof(BITSET_WORD)); + BITSET_WORD *float_types = BITSET_CALLOC(impl->ssa_alloc); nir_gather_types(impl, float_types, NULL); bool progress = diff --git a/src/panfrost/midgard/midgard_opt_prop.c b/src/panfrost/midgard/midgard_opt_prop.c index 7246421dc9b..93a35f70c89 100644 --- a/src/panfrost/midgard/midgard_opt_prop.c +++ b/src/panfrost/midgard/midgard_opt_prop.c @@ -163,7 +163,7 @@ midgard_opt_prop_backward(compiler_context *ctx) { bool progress = false; enum outmod_state *state = calloc(ctx->temp_count, sizeof(*state)); - BITSET_WORD *folded = calloc(BITSET_WORDS(ctx->temp_count), sizeof(*folded)); + BITSET_WORD *folded = BITSET_CALLOC(ctx->temp_count); /* Scan for outmod states */ mir_foreach_instr_global(ctx, I) { diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 6209a4e9633..bc5796a01a1 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -113,8 +113,7 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count, /* Initialize dependency graph */ for (unsigned i = 0; i < count; ++i) { - instructions[i]->dependents = - calloc(BITSET_WORDS(count), sizeof(BITSET_WORD)); + instructions[i]->dependents = BITSET_CALLOC(count); instructions[i]->nr_dependencies = 0; } diff --git a/src/panfrost/midgard/mir_promote_uniforms.c b/src/panfrost/midgard/mir_promote_uniforms.c index b16d141b727..218ccc3e9bc 100644 --- a/src/panfrost/midgard/mir_promote_uniforms.c +++ b/src/panfrost/midgard/mir_promote_uniforms.c @@ -253,8 +253,7 @@ static BITSET_WORD * mir_special_indices(compiler_context *ctx) { mir_compute_temp_count(ctx); - BITSET_WORD *bset = - calloc(BITSET_WORDS(ctx->temp_count), sizeof(BITSET_WORD)); + BITSET_WORD *bset = BITSET_CALLOC(ctx->temp_count); mir_foreach_instr_global(ctx, ins) { /* Look for special instructions */