Skip to content
Snippets Groups Projects
Commit 00f35f4e authored by Nate Begeman's avatar Nate Begeman
Browse files

Move some common data structures between dom and pdom into the base class

llvm-svn: 26905
parent a1bc294f
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,23 @@ public: ...@@ -66,7 +66,23 @@ public:
/// ///
class ImmediateDominatorsBase : public DominatorBase { class ImmediateDominatorsBase : public DominatorBase {
protected: protected:
struct InfoRec {
unsigned Semi;
unsigned Size;
BasicBlock *Label, *Parent, *Child, *Ancestor;
std::vector<BasicBlock*> Bucket;
InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){}
};
std::map<BasicBlock*, BasicBlock*> IDoms; std::map<BasicBlock*, BasicBlock*> IDoms;
// Vertex - Map the DFS number to the BasicBlock*
std::vector<BasicBlock*> Vertex;
// Info - Collection of information used during the computation of idoms.
std::map<BasicBlock*, InfoRec> Info;
public: public:
ImmediateDominatorsBase(bool isPostDom) : DominatorBase(isPostDom) {} ImmediateDominatorsBase(bool isPostDom) : DominatorBase(isPostDom) {}
...@@ -139,22 +155,6 @@ struct ImmediateDominators : public ImmediateDominatorsBase { ...@@ -139,22 +155,6 @@ struct ImmediateDominators : public ImmediateDominatorsBase {
} }
private: private:
struct InfoRec {
unsigned Semi;
unsigned Size;
BasicBlock *Label, *Parent, *Child, *Ancestor;
std::vector<BasicBlock*> Bucket;
InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){}
};
// Vertex - Map the DFS number to the BasicBlock*
std::vector<BasicBlock*> Vertex;
// Info - Collection of information used during the computation of idoms.
std::map<BasicBlock*, InfoRec> Info;
unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N); unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N);
void Compress(BasicBlock *V, InfoRec &VInfo); void Compress(BasicBlock *V, InfoRec &VInfo);
BasicBlock *Eval(BasicBlock *v); BasicBlock *Eval(BasicBlock *v);
......
...@@ -32,22 +32,6 @@ struct ImmediatePostDominators : public ImmediateDominatorsBase { ...@@ -32,22 +32,6 @@ struct ImmediatePostDominators : public ImmediateDominatorsBase {
} }
private: private:
struct InfoRec {
unsigned Semi;
unsigned Size;
BasicBlock *Label, *Parent, *Child, *Ancestor;
std::vector<BasicBlock*> Bucket;
InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){}
};
// Vertex - Map the DFS number to the BasicBlock*
std::vector<BasicBlock*> Vertex;
// Info - Collection of information used during the computation of idoms.
std::map<BasicBlock*, InfoRec> Info;
unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N); unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N);
void Compress(BasicBlock *V, InfoRec &VInfo); void Compress(BasicBlock *V, InfoRec &VInfo);
BasicBlock *Eval(BasicBlock *v); BasicBlock *Eval(BasicBlock *v);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment