Is it possible to modify cached clif easily? I am making something which needs to have extremely fast compilation times, like, sub-5ms, and it would be nice if it was possible to modify clif on the fly so i dont have to regenerate it fully every time. The thing im compiling is a node graph so every value is part of its own little thing, so what would be the best way to go about this? Do i make a basic block for every node then regenerate those on the fly or can i just say "this value is an iconst, change it to this pls"?
does cranelift perform badly if i give it a lot (20, 50, even 100) of basic blocks? because i think nodes mapping to basic blocks would work really well, and i could compile nodes in parallel too (assuming cranelift would allow me to create basic blocks then append them)
You can clone a Function
before compilation if you want to change and recompile it. Using many basic blocks should work fine. It is not possible to write to a single function from multiple threads at the same time.
I see, in that case ill probably just make the node -> LIR transformation multithreaded since i have other backends and not just cranelift. @bjorn3 how would i actually modify the clif inside functions however? i dont see any functions for modifying existing instructions, although i prob missed them
oh i see, i think i can just modify the dataflow graph
ooh the constant map seems extremely helpful since most of the changes to the node graph will be changes to constants, so i can just change that on the fly
Last updated: Nov 22 2024 at 17:03 UTC