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++.
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++.
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.
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.
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.
If you don't believe me, here is the code that optimizes based on this.
https://code.woboq.org/llvm/llvm/lib/Transforms/InstCombine/...
https://code.woboq.org/llvm/llvm/lib/Transforms/InstCombine/...
Some highlights:
Now, before GHC generates assembly code (abiding by the calling conventions previously described), it also needs to optimize it. It optimizes a form called "Cmm", which is like a very low level compiler language for performing optimizations. This language does include functions.
When you use the LLVM backend, GHC translates every Cmm function to an LLVM function. In order for everything to work out, we patched LLVM so that functions can have an annotation saying they follow the GHC calling convention.
...
What this means is, we have completely side stepped LLVM's support for GC.
So the support mostly comes from the Haskell side, by compiling to the C-like Cmm (I think that name comes from C--, the idea being a language between assembly and C in abstraction level) and patching or otherwise working around the part where LLVM's feature set wasn't appropriate.
Much like how the older versions of GCC used to just produce ASM files to be ingested into GAS to create the binary objects.