Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
f2b5f712
Commit
f2b5f712
authored
12 years ago
by
Matteo Bruni
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
d3dcompiler: Parse unary and prefix operators.
parent
e851bf21
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/d3dcompiler_43/d3dcompiler_private.h
+8
-0
8 additions, 0 deletions
dlls/d3dcompiler_43/d3dcompiler_private.h
dlls/d3dcompiler_43/hlsl.y
+58
-0
58 additions, 0 deletions
dlls/d3dcompiler_43/hlsl.y
with
66 additions
and
0 deletions
dlls/d3dcompiler_43/d3dcompiler_private.h
+
8
−
0
View file @
f2b5f712
...
...
@@ -904,6 +904,14 @@ struct parse_variable_def
struct
list
*
initializer
;
};
enum
parse_unary_op
{
UNARY_OP_PLUS
,
UNARY_OP_MINUS
,
UNARY_OP_LOGICNOT
,
UNARY_OP_BITNOT
,
};
struct
hlsl_parse_ctx
{
const
char
**
source_files
;
...
...
This diff is collapsed.
Click to expand it.
dlls/d3dcompiler_43/hlsl.y
+
58
−
0
View file @
f2b5f712
...
...
@@ -206,6 +206,7 @@ static unsigned int components_count_expr_list(struct list *list)
struct hlsl_ir_function_decl *function;
struct parse_parameter parameter;
struct parse_variable_def *variable_def;
enum parse_unary_op unary_op;
}
%token KW_BLENDSTATE
...
...
@@ -350,6 +351,7 @@ static unsigned int components_count_expr_list(struct list *list)
%type <instr> conditional_expr
%type <instr> assignment_expr
%type <list> expr_statement
%type <unary_op> unary_op
%type <modifiers> input_mod
%%
...
...
@@ -982,6 +984,62 @@ unary_expr: postfix_expr
{
$$ = $1;
}
| OP_INC unary_expr
{
struct hlsl_ir_node *operands[3];
struct source_location loc;
operands[0] = $2;
operands[1] = operands[2] = NULL;
set_location(&loc, &@1);
$$ = &new_expr(HLSL_IR_BINOP_PREINC, operands, &loc)->node;
}
| OP_DEC unary_expr
{
struct hlsl_ir_node *operands[3];
struct source_location loc;
operands[0] = $2;
operands[1] = operands[2] = NULL;
set_location(&loc, &@1);
$$ = &new_expr(HLSL_IR_BINOP_PREDEC, operands, &loc)->node;
}
| unary_op unary_expr
{
enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG,
HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT};
struct hlsl_ir_node *operands[3];
struct source_location loc;
if ($1 == UNARY_OP_PLUS)
{
$$ = $2;
}
else
{
operands[0] = $2;
operands[1] = operands[2] = NULL;
set_location(&loc, &@1);
$$ = &new_expr(ops[$1], operands, &loc)->node;
}
}
unary_op: '+'
{
$$ = UNARY_OP_PLUS;
}
| '-'
{
$$ = UNARY_OP_MINUS;
}
| '!'
{
$$ = UNARY_OP_LOGICNOT;
}
| '~'
{
$$ = UNARY_OP_BITNOT;
}
mul_expr: unary_expr
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment