diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2020-11-05 16:11:56 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-05 16:11:56 -0800 |
| commit | 0f6765b5ea8ea9bfddefc8f465cd504abb5f22f1 (patch) | |
| tree | 8765904cc057f9f5a00c6040348ff642d71f1cdf /source/slang/slang-ir-specialize-dispatch.cpp | |
| parent | c985f5f2f95dc95998fdfb8400baa0a04760ada2 (diff) | |
Refactor the flow of type legalization (#1594)
The existing type legalization logic worked as a single preorder pass over the IR tree. This could create problems in cases where an instruction might be processed before one of its operands (e.g., a function that references a global shader parameter is processed before that parameter).
This change makes it so that type legalization uses a work list, and only adds instructions to the work list once their parent, type, and operands have been processed. As a result, we should be able to guarantee that an instruction will only be processed once all of its operands have been.
One wrinkle here is that in the current IR it is possible to end up with a cycle of uses for global-scope instructions, specifically around interface types and their list of requirements. This change includes a short-term kludge to break those cycles and allow the pass to complete.
As it stands, this is simply a refactoring pass and no new functionality is introduced. The changes are necessary to unblock work in a feature branch that depends on type legalization being more robust against IR that might use an unexpected ordering.
Diffstat (limited to 'source/slang/slang-ir-specialize-dispatch.cpp')
0 files changed, 0 insertions, 0 deletions
