Attempt to use DomTreeBase on a CallGraph or CallGraphNode

Hi,

Has anyone successfully been able to implement domination over a callgraph, I’m getting stuck on supporting DomTreeBuilder for Calculate.

Many thanks

Alina - this sounds vaguely like some of the stuff you’re working on?

I may need more context here.

If you’re trying to use Calculate to compute a new DT with some updates (i.e. pretend the CFG graph is different), that Calculate method is broken. It will discard the updates and return a new DT.
Yes, I’m working to fix that.

If it’s something else, please give me more details so I can understand what you’re trying to do.

Best,
Alina

Hi,

I simply tried to get the correct declarations in place to use it mimicking BasicBlock support. I got a subclass to add getParent() and its GraphTraits support then died tying in Calculate

class MyCallGraphNode : public CallGraphNode, public ilist_node_with_parent<MyCallGraphNode, CallGraph> {

public:

CallGraph *getParent() { return parent; }

private:

CallGraph *parent;

};

template <>

struct GraphTraits<MyCallGraphNode *>

{

using NodeRef = MyCallGraphNode *;

using ChildIteratorType = MyCallGraphNode::iterator;

using nodes_iterator = MyCallGraphNode::iterator;

static NodeRef getEntryNode(MyCallGraphNode *N) { return N; }

static inline ChildIteratorType child_begin(MyCallGraphNode *N) { return ChildIteratorType(N->begin()); }

static inline ChildIteratorType child_end(MyCallGraphNode *N) { return ChildIteratorType(N->end()); }

};

template void DomTreeBuilder::Calculate<DomTreeBase>(DomTreeBase &DT);

static process(CallGraph &cg) {

DomTreeBase *DTB = new DomTreeBase();

DTB->recalculate(cg);

}

thanks