[llvm-dev] LLVM assembly language

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 12 13:45:56 PDT 2018


On Tue, 12 Jun 2018 at 20:28, mohamed messelka via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Does anyone tell which file whose emit the llvm assembly file (.ll), I want to modify for specific use.

The primary representation of LLVM IR is the llvm::Module class in
memory. That class has two representations on disk: .ll (textual) and
.bc (binary). If you want to add something non-trivial to the llvm IR
(or change it) then you need to change all 5 places implied by that:

  + Add it to the llvm::Module in-memory representation
  + Add support for writing a .ll file in lib/IR/AsmWriter.cpp (probably)
  + Add support for reading a .ll file in lib/AsmParser
  + Add support for writing a .bc file in lib/Bitcode/Writer
  + Add support for reading a .bc file in lib/Bitcode/Reader

Before thinking about upstreaming you'll also need documentation in
docs/LangRef.rst, and tests of course. But those aren't needed for
basic proof of concept work.

Cheers.

Tim.


More information about the llvm-dev mailing list