3 ms·
Could someone enlighten me what's the advantage of this over LLVM-IR? Edit: Ok, I've found the following SO thread: http://stackoverflow.com/questions/3891513/
by m_mueller 13y ago
Could someone enlighten me what's the advantage of this over LLVM-IR?
Edit: Ok, I've found the following SO thread: http://stackoverflow.com/questions/3891513/how-does-c-compare-to-llvm http://stackoverflow.com/questions/3891513/how-does-c-compar...
- _delirium 13y agoIf you want to know why it exists despite LLVM-IR existing, one answer is that at the time C-- was launched, LLVM-IR didn't yet exist. As for how they compare, the answers to this question, on why Haskell didn't use LLVM (in 2009, it didn't) get into it a bit: http://stackoverflow.com/questions/815998/llvm-vs-c-how-can-llvm-fundamentally-not-be-better-for-haskell-than-c http://stackoverflow.com/questions/815998/llvm-vs-c-how-can-...
- rayiner 13y agoC-- is intended for higher-level languages than LLVM. E.g. the latter still doesn't have a modern infrastructure interfacing with garbage collectors. Also, C-- is a lot easier to read in textual form than LLVM IR. Finally, the use of C++ and templates makes the code size of LLVM absolutely enormous (20MB binary). That said, so much work goes into LLVM supporting new platforms, optimizations, etc, that it's probably easier to hack around LLVM's limitations than use C--, etc.
- gngeal 13y agoYou probably don't need LLVM to work with LLVM-IR. In fact, I imagine that there could be a market for a "low-level" IR with more compact implementation, sort of similar to Oberon "slim binaries" or something like that. The fact remains, though, that the "pragmatics" stuff around LLVM-IR (GC and other interfaces) seems still a little bit problematic. But I'm a Luddite, though; I like self-hosting native compilers and I'm not terribly fond of the idea of having to pack a 20MB blob of C++ code with my code either. (There's a lot of apps that could profit from dynamic translation at run-time, but using LLVM for that feels unnecessarily heavyweight. I wish the algorithms and passes from LLVM were available in form of some high-level DSL that you'd be able to translate into whatever language you use and automatically adapt to whatever data structures you use in your code. It doesn't sound exactly impossible.)
- carterschonwald 13y agoLLVM-General but more so LLVM-General-Pure give you a starter kit for building something like that, http://hackage.haskell.org/package/llvm-general http://hackage.haskell.org/package/llvm-general http://hackage.haskell.org/package/llvm-general-pure http://hackage.haskell.org/package/llvm-general-pure
- jlebar 13y ago> Finally, [C-- is better than LLVM because] its use of C++ and templates makes the code size of LLVM absolutely enormous (20MB binary). In a world where my phone has 2gb of RAM, I don't understand why 20mb for an optimizing compiler is in any way onerous or unreasonable.
- Figs 13y agoDownloading 20 MB here and 20 MB there adds up pretty quickly if you're using a cellphone data connection like I am.
- haberman 13y agoSmall is beautiful. How much cache does your phone have? How long does it take to compile a 20MB binary? How long does it take it to load all those symbols into a debugger? How long does it take to process all those relocations if you are linking dynamically? How big will your overall binary be if every component is 20MB?