Description
This is the main unresolved TODO related to the efforts to support type declarations in CIRCT. We have a type called hw.typealias
, which holds a symbolic reference to a hw.typedecl
operation. However, during parsing, we may need to know about the referenced type, and don't seem to have a way to access it. This caused us to resort to duplicating the referenced type in the hw.typealias
, which is really bad!
For example, if there is a declaration of @__hw_typedecls::@foo
, which declares @foo
to be of type i1
, we'd have to have this type in the IR:
!hw.typealias<@__hw_typedecls::@foo, i1>,
We should figure out a way to drop that. It was discussed in a past MLIR ODM: https://www.youtube.com/watch?v=hqcM6fJWntM.
If I'm recalling correctly, a couple options have been discussed:
- Expose the OpBuilder through the Parser, and dig around in its insertion block to look for the declaration
- Expose a method on the Parser along the lines of "lookup a symbol you've already parsed"
I started looking into the first one once, but didn't make any definitive headway. I'm opening this issue it isn't forgotten.