Re:A Complete Guide to LLVM for Programming Language Creators
by mhh__ on Friday December 25, 2020 @08:00PM
(#25540444)
The IR is pretty messy but if you can see through the clutter the IR is much easier to read the flow of. There's a reason why we use SSA (although prior to mem2reg running you don't quite have it, but still)
Re:A Complete Guide to LLVM for Programming Language Creators
by mrathi12 on Saturday December 26, 2020 @07:07AM
(#25542958)
Yes, exactly. Clang emitted IR especially has a lot of (C/C++)-specific junk. If you look past that clutter, it's not too bad.
I think the best way to learn to read IR is to look at super-minimal examples, and then you'll be able to tell which parts of larger IR files are relevant.
Re:A Complete Guide to LLVM for Programming Language Creators
by RicardoLuis0 on Saturday December 26, 2020 @05:26AM
(#25542539)
I'd say readability of dumped IR would be on par with dumped assembly from a compiler for readability, but hand-written LLVM IR has the potential to be quite a lot more readable than hand-written assembly
I think assembly is more readable than the dumped LLVM IR output of a real compiler…
Anyway, that was a good overview of how to build simple LLVM IR. :)