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

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 7 16:58:32 PST 2018


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>


More information about the llvm-dev mailing list