[llvm-dev] How to invoke the print method in MachineFunctionPass

Samolisov Pavel via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 14 00:40:01 PST 2018


Matthias,

Thank you for the answer. I've found the two following call chains:
MachineVerifier::report -> MachineVerifier::report -> LiveIntervals::print
and RegisterCoalescer::print ->  LiveIntervals::print but I see no
invocations of RegisterCoalescer::print). So, the method LiveIntervals:
:print can be needed for some cases.

Pavel.

чт, 8 нояб. 2018 г. в 4:01, Matthias Braun <mbraun at apple.com>:

> 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> 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
>
>
> _______________________________________________
> 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/20181114/48098863/attachment.html>


More information about the llvm-dev mailing list