9 ms·
> LLVM is smaller at 1.6 million lines, but is newer, supports only C and C++ by default Unless I'm misunderstanding "by default", this isn't true. LLVM is lan
by catpolice 9y ago
> LLVM is smaller at 1.6 million lines, but is newer, supports only C and C++ by default
Unless I'm misunderstanding "by default", this isn't true. LLVM is language agnostic and supports many languages - even the primary C-like frontend Clang supports more than just C/C++.
- webkike 9y agoYou are correct. The article is misinformed
- pebers 9y agoPerhaps they mean that within those 1.6 million lines, the only frontend is Clang? But the line count for gcc includes e.g. gfortran as well?
- valarauca1 9y agoThe GCC addons (gcc-fortran, gcc-cobal, and gcc-go) just convert the existing language into C that is just ingested into the standard GCC. It was only around 2008 that gcc-c++ stopped doing the internal translation/name mangling dance and gained native first party support [1]. Much like how the older versions of GCC used to just produce ASM files to be ingested into GAS to create the binary objects. [1] https://lwn.net/Articles/542457/ https://lwn.net/Articles/542457/
- a_humean 9y agoYeah, I thought that part of the point of the LLVM project was that front end language compilers (entirely language agnostic) could target non-platform specific LLVM IR code, and then let the backend LLVM compiler compile to multiple backend targets. It simplifies front-end compiler development by having a single IR target over multiple native target.
- wolfgke 9y ago> LLVM is language agnostic There exists no such thing as "language agnostic". Every intermediate representation contains properties (very often implicitly) that are specific at least to a class of programming languages.
- whatshisface 9y agoIf the intermediate representation is no more language-specific than x86, then it isn't really the compiler that's language-specific: it's modern computer architecture.
- FeepingCreature 9y agoLLVM IR is fairly C specific. For instance, you better not be trying to write a language where null pointer access is defined...
- pipio21 9y agoWe have worked with LLVM a lot for own own compilers and DSPs. LLVM Intermediate representation in practice is C++, AST is C++. LLVM do not support many languages,many languages support LLVM, which is different. That is many people, or languages' designers, have made the necessary work to make their languages compatible with LLVM IR. If the language is similar to C++, this is a simple task, if it is very different, it is very hard. LLVM does not support other languages, in fact, codebase changes a lot making maintenance painful.
- Arnt 9y agoCould you elaborate on the C++ resemblance? Specifically, in my limited experience LLVM IR resembles typical hardware rather than C++. Modeling the hardware is a design goal for C++, of course, so anything hardware-like must be C++-like. Can you describe some ways in which IR resembles C++ that are not plausible ways to resemble hardware? I'm really curious.