[llvm-dev] Hello

Stefanos Baziotis via llvm-dev llvm-dev at lists.llvm.org
Sat Jan 9 16:55:53 PST 2021


Hi Mihir,

I'm not really sure what would be the best choice given that you mention
that you want a source that covers LLVM IR "in depth" while previously it
seemed you needed
a beginner-like source.

If you already know the basics, i.e.,:
- IR Structure (Module -> Function -> Basic Block -> Instruction)
- Basic operations (arithmetic, branches, calls, loads/stores, conversions
all that)
- Intrinsics / Metadata
- PHIs
- GEPs
- What role types play in general

Bear in mind that when I mention these basics, I don't mean just knowing
sort of what they do. I also mean how knowing sort of how can you use them
as
building blocks to implement high level operations, e.g., (from simple to
more complicated):
- 1 + 2 + 3
- function calls
- if-else if-else
- classes / structs and operations in them
- virtual functions

Maybe type conversions, pointers etc. anyway you get the point.

If you do have the basics down, _then_ I think is the time to start
studying in depth. At this point, I don't think a book or any such source
would be useful to you. LangRef would be the way to go along
with writing C++ in godbolt (https://godbolt.org/) and seeing what LLVM IR
Clang emits (with -emit-llvm and preferably -g0 to avoid debug info as cmd
args).

But if you don't have the basics down, then you probably don't need
something in-depth. In this case, I'd start with this video:
https://www.youtube.com/watch?v=m8G_S5LwlTo,
writing (simple) C code in godbolt and inspecting the result (eventually
trying to produce it myself) and maybe I'd watch a compilers course
(meaning 1-2 lectures covering things
of interest, not the whole thing and without paying - there is plenty of
free material from universities online).

I hope this helps. If not, maybe you can try to direct us on what exactly
is your level.

Best,
Stefanos

Στις Κυρ, 10 Ιαν 2021 στις 2:39 π.μ., ο/η Mihir Sevak via llvm-dev <
llvm-dev at lists.llvm.org> έγραψε:

> Ok, thanks for the reply. Lets see what other folks have to say.
>
> On Sat, Jan 9, 2021 at 4:37 PM David Blaikie <dblaikie at gmail.com> wrote:
>
>> Yeah, sorry - I haven't read any LLVM books, unfortunately. Perhaps some
>> other folks will be able to chime in with tips.
>>
>> On Sat, Jan 9, 2021 at 4:36 PM Mihir Sevak <mihir.sevak at gmail.com> wrote:
>>
>>> I own this book and it doesn't cover IR in depth. I am trying to write
>>> an additional feature for C++ frontend and for that I want to use proper
>>> Intermediate Representation that doesn't become a laughing stock so I am
>>> looking for some in depth explanation on IR. I am aware that it changes so
>>> fast that a book will become outdated however for my exercise I am willing
>>> to go back to the version the book covers and implement it there. If you
>>> have used some book personally and recommend it please share with me.
>>>
>>> Thanks.
>>>
>>> On Sat, Jan 9, 2021 at 4:31 PM David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>>> Published books probably get out of date pretty quickly, so you'll need
>>>> to keep the more up-to-date code/online docs in mind even if you're reading
>>>> printed stuff. At a quick google this seems like the sort of thing that
>>>> might be useful:
>>>> https://www.amazon.com/Getting-Started-LLVM-Core-Libraries/dp/1782166920
>>>> (googling 'llvm book' shows a few results)
>>>>
>>>> On Sat, Jan 9, 2021 at 4:24 PM Mihir Sevak <mihir.sevak at gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks David. Really appreciate this.
>>>>>
>>>>> Would you please kindly share those names of the books so at least I
>>>>> have an idea about what resources are available and in case I need more
>>>>> explanation than this Language Reference Manual ?
>>>>>
>>>>> Once again thanks.
>>>>>
>>>>> On Sat, Jan 9, 2021 at 3:57 PM David Blaikie <dblaikie at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> There are some books, but if you're looking for the best reference
>>>>>> for LLVM IR it's online here: https://llvm.org/docs/LangRef.html
>>>>>>
>>>>>> On Sat, Jan 9, 2021 at 3:43 PM Mihir Sevak via llvm-dev <
>>>>>> llvm-dev at lists.llvm.org> wrote:
>>>>>>
>>>>>>> Hello LLVM group,
>>>>>>>      I am very new to this project. I want to develop a few things
>>>>>>> on LLVM platform and for that I am wondering where can I learn about
>>>>>>> Intermediate Representation used in LLVM project? Is there any in-depth
>>>>>>> instruction level guide available except online tutorials?
>>>>>>>
>>>>>>> Please advise.
>>>>>>>
>>>>>>> Thanks.
>>>>>>> Have a great weekend.
>>>>>>>
>>>>>>> --
>>>>>>> "How can anything be impossible when impossible itself says I M
>>>>>>> Possible???"®
>>>>>>> Mihir Sevak
>>>>>>> _______________________________________________
>>>>>>> LLVM Developers mailing list
>>>>>>> llvm-dev at lists.llvm.org
>>>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> "How can anything be impossible when impossible itself says I M
>>>>> Possible???"®
>>>>> Mihir Sevak
>>>>>
>>>>
>>>
>>> --
>>> "How can anything be impossible when impossible itself says I M
>>> Possible???"®
>>> Mihir Sevak
>>>
>>
>
> --
> "How can anything be impossible when impossible itself says I M
> Possible???"®
> Mihir Sevak
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://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/20210110/557cbb3c/attachment.html>


More information about the llvm-dev mailing list