mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nir: Remove a bunch of large stack arrays
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
fa63fad333
commit
5c5f11d1dd
4 changed files with 15 additions and 6 deletions
|
|
@ -46,6 +46,9 @@ struct live_ssa_defs_state {
|
|||
unsigned num_ssa_defs;
|
||||
unsigned bitset_words;
|
||||
|
||||
/* Used in propagate_across_edge() */
|
||||
BITSET_WORD *tmp_live;
|
||||
|
||||
nir_block_worklist worklist;
|
||||
};
|
||||
|
||||
|
|
@ -121,7 +124,7 @@ static bool
|
|||
propagate_across_edge(nir_block *pred, nir_block *succ,
|
||||
struct live_ssa_defs_state *state)
|
||||
{
|
||||
NIR_VLA(BITSET_WORD, live, state->bitset_words);
|
||||
BITSET_WORD *live = state->tmp_live;
|
||||
memcpy(live, succ->live_in, state->bitset_words * sizeof *live);
|
||||
|
||||
nir_foreach_instr(instr, succ) {
|
||||
|
|
@ -176,6 +179,7 @@ nir_live_ssa_defs_impl(nir_function_impl *impl)
|
|||
* blocks to the worklist.
|
||||
*/
|
||||
state.bitset_words = BITSET_WORDS(state.num_ssa_defs);
|
||||
state.tmp_live = rzalloc_array(impl, BITSET_WORD, state.bitset_words);
|
||||
nir_foreach_block(block, impl) {
|
||||
init_liveness_block(block, &state);
|
||||
}
|
||||
|
|
@ -225,6 +229,7 @@ nir_live_ssa_defs_impl(nir_function_impl *impl)
|
|||
}
|
||||
}
|
||||
|
||||
ralloc_free(state.tmp_live);
|
||||
nir_block_worklist_fini(&state.worklist);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,14 +220,16 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
|
|||
nir_metadata_dominance);
|
||||
nir_index_local_regs(impl);
|
||||
|
||||
void *dead_ctx = ralloc_context(NULL);
|
||||
struct regs_to_ssa_state state;
|
||||
state.shader = impl->function->shader;
|
||||
state.values = malloc(impl->reg_alloc * sizeof(*state.values));
|
||||
state.values = ralloc_array(dead_ctx, struct nir_phi_builder_value *,
|
||||
impl->reg_alloc);
|
||||
|
||||
struct nir_phi_builder *phi_build = nir_phi_builder_create(impl);
|
||||
|
||||
const unsigned block_set_words = BITSET_WORDS(impl->num_blocks);
|
||||
NIR_VLA(BITSET_WORD, defs, block_set_words);
|
||||
BITSET_WORD *defs = ralloc_array(dead_ctx, BITSET_WORD, block_set_words);
|
||||
|
||||
nir_foreach_register(reg, &impl->registers) {
|
||||
if (reg->num_array_elems != 0) {
|
||||
|
|
@ -305,7 +307,7 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
|
|||
}
|
||||
}
|
||||
|
||||
free(state.values);
|
||||
ralloc_free(dead_ctx);
|
||||
|
||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
||||
nir_metadata_dominance);
|
||||
|
|
|
|||
|
|
@ -768,7 +768,9 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
|
|||
|
||||
state.phi_builder = nir_phi_builder_create(state.impl);
|
||||
|
||||
NIR_VLA(BITSET_WORD, store_blocks, BITSET_WORDS(state.impl->num_blocks));
|
||||
BITSET_WORD *store_blocks =
|
||||
ralloc_array(state.dead_ctx, BITSET_WORD,
|
||||
BITSET_WORDS(state.impl->num_blocks));
|
||||
foreach_list_typed(struct deref_node, node, direct_derefs_link,
|
||||
&state.direct_deref_nodes) {
|
||||
if (!node->lower_to_ssa)
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ void
|
|||
nir_phi_builder_finish(struct nir_phi_builder *pb)
|
||||
{
|
||||
const unsigned num_blocks = pb->num_blocks;
|
||||
NIR_VLA(nir_block *, preds, num_blocks);
|
||||
nir_block **preds = rzalloc_array(pb, nir_block *, num_blocks);
|
||||
|
||||
foreach_list_typed(struct nir_phi_builder_value, val, node, &pb->values) {
|
||||
/* We treat the linked list of phi nodes like a worklist. The list is
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue