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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

David Jones via llvm-dev
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

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

David Jones via llvm-dev
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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

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

David Jones via llvm-dev
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

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

David Jones via llvm-dev
In reply to this post by David Jones via llvm-dev
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 it

I 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
_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

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

David Jones via llvm-dev
In reply to this post by David Jones via llvm-dev
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 <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev