On Thursday, 2 June 2022 at 21:47:06 UTC, deadalnix wrote:
> I would like to know what you think about sea of node vs SSA on this front?
I'm looking at significantly changing SDC's IR now that I have a better idea of what it should look like, but I'm not quite sure which of the two would be more suitable.
It is very difficult to be sure about anything a priori as it will have to be designed for the passes you want to make, or maybe it should be designed so that it is easy to translate to a specialized IRs, or maybe it should be designed so that your IR can be annotated and extended for future passes that has not been decided upon yet. Many options…
It is important to retain all the type information and constraints so that they can be exploited. One weakness in Clang is that the translation to the LLVM IR has tossed away too much information (type/constraints). Maybe ask yourself if there is some information worth retaining from template expansion, like template constraints? Constraints = opportunities to deduce.
I guess one would want to start by listing the passes you wish to perform and the information you need to do so. Maybe look at what data structures Swift has landed on to support ARC passes? Another thing worth looking at is Boogie, which performs some transforms so that asserts in functions can be resolved (on a lucky day) by an SMT solver.
I wouldn't say you have to do this or that, but a graph of nodes is always the natural option when you want to allow future extensions. You can worry about performance later, I would go for something that is flexible and "bug resistant". Basic blocks can be a single node, if you want, so it might not be an either-or choice. I don't think you will be sure what is right until you write some passes.
Maybe start with something minimal (for a language subset) and try to write som passes for that minimal subset, then you get a feel for what you need. I think I would do that, so you can try different options with lower costs.