TC-L, LLVM IR¶
TC-L is an optional assignment.
This section has been updated for EPITA- 2021 on 2019-10-06.
At the end of this stage, the compiler procudes LLVM IR code. This stage produces an intermediate representation like TC-5, Translating to the High Level Intermediate Representation.
The LLVM IR is a Static Single Assignment (SSA) based representation, that provides type safety, low-level operations, and is capable of representing most of high-level languages cleanly. It is the intermediate representation used by Clang, A C language family front end for LLVM.
Compared to the HIR, LLVM IR is typed. Providing type information can help the LLVM back end to optimize even more.
You can find more information about the language in the LLVM Language Reference Manual.
For more documentation on LLVM, use the LLVM Documentation.
A relevant tutorial is available here: Kaleidoscope: Implementing a Language with LLVM. It may be useful if you want to go further.
This stage makes use of multiple previous stages:
- TC-R, Unique Identifiers
- All the identifiers have to be unique, in order to translate them to LLVM identifiers (for debug purposes).
- TC-D, Removing the syntactic sugar from the Abstract Syntax Tree
- The desugar visitor is used to translate
forloops and comparison between strings.