On Tue, 12 Jun 2018 at 20:28, mohamed messelka via llvm-dev
<[hidden email]> 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.
(Adding llvm-dev back to record the conversation).
On Fri, 15 Jun 2018 at 13:41, mohamed messelka <[hidden email]> wrote:
> We can see that in V5.0 change the the name with numbers %i.017 >> %3 , %k.016 >> %4 & %add >> %7.
> I just want to have the name in .ll file that generated from V5.0, any idea how to fix that?
This is actually a difference between debug and release builds of
LLVM. Release builds are configured to drop all names for efficiency,
but debug builds keep them. So you need to rebuild LLVM with (I think)
Of course, the actual IR and names will still be different, and likely
in incompatible ways. The bitcode format is more stable, and LLVM-5.0
should be able to read .bc files generated by LLVM 3.8 (though not the
other way round).