Conversation

I think this is essentially "finally tagless": instead of defining your structures (AST or IR) as data, define them as classes; in the parser resp. elaborator, "construct" the AST resp. IR by calling methods; make instances do elaboration, resp. perhaps code generation, directly.
1
1
You can also define instances to construct an actual AST/IR as data, if you need that, for example to do analysis/optimization. (I'm not sure if you couldn't also do those as a directly fused chain, but I'm pretty sure you couldn't if you need to compute fixed points.)
2
1
There also might be downsides in terms of blowing out your instruction cache (or something like that) with too much fusion, which could reduce throughput I think? But yeah, it would be interesting to measure this.
2
Replying to and
The basic condition is that you can fuse something away if you use it linearly... I don't have enough compiler-writing experience to know offhand which passes satisfy that and which ones don't, so that's a fun question.
1
1
Show replies