Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3dcompiler_43/d3dcompiler_private.h | 2 +- dlls/d3dcompiler_43/hlsl.y | 19 +++++++------------ dlls/d3dcompiler_43/utils.c | 7 +++++-- 3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 4bf1ce8f1b1..34e89170696 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -750,7 +750,7 @@ struct hlsl_ir_loop { struct hlsl_ir_node node; /* loop condition is stored in the body (as "if (!condition) break;") */ - struct list *body; + struct list body; unsigned int next_index; /* liveness index of the end of the loop */ };
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 6c6ace12dba..a83794f6570 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -360,24 +360,21 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l goto oom; init_node(&loop->node, HLSL_IR_LOOP, NULL, loc); list_add_tail(list, &loop->node.entry); - loop->body = d3dcompiler_alloc(sizeof(*loop->body)); - if (!loop->body) - goto oom; - list_init(loop->body); + list_init(&loop->body);
if (!append_conditional_break(cond)) goto oom;
if (type != LOOP_DO_WHILE) - list_move_tail(loop->body, cond); + list_move_tail(&loop->body, cond);
- list_move_tail(loop->body, body); + list_move_tail(&loop->body, body);
if (iter) - list_move_tail(loop->body, iter); + list_move_tail(&loop->body, iter);
if (type == LOOP_DO_WHILE) - list_move_tail(loop->body, cond); + list_move_tail(&loop->body, cond);
d3dcompiler_free(init); d3dcompiler_free(cond); @@ -386,8 +383,6 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l
oom: ERR("Out of memory.\n"); - if (loop) - d3dcompiler_free(loop->body); d3dcompiler_free(loop); d3dcompiler_free(cond_jump); d3dcompiler_free(list); @@ -2858,7 +2853,7 @@ static unsigned int index_instructions(struct list *instrs, unsigned int index) } else if (instr->type == HLSL_IR_LOOP) { - index = index_instructions(loop_from_node(instr)->body, index); + index = index_instructions(&loop_from_node(instr)->body, index); loop_from_node(instr)->next_index = index; } } @@ -2920,7 +2915,7 @@ static void compute_liveness_recurse(struct list *instrs, unsigned int loop_firs case HLSL_IR_LOOP: { struct hlsl_ir_loop *loop = loop_from_node(instr); - compute_liveness_recurse(loop->body, loop_first ? loop_first : instr->index, + compute_liveness_recurse(&loop->body, loop_first ? loop_first : instr->index, loop_last ? loop_last : loop->next_index); break; } diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index 8599ffe69ad..336bf0d9bcf 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -2027,7 +2027,7 @@ static void debug_dump_ir_if(const struct hlsl_ir_if *if_node) static void debug_dump_ir_loop(const struct hlsl_ir_loop *loop) { wine_dbg_printf("for (;;)\n{\n"); - debug_dump_instr_list(loop->body); + debug_dump_instr_list(&loop->body); wine_dbg_printf("}\n"); }
@@ -2165,7 +2165,10 @@ static void free_ir_if(struct hlsl_ir_if *if_node)
static void free_ir_loop(struct hlsl_ir_loop *loop) { - free_instr_list(loop->body); + struct hlsl_ir_node *node, *next_node; + + LIST_FOR_EACH_ENTRY_SAFE(node, next_node, &loop->body, struct hlsl_ir_node, entry) + free_instr(node); d3dcompiler_free(loop); }