[llvm-dev] RFC: Adding IR Transformation examples/tutorial code to llvm-project

Eric Christopher via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 25 13:34:40 PDT 2019

What Dave said :)

Even if the tutorial code and descriptions are in a different
directory because reasons it'd be good to get it checked in where we
can have things updated automatically.


On Thu, Oct 24, 2019 at 6:25 PM David Blaikie via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Sounds good - bonus points if these examples were motivated with a continuation to the Kaleidoscope tutorial - Eric Christopher and I did a tutorial on debug info back in 2014 and included new chapters for Kaleidoscope for future usage.
> On Thu, Oct 24, 2019 at 4:47 PM Florian Hahn via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>> Hi,
>> I’d like to propose adding a new example directory (llvm/examples/IRTransforms) as a new home for example code used by various tutorials. After talking to a few people at the Developers meeting, it became clear to me that it would be valuable to have the code examples for various tutorials in-tree to keep them from bit-rotting and make it very easy to build them.
>> I’d suggest adding new IR pass examples to llvm/examples/IRTransforms. The passes in that directory will be built as an ExamplesIRTransforms library, which exposes initializeExampleIRTransforms to initialise the passes. Additionally, if LLVM_BUILD_EXAMPLES=On, we add a  -DBUILD_EXAMPLES define, which is then used in opt to make the example passes available if LLVM_BUILD_EXAMPLES=On. I think that allows for relatively friction-less integration of the example passes into `opt`.
>> I’ve put up a patch doing exactly that: https://reviews.llvm.org/D69416 and added a few reviewers, but please join in if you have any thoughts!
>> Please let me know if you have any concerns or suggestions to improve the CMake setup & co.
>> As initial example, it contains the code we used for the IR transformations in the 'Getting Started With LLVM: Basics’ tutorial.
>> I think there were other tutorials with examples that would be great to have there, like 'Writing Loop Optimizations in LLVM’.
>> As a second step, to make those examples even more valuable, it would be great to provide an accompanying text version of the tutorials. But I would suggest we start with adding the code, which we already have.
>> Cheers,
>> Florian
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list