llvmintermediate-code

What is the LLVM intermediate representation?


I have tried the LLVM demo from Try out LLVM and Clang in your browser!.

What kind of IR is this? HIR, MIR, or LIR? The SSA representation is usually used in MIR, I think. So, is it an MIR? But it can store the information for dependence analysis. Hence can it be an HIR?

What filename extension actually represents the LLVM IR, .ll or .bc?

How can I get the symbol table used in LLVM?


Solution

  • I'm not familiar with a single, strict definition of what differentiates one level of IR from another, but from what I know it would fall under the MIR category.

    In any case, LLVM IR is typically stored on disk in either text files with .ll extension or in binary files with .bc extension. Conversion between the two is trivial, and you can just use llvm-dis for bc -> ll and llvm-as for ll -> bc. The binary format is more memory-efficient, while the textual format is human-readable.