LensPlaysGames/LensorCompilerCollection

[FEATURE] Types in the IR

LensPlaysGames opened this issue · 2 comments

It seems like all we have to do is "pass through" expr->type, during codegen, into expr->ir->type. The issue of this happening everywhere is the hardest part, though, because it's currently designed in a way where expr->ir is set and then return happens immediately, but not in every case. So we could set it where codegen_expr returns, but then we may miss some instructions that were generated in between.

The other interesting thing; if an IR instruction's type can be understood from only it's arguments/children (like a call from the callee), then this means we can simply do the assigment within the creation function of the IR instruction, much like we mark uses.

So, really, we just have to figure out what the best way to actually assign expr->ir->type to expr->type within codegen_expr().

Do we want a separate IRType, with all of it's own API and everything?

Or do we just want to pass through the existing Type structures into the IR, so that they may be used by the backend?