d3dcompiler: Parse relational operators, stub out more rules.
This commit is contained in:
parent
57a7479f77
commit
6c92d78c8c
@ -984,6 +984,18 @@ struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var) DECLSPEC_HIDDEN;
|
||||
void push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
|
@ -1012,46 +1012,120 @@ shift_expr: add_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| shift_expr OP_LEFTSHIFT add_expr
|
||||
{
|
||||
FIXME("Left shift\n");
|
||||
}
|
||||
| shift_expr OP_RIGHTSHIFT add_expr
|
||||
{
|
||||
FIXME("Right shift\n");
|
||||
}
|
||||
|
||||
relational_expr: shift_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| relational_expr '<' shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_lt($1, $3, &loc)->node;
|
||||
}
|
||||
| relational_expr '>' shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_gt($1, $3, &loc)->node;
|
||||
}
|
||||
| relational_expr OP_LE shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_le($1, $3, &loc)->node;
|
||||
}
|
||||
| relational_expr OP_GE shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_ge($1, $3, &loc)->node;
|
||||
}
|
||||
|
||||
equality_expr: relational_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| equality_expr OP_EQ relational_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_eq($1, $3, &loc)->node;
|
||||
}
|
||||
| equality_expr OP_NE relational_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_ne($1, $3, &loc)->node;
|
||||
}
|
||||
|
||||
bitand_expr: equality_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| bitand_expr '&' equality_expr
|
||||
{
|
||||
FIXME("bitwise AND\n");
|
||||
}
|
||||
|
||||
bitxor_expr: bitand_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| bitxor_expr '^' bitand_expr
|
||||
{
|
||||
FIXME("bitwise XOR\n");
|
||||
}
|
||||
|
||||
bitor_expr: bitxor_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| bitor_expr '|' bitxor_expr
|
||||
{
|
||||
FIXME("bitwise OR\n");
|
||||
}
|
||||
|
||||
logicand_expr: bitor_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| logicand_expr OP_AND bitor_expr
|
||||
{
|
||||
FIXME("logic AND\n");
|
||||
}
|
||||
|
||||
logicor_expr: logicand_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| logicor_expr OP_OR logicand_expr
|
||||
{
|
||||
FIXME("logic OR\n");
|
||||
}
|
||||
|
||||
conditional_expr: logicor_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| logicor_expr '?' expr ':' assignment_expr
|
||||
{
|
||||
FIXME("ternary operator\n");
|
||||
}
|
||||
|
||||
assignment_expr: conditional_expr
|
||||
{
|
||||
|
@ -1246,6 +1246,84 @@ struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_LESS, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_GREATER, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_LEQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_GEQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_EQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_NEQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var)
|
||||
{
|
||||
struct hlsl_ir_deref *deref = d3dcompiler_alloc(sizeof(*deref));
|
||||
|
Loading…
x
Reference in New Issue
Block a user