On Thu Oct 5 14:22:53 2023 +0000, Giovanni Mascellani wrote:
Another alternative would be to have something like that:
struct hlsl_ir_switch { struct hlsl_ir_node; struct hlsl_src selector; struct hlsl_block body; }
and then have `case` to be another instruction type. Right now I can't see any strong reasons to prefer one over the other, but maybe it wouldn't be bad to give it some thought. Have you already considered if one of those two alternatives would be easier to deal with than the other?
I did, I think. Thing is 'case' is not meaningful outside of switches, and is not something to support on its own when writing out instructions. The argument for it might be to avoid adding more types, and use what we already have - blocks. Another option might be to add IR_JUMP_CASE for it, and use hlsl_ir_jump.condition for hlsl_ir_switch_case.value.