Compilers
Which describes the basic structure of LLVM?
- AA C-only compiler that cannot be used for other languages
- BAn assembler and linker combination targeting only a specific CPU
- CFront and back ends combined around a common IR
Show answer and explanation
Answer: C. Front and back ends combined around a common IR
LLVM is a compiler infrastructure centered on a common intermediate representation, LLVM IR. Front ends for many languages, starting with Clang for C/C++, translate source into LLVM IR, which passes through shared optimization passes before back ends for many targets, including x86, Arm, RISC-V and GPUs, generate machine code. Supporting a new language or CPU requires building only one side. It is neither C-only nor tied to a specific CPU.
- A. It has front ends for many languages and is not C-only.
- B. It has back ends for many CPUs and is not tied to one.
- C. Correct. Front and back ends combine around a common IR.