Very hot stuff! It's like ISA-portable assembly, but with types! In particular it also it deals with calling conventions for us (since it is ISA-portable). TODO: isn't that exactly what C does? :-) LLVM IR vs C
Example: llvm/hello.ll adapted from: but without double newline.
To execute it as mentioned at we can either use their crazy assembly interpreter, tested on Ubuntu 22.10:
sudo apt install llvm-runtime
lli hello.ll
This seems to use puts from the C standard library.
Or we can Lower it to assembly of the local machine:
sudo apt install llvm
llc hello.ll
which produces:
and then we can assemble link and run with gcc:
gcc -o hello.out hello.s -no-pie
or with clang:
clang -o hello.out hello.s -no-pie
hello.s uses the GNU GAS format, which clang is highly compatible with, so both should work in general.
LLVM front-end for C and related language like C++ etc.