Add an unwind_to field to basic blocks, making them Users instead of Values.
[oota-llvm.git] / include / llvm / Support / Allocator.h
index 527d4c6e2cbf30f2cb55fc2f122726bec636c8d9..fc82597be42c77ccc8f4402139af8c74882c247c 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Chris Lattner and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -14,6 +14,7 @@
 #ifndef LLVM_SUPPORT_ALLOCATOR_H
 #define LLVM_SUPPORT_ALLOCATOR_H
 
+#include "llvm/Support/AlignOf.h"
 #include <cstdlib>
 
 namespace llvm {
@@ -23,7 +24,12 @@ public:
   MallocAllocator() {}
   ~MallocAllocator() {}
   
+  void Reset() {}
   void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); }
+  
+  template <typename T>
+  void *Allocate() { return reinterpret_cast<T*>(malloc(sizeof(T))); }
+  
   void Deallocate(void *Ptr) { free(Ptr); }
   void PrintStats() const {}
 };
@@ -38,11 +44,19 @@ public:
   BumpPtrAllocator();
   ~BumpPtrAllocator();
   
+  void Reset();
   void *Allocate(unsigned Size, unsigned Alignment);
+
+  template <typename T>
+  void *Allocate() { 
+    return reinterpret_cast<T*>(Allocate(sizeof(T),AlignOf<T>::Alignment));
+  }
+
+  
   void Deallocate(void *Ptr) {}
   void PrintStats() const;
 };
 
-}  // end namespace clang
+}  // end namespace llvm
 
 #endif