Revision 393e25fd2e2b8c5ff82ff4c6b14a9d7152d37a5e authored by Tim Foley on 18 December 2017, 23:14:59 UTC, committed by GitHub on 18 December 2017, 23:14:59 UTC
* Work on getting rewriter + IR playing nice together.

There are a few different changes here, with the goal of improving the interaction between the "rewriter" code generation approach and the new IR and type legalization code.

The main changes are:

- Add a new pass that occurs before the AST legalization pass, which walks the (used) AST declarations and tries to discover (1) which declarations need to be specialized/lowered via the IR, and (2) which declarations need to be included in the resulting AST module.

- AST-based legalization now uses the generated list when in "rewriter" mode, so that we should be working around issues that users were seeing with types not getting emitted.
  - TODO: we still need an equivalent fixup in the case of non-"rewriter" emit, so this may still be a problem for `.slang` files.

- IR type legalization now precedes AST legalization, so that we can record information on how any IR global values got legalized (e.g., if they got split). Then AST legalization includes logic to reconstruct suitable tuple expressions to reference a split global.

- When emitting using IR + AST, we walk all of the declarations that we decided belonged to the IR, but which were subsequently referenced in the AST, to make sure they get output (this would include `struct` types that are declared in a file compiled via IR, but never used in IR-based code).

The rewriter+IR use case still doesn't *quite* work, but the logic for walking the AST in a pre-pass ends up being needed/useful to fix some pure rewriter bugs, so I'm getting this checked in sooner rather than later.

* Fixup: walk arguments to generic declaration reference

The gotcha here is that the code for walking the AST would walk a line of code like:

    SomeType a;

and know to traverse the declaration of `SomeType`, but if it saw a line of code like:

    ParameterBlock<SomeType> b;

it would traverse the declaration of `ParameterBlock`, but fail to visit that of `SomeType`.
1 parent 46b68ed
History
File Mode Size
dxc
glslang @ 652db16
stb
glext.h -rw-r--r-- 792.3 KB

back to top