llvm-tutor
llvm-tutor copied to clipboard
New examples
Hi! Thank you for creating such a useful resource to learn about LLVM!
I have some questions about LLVM out-of-source development that you can probably answer
- Can I change a pipeline of optimizations passes from my own pass / plugin? If yes, can you please share some some docs about it or perhaps make an example?
- Can I forbid default LLVM passes to run on specific functions? If yes, how?
Thank you in advance!
Also, I'm wondering, how can I run multiple passes in a single plugin?
There are not a lot of examples out there using new pass manager with out-of-tree plugins
Hi @unterumarmung , thanks for using llvm-tutor!
Hi! Thank you for creating such a useful resource to learn about LLVM!
I'm really glad that it's been helpful, thank you for your kind feedback :)
Can I change a pipeline of optimizations passes from my own pass / plugin?
Hm, a pass and a pass pipeline are two different things. These things are related, but that relation usually boils down to: "this" pass pipeline includes "that" pass. So, AFAIK, the answer is "no".
Can I forbid default LLVM passes to run on specific functions? If yes, how?
You want to specify the optimisation level on a per-function basis. AFAIK, that's not available. You can use function attributes (and could define your own), but there's nothing "generic". Function attributes are documented here.
Also, I'm wondering, how can I run multiple passes in a single plugin?
Hm, a plugin just implements a pass. You then use a driver (e.g. opt
) to load it and to run it. But you could try defining a transformation pass that depends on some analysis pass. I've been meaning to add something like this to llvm-tutor, but haven't had the bandwidth :( Patches welcome! :)
There are not a lot of examples out there using new pass manager with out-of-tree plugins
What's the situation with the Legacy PM? Is it better?
Thanks, -Andrzej
Closing as there's been no new activity in over 6 months now. Please feel free to re-open if you have more questions.