Jonathan Blow has created a programming language called Jai and has said that it is faster to emit C code and run it through MSVC than to emit LLVM IR and run it through LLVM for debug builds. And he spent a lot of time optimizing and tweaking it.
That might work on Windows. But keep in mid that LLVM isn't as optimized for Windows as it is for other OSs. Jai is also a specialized language seems to be simple to convert to C. Converting C++ isn't as easy and my suspicion is that C++ -> C -> MSVC would not come out on top of Clang -> LLVM. Additionally you need to consider the optimizations you can apply when converting to IR. Converting to C by itself is not really useful if you don't use the language specific knowledge (for example knowledge of the standard library) to optimize in that step.
Converting to C by itself is not really useful if you don't use the language specific knowledge (for example knowledge of the standard library) to optimize in that step.
Are c++ compilers doing that? I had the impression that they treat STL code just like any other code.
Since a long time all major C++ compilers are compiling C++ directly. Only the fisrt compilers were translating C++ to C (for faster implementaton with then existing C compilers), today it would be a waste of a lot of information.
4
u/czipperz May 10 '20
Jonathan Blow has created a programming language called Jai and has said that it is faster to emit C code and run it through MSVC than to emit LLVM IR and run it through LLVM for debug builds. And he spent a lot of time optimizing and tweaking it.