diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-01 22:18:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-01 22:18:46 +0000 |
commit | 2c32773fa236c9980f00e94a637a0424ef75f378 (patch) | |
tree | d668daf0957a0823abaacd35fd11f4188aca1fdc /clang/lib | |
parent | f58c243830ad149bc170263ba584611df224fd6a (diff) | |
download | bcm5719-llvm-2c32773fa236c9980f00e94a637a0424ef75f378.tar.gz bcm5719-llvm-2c32773fa236c9980f00e94a637a0424ef75f378.zip |
Add a new BFS GRWorkList and make it the default worklist model for
GRCoreEngine. This tends to result in shorter paths for pathological cases.
llvm-svn: 70585
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/GRCoreEngine.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/clang/lib/Analysis/GRCoreEngine.cpp b/clang/lib/Analysis/GRCoreEngine.cpp index e4f27b60cf2..46a2173c96a 100644 --- a/clang/lib/Analysis/GRCoreEngine.cpp +++ b/clang/lib/Analysis/GRCoreEngine.cpp @@ -47,13 +47,35 @@ public: return U; } }; + +class VISIBILITY_HIDDEN BFS : public GRWorkList { + std::queue<GRWorkListUnit> Queue; +public: + virtual bool hasWork() const { + return !Queue.empty(); + } + + virtual void Enqueue(const GRWorkListUnit& U) { + Queue.push(U); + } + + virtual GRWorkListUnit Dequeue() { + // Don't use const reference. The subsequent pop_back() might make it + // unsafe. + GRWorkListUnit U = Queue.front(); + Queue.pop(); + return U; + } +}; + } // end anonymous namespace // Place the dstor for GRWorkList here because it contains virtual member // functions, and we the code for the dstor generated in one compilation unit. GRWorkList::~GRWorkList() {} -GRWorkList* GRWorkList::MakeDFS() { return new DFS(); } +GRWorkList *GRWorkList::MakeDFS() { return new DFS(); } +GRWorkList *GRWorkList::MakeBFS() { return new BFS(); } namespace { class VISIBILITY_HIDDEN BFSBlockDFSContents : public GRWorkList { |