[cfe-commits] r45486 - /cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h

Ted Kremenek kremenek at apple.com
Wed Jan 2 09:00:37 PST 2008


Author: kremenek
Date: Wed Jan  2 11:00:32 2008
New Revision: 45486

URL: http://llvm.org/viewvc/llvm-project?rev=45486&view=rev
Log:
Allocate vertices using a BumpPtrAllocator.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h?rev=45486&r1=45485&r2=45486&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/SimulGraph.h Wed Jan  2 11:00:32 2008
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Allocator.h"
 
 namespace clang {
   
@@ -48,6 +49,9 @@
     
   /// VerticesOfEdge - A mapping from edges to vertices.
   EdgeVertexSetMap VerticesOfEdge;
+  
+  /// Allocator - BumpPtrAllocator to create vertices.
+  llvm::BumpPtrAllocator Allocator;
 
 public:
   SimulGraph() : VertexCounter(0) {}
@@ -72,11 +76,12 @@
     if (V = VSet::FindNodeOrInsertPos(profile,InsertPos))
       return V;
       
-    // FIXME: Allocate from a BumpPtrAllocator.
-    V = new VertexTy(VertexCounter++,Loc,State);
+    // No cache hit.  Allocate a new vertex.
+    V = (VertexTy*) Allocator.Allocate<VertexTy>();
+    new (V) VertexTy(VertexCounter++,Loc,State);
 
     // Insert the vertex in the vertex set and return it.
-    VSet.InserNode(V,InsertPos);
+    VSet.InsertNode(V,InsertPos);
     
     return V;
   }





More information about the cfe-commits mailing list