This simplifies the backend's ability to generate rules.
In reality, we probably don't need to generate the assignment, just move the executable, then create a reference to it in the test.
This likely needs to run in a late set of passes. It's also possible that this will undo something that constant-combining has done, and still creates a position where the backend needs to know about assignments, something I'm not sure it does.
I'm not exactly sure what the end result of this needs to be. It may be fine to just leave a reference to the target at the top level and nested. Needs more thought.
We really want to have all of our targets at the top level, so if we come across code like:
we need to transform it into something like, like
This simplifies the backend's ability to generate rules.
In reality, we probably don't need to generate the assignment, just move the executable, then create a reference to it in the test.
This likely needs to run in a late set of passes. It's also possible that this will undo something that constant-combining has done, and still creates a position where the backend needs to know about assignments, something I'm not sure it does.