[llvm-dev] How do I understand LLVM class abstraction better?

mats petersson via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 12 04:30:47 PDT 2017


I found the Kaleidoscope example a rather good way to learn what I needed
(I basically started writing a compiler using the example of Kaleidoscope,
and then extended and added more code to eventually have a complete Pascal
compiler). Once you get far enough into the project, you can usually
formulate a clear & concise enough question for this mailing list or the
LLVM chat to get a good answer. And learn "when in doubt, alloca" ;)

However, LLVM is a VERY large set of code, and to understand all of it, and
the subtle differences between variants ("When is a ConstantValue not a
compile-time constant?") that initially appear to be "the same", in some
cases, is really not easy. And I'm not sure there is any good answer to
"how to do that".

I wouldn't even begin to suggest that I actually know ALL of LLVM,
certainly not in great detail for everything - there's a lot to do with
Target and binary files that I've completely ignored besides "copy/modify
from the relevant clang sources".

Obviously, if you are not planning to write your own compiler (or work on
someone else's compiler project), then perhaps starting at Kaleidoscope is
not necessarily the right way. If you explain what it is you're trying to
achieve (assuming it's not writing a compiler), perhaps someone has a good
suggestion...

--
Mats

On 12 June 2017 at 06:49, Dipanjan Das via llvm-dev <llvm-dev at lists.llvm.org
> wrote:

>
> I haven't spent any "formal" effort to learn LLVM so far, trying to learn
> by example. However, the downside is, I struggle with comprehending the
> semantics of the abstraction provided by several LLVM classes often times.
> The documentation is miserable. Do you have any suggestion for me to lower
> the learning threshold? Do seasoned LLVM programmers have faced such
> problems in early days, or is it the lack of systematic reading that's
> troubling me?
>
> --
>
> Thanks & Regards,
> Dipanjan
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170612/e1065ae6/attachment.html>


More information about the llvm-dev mailing list