Zebediah Figura : d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl.

Alexandre Julliard julliard at winehq.org
Wed Aug 14 20:17:23 CDT 2019


Module: wine
Branch: master
Commit: 32fd9ff4791e2c50a2e3ca049a85334424e87478
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=32fd9ff4791e2c50a2e3ca049a85334424e87478

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Aug 13 10:23:31 2019 -0500

d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 0506b16..d9befd1 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 5585b89..7c14ad00 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 d2275da..ca603e4 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",




More information about the wine-cvs mailing list