Hi, Does anyone tell which file whose emit the llvm assembly file (.ll), I want to modify for specific use. Thank you all Kinds -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180612/5f3c72d5/attachment.html>
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.
Hi Mohamed, (Adding llvm-dev back to record the conversation). On Fri, 15 Jun 2018 at 13:41, mohamed messelka <m14m at live.fr> 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) -DLLVM_ENABLE_ASSERTIONS=ON. 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). Cheers. Tim.