[PATCH 1/4] d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl.

Zebediah Figura zfigura at codeweavers.com
Tue Aug 13 10:23:31 CDT 2019


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/d3dcompiler_43/d3dcompiler_private.h |  4 ++--
 dlls/d3dcompiler_43/hlsl.y                | 20 ++++++++++----------
 dlls/d3dcompiler_43/utils.c               |  4 +---
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 1ab343de2d8..01f6ce0e60a 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -712,7 +712,6 @@ enum hlsl_ir_node_type
     HLSL_IR_CONSTRUCTOR,
     HLSL_IR_DEREF,
     HLSL_IR_EXPR,
-    HLSL_IR_FUNCTION_DECL,
     HLSL_IR_IF,
     HLSL_IR_LOOP,
     HLSL_IR_JUMP,
@@ -776,7 +775,8 @@ struct hlsl_ir_function
 
 struct hlsl_ir_function_decl
 {
-    struct hlsl_ir_node node;
+    struct hlsl_type *return_type;
+    struct source_location loc;
     struct wine_rb_entry entry;
     struct hlsl_ir_function *func;
     const char *semantic;
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 5585b899463..7c14ad0091c 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -1084,28 +1084,28 @@ hlsl_prog:                /* empty */
                                 {
                                     if (decl->body && $2.decl->body)
                                     {
-                                        hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
-                                                $2.decl->node.loc.col, HLSL_LEVEL_ERROR,
+                                        hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
+                                                $2.decl->loc.col, HLSL_LEVEL_ERROR,
                                                 "redefinition of function %s", debugstr_a($2.name));
                                         YYABORT;
                                     }
-                                    else if (!compare_hlsl_types(decl->node.data_type, $2.decl->node.data_type))
+                                    else if (!compare_hlsl_types(decl->return_type, $2.decl->return_type))
                                     {
-                                        hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
-                                                $2.decl->node.loc.col, HLSL_LEVEL_ERROR,
+                                        hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
+                                                $2.decl->loc.col, HLSL_LEVEL_ERROR,
                                                 "redefining function %s with a different return type",
                                                 debugstr_a($2.name));
-                                        hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE,
+                                        hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_NOTE,
                                                 "%s previously declared here",
                                                 debugstr_a($2.name));
                                         YYABORT;
                                     }
                                 }
 
-                                if ($2.decl->node.data_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
+                                if ($2.decl->return_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
                                 {
-                                    hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
-                                            $2.decl->node.loc.col, HLSL_LEVEL_ERROR,
+                                    hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
+                                            $2.decl->loc.col, HLSL_LEVEL_ERROR,
                                             "void function with a semantic");
                                 }
 
@@ -1280,7 +1280,7 @@ func_prototype:           var_modifiers type var_identifier '(' parameters ')' c
                                 }
                                 $$.name = $3;
                                 $$.decl->semantic = $7.semantic;
-                                set_location(&$$.decl->node.loc, &@3);
+                                set_location(&$$.decl->loc, &@3);
                             }
 
 compound_statement:       '{' '}'
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 5ecbbc9dc1d..ad2d02e1452 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1577,8 +1577,7 @@ struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struc
         ERR("Out of memory.\n");
         return NULL;
     }
-    decl->node.type = HLSL_IR_FUNCTION_DECL;
-    decl->node.data_type = return_type;
+    decl->return_type = return_type;
     decl->parameters = parameters;
 
     return decl;
@@ -1775,7 +1774,6 @@ static const char *debug_node_type(enum hlsl_ir_node_type type)
         "HLSL_IR_CONSTRUCTOR",
         "HLSL_IR_DEREF",
         "HLSL_IR_EXPR",
-        "HLSL_IR_FUNCTION_DECL",
         "HLSL_IR_IF",
         "HLSL_IR_JUMP",
         "HLSL_IR_SWIZZLE",
-- 
2.20.1




More information about the wine-devel mailing list