I wonder if one solution would be have tighter integration between the layers, so the backend could ask for some IR to be generated? Basically starting from the program entrypoints. This way the frontend wouldn't need to generate all the possible code up-front.
Mind you, I've never written a compiler after that Uni course and touched LLVM IR a long time ago
Mind you, I've never written a compiler after that Uni course and touched LLVM IR a long time ago