Is this all because Graph doesn't have a virtual destructor? We don't construct/destruct those too often, I'd much rather just make it virtual rather than moving DominatorTree.
On Thu, Jun 9, 2016 at 10:52 AM, Stephan Bergmann <stephan.bergmann.second...@googlemail.com> wrote: > ...when Function::domTree is created as DominatorTree in > Function::convertToSSA > (src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp) but destroyed only as > base > Graph in ~Function (src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp). > --- > src/gallium/drivers/nouveau/codegen/nv50_ir.h | 37 > +++++++++++++++++++++- > .../drivers/nouveau/codegen/nv50_ir_ssa.cpp | 37 > +--------------------- > 2 files changed, 37 insertions(+), 37 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h > b/src/gallium/drivers/nouveau/codegen/nv50_ir.h > index 94e54bb..c864d56 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h > @@ -1132,6 +1132,41 @@ private: > void splitCommon(Instruction *, BasicBlock *, bool attach); > }; > > +// DominatorTree implements an algorithm for finding immediate dominators, > +// as described by T. Lengauer & R. Tarjan. > +class DominatorTree : public Graph > +{ > +public: > + DominatorTree(Graph *cfg); > + ~DominatorTree() { } > + > + bool dominates(BasicBlock *, BasicBlock *); > + > + void findDominanceFrontiers(); > + > +private: > + void build(); > + void buildDFS(Node *); > + > + void squash(int); > + inline void link(int, int); > + inline int eval(int); > + > + void debugPrint(); > + > + Graph *cfg; > + > + Node **vert; > + int *data; > + const int count; > + > + #define SEMI(i) (data[(i) + 0 * count]) > + #define ANCESTOR(i) (data[(i) + 1 * count]) > + #define PARENT(i) (data[(i) + 2 * count]) > + #define LABEL(i) (data[(i) + 3 * count]) > + #define DOM(i) (data[(i) + 4 * count]) > +}; > + > class Function > { > public: > @@ -1171,7 +1206,7 @@ public: > > Graph cfg; > Graph::Node *cfgExit; > - Graph *domTree; > + DominatorTree *domTree; > Graph::Node call; // node in the call graph > > BasicBlock **bbArray; // BBs in emission order > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp > index 3d25ad9..9652b72 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ssa.cpp > @@ -27,41 +27,6 @@ namespace nv50_ir { > > // Converts nv50 IR generated from TGSI to SSA form. > > -// DominatorTree implements an algorithm for finding immediate dominators, > -// as described by T. Lengauer & R. Tarjan. > -class DominatorTree : public Graph > -{ > -public: > - DominatorTree(Graph *cfg); > - ~DominatorTree() { } > - > - bool dominates(BasicBlock *, BasicBlock *); > - > - void findDominanceFrontiers(); > - > -private: > - void build(); > - void buildDFS(Node *); > - > - void squash(int); > - inline void link(int, int); > - inline int eval(int); > - > - void debugPrint(); > - > - Graph *cfg; > - > - Node **vert; > - int *data; > - const int count; > - > - #define SEMI(i) (data[(i) + 0 * count]) > - #define ANCESTOR(i) (data[(i) + 1 * count]) > - #define PARENT(i) (data[(i) + 2 * count]) > - #define LABEL(i) (data[(i) + 3 * count]) > - #define DOM(i) (data[(i) + 4 * count]) > -}; > - > void DominatorTree::debugPrint() > { > for (int i = 0; i < count; ++i) { > @@ -326,7 +291,7 @@ Function::convertToSSA() > > // 1. create the dominator tree > domTree = new DominatorTree(&cfg); > - reinterpret_cast<DominatorTree *>(domTree)->findDominanceFrontiers(); > + domTree->findDominanceFrontiers(); > > // 2. insert PHI functions > DLList workList; > -- > 2.7.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev