Hello!
I might be off in my understanding of this so if that’s the case please feel free to ignore.
I am currently working on a new MLIR dialect (lets call it foo
) that is somewhat high-level.
This dialect is produced from the source AST of a high-level language that contains local scopes with local declarations.
How can we model these local declarations knowing that the built-in FunctionOp is not a SymbolTable
Op and thus we cannot add symbols to a function scope (or an mlir::Block
)?
An idea is to introduce a new Op called foo.block
that has the SymbolTable
trait.
However, this sounds simple enough for me to be worried that I might have missed something.
Surely others have encountered this ?
What would be the right way to go about handling local scopes in a custom dialect ?
P.S.: One of the optimizations we want to apply at that high-level dialect is that of constant folding. Having an initializer bundled together with a Symbol
Op can make this straight forward as you can trace back a symbol to its value.
Thank you in advance!
Thanasis.