|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Library node expansion pass. More...
Go to the source code of this file.
Library node expansion pass.
This file defines a peephole optimizer that will find all LibraryNodes with ImplementationType_NONE in the graph and attempt to expand all of them into more baser operations. It internally uses a list of LibNodeExpanders, so there could be multiple alternative variants to expand a given node, but for now it simply redirects to MathNode.expand() to stay more compatible with existing code.
The pass tries to isolate the contents of the expansion from the surrounding SDFG as best as possible, handling finding access nodes or moving edges in a generic way. This makes expansions simpler and allows us to upgrade the passes' handling in the future, for example to cut Dataflow into multiple parts to allow for expansion.
To achieve this, every Expander is given a context and the block to do preliminary checks, whether it can / wants to expand this node with its properties. Access to src and dest edges may be neccessary, as some LibraryNodes currently infer their data types from other nodes. Access to src and dest nodes however should be avoided, as the pass may change or remove them.
In case, an Expander wants to proceed with the expansion, it needs to call one of the available methods on the ExpansionContext: