What are the implications on
- portability (calling convention: does it really matter at an LLVM level when only calling into C or OS library functions)
- link time
- optimizations
I would like to compile a toy language with LLVM, due to all the hard parts already being present (optimization, object code generation), but am struggling with a concept I'd like to keep if it is worth it: library files should be redistributable, usable as static and shared lib (for linking, in the shared case a real so or dll will be generated when the final app is linked), portable. I believe this would cut part of compilation time (as the native code generation and perhaps optimization is only done once, at final binary link time). I envision the linker taking care of calling convention (if possible) and the conversion to a shared library if requested. In a far-stretched addition, perhaps LLVM could be leveraged to not link, and use the LLVM JIT to run the generated bytecode directly, completely removing link times when writing code.
Does this sound
- Doable?
- Worth it? I know C/C++ link time is comparatively long, which is problematic when frequently rebuilding. What about free link time optimization (cfr
/GL
and-flto
as it will be essentially LLVM bytecode being linked together, which will then be turned into a native binary).
This may be a vague question, if I have to clarify something, please ask.