[code-reflection] RFR: Normalize blocks transformer
Paul Sandoz
psandoz at openjdk.org
Mon Sep 23 21:21:35 UTC 2024
A model transformer that normalizes blocks. Merges redundant blocks with their predecessors, those which are unconditionally branched to and have only one predecessor. Removes unused block parameters.
This is useful to normalize models that have been lowered or lifted and contain redundant blocks.
--
Observation: transformers can be stateless or stateful. Currently for the latter we cannot expose an `OpTransformer` instance since it can really only be used once it it accumulates state that may be incorrect on subsequent transformations. What may be required is the concept of a transformer that provides two or more methods that return functional interfaces for separate aspects (like `Collector` or `Gatherer`), such as a function to produce a state object, and a function to transform given that state object. The state object might be produced by traversing the model before it is transformed. Something to consider later in a refactoring of this API.
-------------
Commit messages:
- Remove trailing WS.
- Normalize blocks
- Use HashSet
- Merge blocks transformer.
Changes: https://git.openjdk.org/babylon/pull/238/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=238&range=00
Stats: 416 lines in 4 files changed: 415 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/babylon/pull/238.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/238/head:pull/238
PR: https://git.openjdk.org/babylon/pull/238
More information about the babylon-dev
mailing list