From 32fd9ff4791e2c50a2e3ca049a85334424e87478 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 13 Aug 2019 10:23:31 -0500 Subject: [PATCH] d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl. Signed-off-by: Zebediah Figura Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- 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 0506b16b3a2..d9befd1c1a3 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 d2275da97a6..ca603e4dcb8 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",