hlsl: Replace bare list pointers with hlsl_block, part 1.
2 unresolved threads
2 unresolved threads
This introduces temporary helpers block_to_list and list_to_block.
The job of block_to_list(), at least, could be done by simply writing "&block->instrs" everywhere instead. Using the helper instead ensures that all of these instances will eventually be converted.
Merge request reports
Activity
+static struct list *block_to_list(struct hlsl_block *block) +{ + /* This is a temporary hack to ease the transition from lists to blocks. + * It takes advantage of the fact that an allocated hlsl_block pointer is + * byte-compatible with an allocated list pointer. */ + return (struct list *)block; +} + +static struct hlsl_block *list_to_block(struct list *list) +{ + /* This is a temporary hack to ease the transition from lists to blocks. + * It takes advantage of the fact that an allocated hlsl_block pointer is + * byte-compatible with an allocated list pointer. */ + return (struct hlsl_block *)list; +}
We probably don't care all that much for something temporary like this, but we could as well have done this properly as "return &block->instrs;" and "return CONTAINING_RECORD(list, struct hlsl_block, instrs);".
5760 5760 KW_IF '(' expr ')' if_body 5761 5761 { 5762 5762 struct hlsl_ir_node *condition = node_from_list($3); 5763 struct hlsl_block then_block, else_block; 5764 5763 struct hlsl_ir_node *instr; 5765 5764 5766 hlsl_block_init(&then_block); 5767 list_move_tail(&then_block.instrs, $5.then_block); 5768 hlsl_block_init(&else_block); 5769 if ($5.else_block) 5770 list_move_tail(&else_block.instrs, $5.else_block); 5765 if (!(instr = hlsl_new_if(ctx, condition, $5.then_block, $5.else_block, &@1))) 5766 { 5767 vkd3d_free($5.then_block); changed this line in version 2 of the diff
added 9 commits
-
a3c07f60...df0a031a - 4 commits from branch
wine:master
- b653b36e - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
- ceac8b7c - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
- 5e57b77a - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
- 67c9b02c - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
- 651b2a18 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
Toggle commit list-
a3c07f60...df0a031a - 4 commits from branch
added 42 commits
-
651b2a18...3aee386e - 37 commits from branch
wine:master
- 54caa34f - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
- 49b96df8 - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
- 1301907f - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
- 3a0e3bb8 - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
- 28d93781 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
Toggle commit list-
651b2a18...3aee386e - 37 commits from branch
added 1 commit
- 88731986 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
added 5 commits
- b4bf5af4 - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
- 588784e4 - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
- 7d521db3 - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
- 8fa17502 - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
- 9ccba35d - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.
Toggle commit list
Please register or sign in to reply