Canonical way to visualize LLVM IR?

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

Canonical way to visualize LLVM IR?

Paul Sokolovsky
Hello,

LLVM provides several ways to visual IR structure straight in its core -
Function::viewCFG() to render control flow graph, then -view-* options
to llc to render various stages of transforming to machine code.
However, I wasn't able to find a way to render complete DAG
visualization of normal IR - which besides CFG would also show dataflow
(and other flows, if any). What people use to visualize such structure?


Thanks,
 Paul                          mailto:[hidden email]
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Canonical way to visualize LLVM IR?

Sebastian Dreßler
Hi,

On 02/24/2013 06:39 PM, Paul Sokolovsky wrote:
> Hello,
>
> LLVM provides several ways to visual IR structure straight in its core -
> Function::viewCFG() to render control flow graph, then -view-* options
> to llc to render various stages of transforming to machine code.
> However, I wasn't able to find a way to render complete DAG
> visualization of normal IR - which besides CFG would also show dataflow
> (and other flows, if any). What people use to visualize such structure?

For a project involving a tree data structure, we created a graph for
representing IR for further analysis. I attached an excerpt of such a
graph to give you an idea. If it helps, we will see how to proceed ;)


Cheers,
Sebastian

--
Mit freundlichen Grüßen / Kind regards

Sebastian Dreßler

Zuse Institute Berlin (ZIB)
Takustraße 7
D-14195 Berlin-Dahlem
Germany

[hidden email]
Phone: +49 30 84185-261

http://www.zib.de/

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

graph.dot.pdf (90K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Canonical way to visualize LLVM IR?

Paul Sokolovsky
Hello,

On Sun, 24 Feb 2013 19:15:27 +0100
Sebastian Dreßler <[hidden email]> wrote:

[]

> For a project involving a tree data structure, we created a graph for
> representing IR for further analysis. I attached an excerpt of such a
> graph to give you an idea. If it helps, we will see how to proceed ;)

Well, after grepping LLVM source for apparent lack of it and googling
for couple of apps which didn't bootstrap, I proceeded to write mine
either as a learning exercise, but I'm still not sure I do it the best
way or handle all cases (so far testing on trivial examples of course),
so if your app in open source, definitely would be nice to look at.

What I have on my hands so far: http://postimage.org/image/j4opcf4xf/

> Cheers,
> Sebastian


--
Best regards,
 Paul                          mailto:[hidden email]

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Canonical way to visualize LLVM IR?

Sebastian Dreßler
Hi Paul,

On 02/24/2013 08:54 PM, Paul Sokolovsky wrote:

> Hello,
>
> On Sun, 24 Feb 2013 19:15:27 +0100
> Sebastian Dreßler <[hidden email]> wrote:
>
> []
>
>> For a project involving a tree data structure, we created a graph for
>> representing IR for further analysis. I attached an excerpt of such a
>> graph to give you an idea. If it helps, we will see how to proceed ;)
>
> Well, after grepping LLVM source for apparent lack of it and googling
> for couple of apps which didn't bootstrap, I proceeded to write mine
> either as a learning exercise, but I'm still not sure I do it the best
> way or handle all cases (so far testing on trivial examples of course),
> so if your app in open source, definitely would be nice to look at.
>

Well, I think my code yet does not handle all cases either. Anyway, I'm
going to wrap things up (needs roughly a day) and then provide it via
GitHub. I'm going to send another mail with the projects link.


Cheers,
Sebastian


--
Mit freundlichen Grüßen / Kind regards

Sebastian Dreßler

Zuse Institute Berlin (ZIB)
Takustraße 7
D-14195 Berlin-Dahlem
Germany

[hidden email]
Phone: +49 30 84185-261

http://www.zib.de/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Canonical way to visualize LLVM IR?

Sebastian Dreßler
Hi Paul,

On 02/24/2013 10:00 PM, Sebastian Dreßler wrote:

> Hi Paul,
>
> On 02/24/2013 08:54 PM, Paul Sokolovsky wrote:
>> Hello,
>>
>> On Sun, 24 Feb 2013 19:15:27 +0100
>> Sebastian Dreßler <[hidden email]> wrote:
>>
>> []
>>
>>> [...]
>>
>> Well, after grepping LLVM source for apparent lack of it and googling
>> for couple of apps which didn't bootstrap, I proceeded to write mine
>> either as a learning exercise, but I'm still not sure I do it the best
>> way or handle all cases (so far testing on trivial examples of course),
>> so if your app in open source, definitely would be nice to look at.
>>
>
> Well, I think my code yet does not handle all cases either. Anyway, I'm
> going to wrap things up (needs roughly a day) and then provide it via
> GitHub. I'm going to send another mail with the projects link.
>

You can get the source from

    https://github.com/sdressler/KernelDataFlow

There are some flaws in the code:

- assert is not always used as it is intended to be, i.e. mostly its
within an if-statement and simply performs "assert(0)" with a preceding
error message.

- It can happen that not all instructions are handled. In such a case
you could extend it yourself or write me an email with the code that fails.

- If you are calling the pass from another directory than the one with
the source, don't forget to "mkdir graphs", otherwise subgraphs (which
are related to blocks) will not be generated.


If there are any further questions, don't hesitate to write me. The pass
is at a very early stage, but hopefully it gets some more quality when
someone else uses it.


Cheers,
Sebastian


--
Mit freundlichen Grüßen / Kind regards

Sebastian Dreßler

Zuse Institute Berlin (ZIB)
Takustraße 7
D-14195 Berlin-Dahlem
Germany

[hidden email]
Phone: +49 30 84185-261

http://www.zib.de/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev