3 ms·
Honestly, I am not sure what purpose does that serve. I read the motivational docs, and they seem to be clear, but what they describe is like a representation o
by lostmsu 8y ago
Honestly, I am not sure what purpose does that serve. I read the motivational docs, and they seem to be clear, but what they describe is like a representation of IR at a specific compilation step, which has some predefined metadata for a specific use case + restrictions on data flow.
IMHO, the hardest part is obtaining that metadata and converting normal code into that form, not compilation of that form further down into the machine code.
- jcranmer 8y agoThe entire compilation process is generally a process of first converting code into a very high-level representation, and then lowering it through stages that progressively lose the original language semantics and gain hardware-specific semantics, with optimizations happening along each level of the path. Traditional LLVM contains essentially three different levels of IR: there's the mid-level IR that most people think of, which is (to a very, very rough approximation) a machine-independent (but generally not portable) representation of C/C++ (with extensions) semantics. This is lowered to a legalization IR (either SelectionDAG or GlobalISel), which contains the same general class of generic operations, but things such as integers larger than native machine types (e.g., i128) are converted into native machine types [1]. The legalized IR is then lowered to a machine-specific IR, where the opcodes and operands are specific to the relevant ISA, and the target-independent passes are generally restricted to dealing with very high-level summaries of operations (e.g., "this instruction is commutative"). This project is about an IR that is higher level than LLVM IR that can, to some degree, abstract over the different kinds of such IRs that already exists. (As the presentation notes, Clang should have built such an IR, especially now that it needs to do a lot of that work for static analysis or constexpr anyways). [1] More specifically, this is the IR that the legalization process is actually done in. How much of it has been legalized depends on where you are in the process.