[llvm-dev] interpretation of dag output

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 22 19:49:18 PDT 2016


- Use the -view-XXX-dags arguments with llc (look at the beginning of SelectionDAGISel.cpp for available options) to view the graphs in a graphviz viewer. To get a better intuition about the graphs.

For understanding the text:
- For a "0xSOMEADDR: " prefix create a node in your graph
- Everytime 0xSOMEADDR is mentioned as an operand of another instruction draw an arrow to that node
- Ignore the <multiple use> markers
- Ignore the [ORD] and [ID] annotations
- (if you can upgrade to newer llvm at some point, it gives you shorter "tXX" tokens in debug builds instead of the unhandy pointers and leaves out some unhelpfull noise data by default like the multiple use markers)

- Matthias

> On Mar 22, 2016, at 5:02 PM, Rail Shafigulin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I'm trying to figure out how to interpret DAG output that is shown below. If I were to draw it by hand, how would I do it? I tried to do it, but unfortunately I can't figure it out. I know there is a way to generate a graph, but I made some changes to my backend which hangs clang/llc. 
> 
> Would someone be kind enough to give a picture of what of a graph below? I'm sure once I see one I will be able to plot my own.
> 
> Any help is appreciated.
> 
> Here is the graph:
> 
> Type-legalized selection DAG: BB#3 'foo:middle.block26'
> SelectionDAG has 19 nodes:
>   0x26438b0: ch = EntryToken [ID=-3]
> 
>     0x26438b0: <multiple use>
>     0x2672810: v4i32 = Register %vreg4 [ID=-3]
> 
>   0x2672a20: v4i32,ch = CopyFromReg 0x26438b0, 0x2672810 [ORD=5] [ID=-3]
> 
>   0x26761c8: v4i32 = undef [ID=-3]
> 
>     0x2672a20: <multiple use>
>       0x2672a20: <multiple use>
>       0x26761c8: <multiple use>
>     0x2674b88: v4i32 = vector_shuffle 0x2672a20, 0x26761c8<2,3,u,u> [ORD=5] [ID=-3]
> 
>   0x2671ec8: v4i32 = add 0x2672a20, 0x2674b88 [ORD=6] [ID=-3]
> 
>   0x2672600: i32 = Register %R11 [ID=-3]
> 
>           0x26438b0: <multiple use>
>           0x26760c0: i32 = TargetFrameIndex<2> [ID=-3]
> 
>         0x2674fa8: ch = lifetime.end 0x26438b0, 0x26760c0 [ORD=10] [ID=-3]
> 
>         0x2675a90: i32 = TargetFrameIndex<1> [ID=-3]
> 
>       0x2674a80: ch = lifetime.end 0x2674fa8, 0x2675a90 [ORD=11] [ID=-3]
> 
>       0x26752c0: i32 = TargetFrameIndex<0> [ID=-3]
> 
>     0x2671fd0: ch = lifetime.end 0x2674a80, 0x26752c0 [ORD=12] [ID=-3]
> 
>     0x2672600: <multiple use>
>         0x2671ec8: <multiple use>
>           0x2671ec8: <multiple use>
>           0x26761c8: <multiple use>
>         0x2672c30: v4i32 = vector_shuffle 0x2671ec8, 0x26761c8<1,u,u,u> [ORD=7] [ID=-3]
> 
>       0x2675da8: v4i32 = add 0x2671ec8, 0x2672c30 [ORD=8] [ID=-3]
> 
>       0x26721e0: i32 = Constant<0> [ID=-3]
> 
>     0x26757e8: i32 = extract_vector_elt 0x2675da8, 0x26721e0 [ORD=9] [ID=-3]
> 
>   0x26755d8: ch,glue = CopyToReg 0x2671fd0, 0x2672600, 0x26757e8 [ORD=13] [ID=-3]
> 
>     0x26755d8: <multiple use>
>     0x2672600: <multiple use>
>     0x26755d8: <multiple use>
>   0x26750b0: ch = EsenciaISD::RET_FLAG 0x26755d8, 0x2672600, 0x26755d8:1 [ORD=13] [ID=-3]
> 
> 
> -- 
> Rail Shafigulin
> Software Engineer 
> Esencia Technologies
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list