Closed EmilySillars closed 1 year ago
This PR adds a simple inlining pass to the SSLANG compiler. This "simplifier" pass is split into parts—occurrence analysis, followed by inlining. It is inspired by Secrets of the Glasgow Haskell Compiler inliner. Our inliner supports pre-inline unconditionally and post-inline unconditionally, which correspond to replacing binder x with value e when x gets marked by the occurrence analyzer as one of three cases: 1) Dead: Does not appear at all 2) OnceSafe: Appears once, NOT inside a lambda 3) MultiSafe: The binder occurs at most ONCE in each of several distinct case branches; NONE of these ocurrences is inside a lambda
Regression Tests Added: inlining-ex-1.ssl inlining-ex-2.ssl inlining-ex-3.ssl inlining-ex-4.ssl inlining-ex-5.ssl
TODO/Future Work:
Made this a draft PR so if we want to comment on our work as we code we can!