nir: Fix the Mesa build without -DDEBUG.

With -DDEBUG -UNDEBUG, this assert uses reg_state::stack_size, which
doesn't exist, breaking the build:

assert(state->states[index].index < state->states[index].stack_size);

Switch it to ifndef NDEBUG, so the field will exist if the assertion
actually generates code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke 2015-02-20 12:31:31 -08:00
parent bef38f62e0
commit b6393d7040
1 changed files with 2 additions and 2 deletions

View File

@ -134,7 +134,7 @@ typedef struct {
nir_ssa_def **stack; nir_ssa_def **stack;
int index; int index;
unsigned num_defs; /** < used to add indices to debug names */ unsigned num_defs; /** < used to add indices to debug names */
#ifdef DEBUG #ifndef NDEBUG
unsigned stack_size; unsigned stack_size;
#endif #endif
} reg_state; } reg_state;
@ -489,7 +489,7 @@ init_rewrite_state(nir_function_impl *impl, rewrite_state *state)
state->states[reg->index].stack = ralloc_array(state->states, state->states[reg->index].stack = ralloc_array(state->states,
nir_ssa_def *, nir_ssa_def *,
stack_size); stack_size);
#ifdef DEBUG #ifndef NDEBUG
state->states[reg->index].stack_size = stack_size; state->states[reg->index].stack_size = stack_size;
#endif #endif
state->states[reg->index].index = -1; state->states[reg->index].index = -1;