[PATCH v2] d3dcompiler: Pass the instruction list to implicit_conversion().

Matteo Bruni mbruni at codeweavers.com
Mon Jun 22 15:53:01 CDT 2020


From: Zebediah Figura <z.figura12 at gmail.com>

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2: Rebase.

 dlls/d3dcompiler_43/d3dcompiler_private.h | 4 ++--
 dlls/d3dcompiler_43/hlsl.y                | 4 ++--
 dlls/d3dcompiler_43/utils.c               | 8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index d54b9088b68..97b84c44945 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -1059,6 +1059,8 @@ static inline void init_node(struct hlsl_ir_node *node, enum hlsl_ir_node_type t
 
 struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lhs,
         enum parse_assign_op assign_op, struct hlsl_ir_node *rhs) DECLSPEC_HIDDEN;
+struct hlsl_ir_node *add_implicit_conversion(struct list *instrs, struct hlsl_ir_node *node, struct hlsl_type *type,
+        struct source_location *loc) DECLSPEC_HIDDEN;
 
 BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
 struct hlsl_ir_var *get_variable(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
@@ -1077,8 +1079,6 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope
         struct source_location *loc) DECLSPEC_HIDDEN;
 struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type,
 	struct source_location *loc) DECLSPEC_HIDDEN;
-struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *type,
-        struct source_location *loc) DECLSPEC_HIDDEN;
 void push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
 BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
 void init_functions_tree(struct wine_rb_tree *funcs) DECLSPEC_HIDDEN;
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 5d8d7c56a76..efb1a69fea3 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -572,7 +572,7 @@ static struct hlsl_ir_jump *add_return(struct list *instrs,
     {
         struct hlsl_ir_assignment *assignment;
 
-        if (!(return_value = implicit_conversion(return_value, return_type, &loc)))
+        if (!(return_value = add_implicit_conversion(instrs, return_value, return_type, &loc)))
             return NULL;
 
         if (!(assignment = make_simple_assignment(hlsl_ctx.cur_function->return_var, return_value)))
@@ -2473,7 +2473,7 @@ postfix_expr:             primary_expr
                     continue;
                 }
 
-                if (!(arg = implicit_conversion(arg,
+                if (!(arg = add_implicit_conversion($4.instrs, arg,
                         hlsl_ctx.builtin_types.vector[$2->base_type][width - 1], &arg->loc)))
                     continue;
 
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 1c7b5727ebd..3f063e1a0ae 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1301,8 +1301,8 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type
     return new_hlsl_type(NULL, type, base, dimx, dimy);
 }
 
-struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *dst_type,
-        struct source_location *loc)
+struct hlsl_ir_node *add_implicit_conversion(struct list *instrs, struct hlsl_ir_node *node,
+        struct hlsl_type *dst_type, struct source_location *loc)
 {
     struct hlsl_type *src_type = node->data_type;
     struct hlsl_ir_expr *cast;
@@ -1324,7 +1324,7 @@ struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_
 
     if (!(cast = new_cast(node, dst_type, loc)))
         return NULL;
-    list_add_after(&node->entry, &cast->node.entry);
+    list_add_tail(instrs, &cast->node.entry);
     return &cast->node;
 }
 
@@ -1455,7 +1455,7 @@ struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lh
     {
         writemask = (1 << lhs_type->dimx) - 1;
 
-        if (!(rhs = implicit_conversion(rhs, lhs_type, &rhs->loc)))
+        if (!(rhs = add_implicit_conversion(instrs, rhs, lhs_type, &rhs->loc)))
             return NULL;
     }
 
-- 
2.26.2




More information about the wine-devel mailing list