JuliaDebug/Cthulhu.jl

Display of CFGs and DomTrees

開放

#26 建立於 2019年2月28日

 (1 則留言) (0 個反應) (0 位負責人)Julia (46 個分叉)batch import
enhancementgood first issuehelp wanted

倉庫指標

星標
 (709 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Would be fabolous to add some pretty printing for the CFG and dominator trees.

Keno apparently uses this snippet for DomTrees. We could use dot for the CFG like opt does it.

using AbstractTrees
using Core.Compiler: DomTree

AbstractTrees.treekind(d::DomTree) = AbstractTrees.IndexedTree()
AbstractTrees.childindices(d::DomTree, i::Int) = d[i].children
AbstractTrees.childindices(::DomTree, ::DomTree) = (1,)
AbstractTrees.parentlinks(::DomTree) = AbstractTrees.StoredParents()
AbstractTrees.printnode(io::IO, i::Int, d::DomTree) = print(io, i)
Base.getindex(d::DomTree, i) = d.nodes[i]
Base.show(io::IO, d::DomTree) = print_tree(io, 1; roottree = d)

貢獻者指南