Samolisov Pavel via llvm-dev
2018-Nov-07 10:12 UTC
[llvm-dev] How to invoke the print method in MachineFunctionPass
Hello everyone. I'm looking for a way how to invoke the 'print(raw_ostream &OS, const Module *)' method in MachineFunctionPass. If we have a 'usual' pass, which can be used by the 'opt' tool, we can just pass the '-analyze' command line argument but what about the 'llc' compiler? As I can see, there is an implementation of the 'print(raw_ostream &OS, const Module*)' method in the 'LiveIntervals.cpp'. void LiveIntervals::print(raw_ostream &OS, const Module* ) const { OS << "********** INTERVALS **********\n"; // Dump the regunits. ... The method also is implemented in 'RegisterCoalescer.cpp' (in fact, this method just invokes one from LiveIntervals). Is there a way to invoke the 'print' method implemented in **Machine** pass? If so, could you let me know how I can do it? Thank you. Pavel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181107/2770f7d8/attachment.html>
Matthias Braun via llvm-dev
2018-Nov-08 00:58 UTC
[llvm-dev] How to invoke the print method in MachineFunctionPass
I suspect you cannot :-/ As far as I understand the code, you would need to put a FunctionPassPrinter into the pass pipeline, and I right now I don't see any code in llc that would do that. Maybe we should just remove LiveIntervals::print() given that nobody can use it (or someone could implement an -analyze for llc). In practice this works for me to inspect live intervals (but technically it isn't using LiveIntervals::print): $ llc -debug-only=regalloc -run-pass=liveintervals test.mir - Matthias> On Nov 7, 2018, at 2:12 AM, Samolisov Pavel via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello everyone. > > I'm looking for a way how to invoke the 'print(raw_ostream &OS, const Module*)' method in MachineFunctionPass. If we have a 'usual' pass, which can be used by the 'opt' tool, we can just pass the '-analyze' command line argument but what about the 'llc' compiler? > > As I can see, there is an implementation of the 'print(raw_ostream &OS, const Module*)' method in the 'LiveIntervals.cpp'. > void LiveIntervals::print(raw_ostream &OS, const Module* ) const { > OS << "********** INTERVALS **********\n"; > > // Dump the regunits. > ... > The method also is implemented in 'RegisterCoalescer.cpp' (in fact, this method just invokes one from LiveIntervals). > Is there a way to invoke the 'print' method implemented in **Machine** pass? If so, could you let me know how I can do it? > Thank you. > Pavel > > _______________________________________________ > 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/20181107/db78376d/attachment.html>
Matthias Braun via llvm-dev
2018-Nov-08 01:01 UTC
[llvm-dev] How to invoke the print method in MachineFunctionPass
Actually it seems Pass:dump() is calling Pass::print() and the dump() functions is used in a couple places throughout CodeGen for debug printing. So that's why ::print is implemented at all.> On Nov 7, 2018, at 4:58 PM, Matthias Braun via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > I suspect you cannot :-/ > > As far as I understand the code, you would need to put a FunctionPassPrinter into the pass pipeline, and I right now I don't see any code in llc that would do that. Maybe we should just remove LiveIntervals::print() given that nobody can use it (or someone could implement an -analyze for llc). > > In practice this works for me to inspect live intervals (but technically it isn't using LiveIntervals::print): > > $ llc -debug-only=regalloc -run-pass=liveintervals test.mir > > - Matthias > >> On Nov 7, 2018, at 2:12 AM, Samolisov Pavel via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: >> >> Hello everyone. >> >> I'm looking for a way how to invoke the 'print(raw_ostream &OS, const Module*)' method in MachineFunctionPass. If we have a 'usual' pass, which can be used by the 'opt' tool, we can just pass the '-analyze' command line argument but what about the 'llc' compiler? >> >> As I can see, there is an implementation of the 'print(raw_ostream &OS, const Module*)' method in the 'LiveIntervals.cpp'. >> void LiveIntervals::print(raw_ostream &OS, const Module* ) const { >> OS << "********** INTERVALS **********\n"; >> >> // Dump the regunits. >> ... >> The method also is implemented in 'RegisterCoalescer.cpp' (in fact, this method just invokes one from LiveIntervals). >> Is there a way to invoke the 'print' method implemented in **Machine** pass? If so, could you let me know how I can do it? >> Thank you. >> Pavel >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > 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/20181107/063c42f3/attachment-0001.html>
Krzysztof Parzyszek via llvm-dev
2018-Nov-08 15:35 UTC
[llvm-dev] How to invoke the print method in MachineFunctionPass
On 11/7/2018 6:58 PM, Matthias Braun via llvm-dev wrote:> Maybe we should just remove LiveIntervals::print() given that nobody can > use itI use it in debugging all the time. I just stick a call LIS->print(...) in the code where I want the intervals to be dumped. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation