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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev

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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev
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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev
In reply to this post by Hal Finkel via llvm-dev
Or try to grab books about LLVM (free or non-free) to get started. Doxygen [1] would help you
understand the class hierarchy better, too. 


HTH,
chenwj

2017-06-12 13:49 GMT+08:00 Dipanjan Das via llvm-dev <[hidden email]>:

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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev




--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Hal Finkel via llvm-dev
In reply to this post by Hal Finkel via llvm-dev
Hi Dipanjan,


I have the same problems, so your are not alone. ;-)
Maybe reading this long and helpful discussion could help you:
http://lists.llvm.org/pipermail/llvm-dev/2017-May/112730.html

Advices I found out by others:
- Try to use the Clang compiler to convert very tiny C/C++ language
programms into IR code and then try to figure out, how you can generate
this IR code with the IR Builder classes.
- Try to write absolute exact and very, very compact emails to this LLVM
mailing list. Use the keyword "[beginner]" in the email subject, so LLVM
developers see it is a beginner question. If the question is very short,
hopefully its easy to answered with no time of reading the full
description of 30 sentences of the problem. :)


Best regards,
Thomas


Am 12.06.2017 07:49 schrieb Dipanjan Das via llvm-dev:

> 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
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Loading...