[PATCH v3 2/3] d3dcompiler: Rename HLSL_IR_DEREF to HLSL_IR_LOAD.

Matteo Bruni matteo.mystral at gmail.com
Fri May 29 16:29:41 CDT 2020


On Fri, May 22, 2020 at 10:46 PM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>  dlls/d3dcompiler_43/d3dcompiler_private.h | 10 +--
>  dlls/d3dcompiler_43/hlsl.y                | 97 +++++++++++------------
>  dlls/d3dcompiler_43/utils.c               | 18 ++---
>  3 files changed, 62 insertions(+), 63 deletions(-)
>
> diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
> index 4b1f99de65d..440ad491884 100644
> --- a/dlls/d3dcompiler_43/utils.c
> +++ b/dlls/d3dcompiler_43/utils.c
> @@ -1527,7 +1527,7 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *lhs, enum parse_assign
>
>      rhs = implicit_conversion(rhs, type, &rhs->loc);
>
> -    assign->lhs = deref_from_node(lhs)->src;
> +    assign->lhs = load_from_node(lhs)->src;
>      if (assign_op != ASSIGN_OP_ASSIGN)
>      {
>          enum hlsl_ir_expr_op op = op_from_assignment(assign_op);

This is correct but at a first look it seemed suspicious to me. Typing
it down explicitly for my future self: this copies the struct
hlsl_deref from the load instruction generated earlier into the
assignment instruction. You need to generate the load because you
don't know that you are in the lhs of an assignment while parsing it
and creating the load instruction (and you will actually NEED the load
in the compound assignment case just below it). If the load turns out
to not be needed it can be trivially DCE'd later on.

> @@ -2096,8 +2096,8 @@ static void debug_dump_instr(const struct hlsl_ir_node *instr)
>          case HLSL_IR_EXPR:
>              debug_dump_ir_expr(expr_from_node(instr));
>              break;
> -        case HLSL_IR_DEREF:
> -            debug_dump_deref(&deref_from_node(instr)->src);
> +        case HLSL_IR_LOAD:
> +            debug_dump_deref(&load_from_node(instr)->src);
>              break;
>          case HLSL_IR_CONSTANT:
>              debug_dump_ir_constant(constant_from_node(instr));

It might be clearer to just give up on a single function for dumping
struct hlsl_ir_load vs struct hlsl_ir_assignment's LHS and spell out
"load" for the former (and probably "store" for the latter, getting
rid of the '=' thing - sounds like it makes sense to do this while
renaming the assignment instruction).



More information about the wine-devel mailing list