libera/#sicl - IRC Chatlog
Search
23:24:04
Bike
I'm working a bit on porting the optimization framework I've built up for Clasp into Cleavir. I think I have a decent design for a HIR->MIR kind of transition that's generally useful. The main part is it takes certain known function calls and reduces them into primitive operations based on type information (which analysis is done earlier)
23:24:33
Bike
So e.g. if there's a call to + that the inferencer has determined has fixnum arguments _and fixnum result_, it can replace the call instruction with a primop instruction
23:25:55
Bike
On a higher level, I have something like SBCL's deftransform, like type-directed compiler macros. in clasp this is good for basic things like (zerop [fixnum]) => (= 0 [fixnum]) or (float whatever [single-float]) => (si:to-single-float whatever), which can then be reduced to primops later
23:26:14
Bike
The neat thing is that this transform mechanism could be exposed to the programmer without compromising safety, since they can only expand into normal lisp code
23:26:32
Bike
ideally i'd like to arrange it to be able to use other inferred information, but other than types there's not much of that for the time being
23:30:30
Bike
well, that's a neat thing about it. i think it's a good organization overall. among other things means you can add primitive operations without going into cst-to-ast at all to come up with syntax for them
23:31:26
Bike
something like LIR i'm less sure about. the primitive operations thing works because cleavir can leave them entirely up to the implementation, but LIR is more like address computations that may or may not actually be relevant for any given client
23:34:10
Bike
on the other hand it can be useful to split things up, like reducing car/cdr to an address computation followed by a load