OLD | NEW |
1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// | 1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares various useful types and classes that have | 10 // This file declares various useful types and classes that have |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 class InstPhi; | 51 class InstPhi; |
52 class InstTarget; | 52 class InstTarget; |
53 class LiveRange; | 53 class LiveRange; |
54 class Liveness; | 54 class Liveness; |
55 class Operand; | 55 class Operand; |
56 class TargetLowering; | 56 class TargetLowering; |
57 class Variable; | 57 class Variable; |
58 class VariableDeclaration; | 58 class VariableDeclaration; |
59 class VariablesMetadata; | 59 class VariablesMetadata; |
60 | 60 |
61 typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 1024 * 1024> | 61 template <size_t SlabSize = 1024 * 1024> |
62 ArenaAllocator; | 62 using ArenaAllocator = |
| 63 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, SlabSize>; |
63 | 64 |
64 ArenaAllocator *getCurrentCfgAllocator(); | 65 ArenaAllocator<> *getCurrentCfgAllocator(); |
65 | 66 |
66 template <typename T> struct CfgLocalAllocator { | 67 template <typename T> struct CfgLocalAllocator { |
67 using value_type = T; | 68 using value_type = T; |
68 CfgLocalAllocator() = default; | 69 CfgLocalAllocator() = default; |
69 template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {} | 70 template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {} |
70 T *allocate(std::size_t Num) { | 71 T *allocate(std::size_t Num) { |
71 return getCurrentCfgAllocator()->Allocate<T>(Num); | 72 return getCurrentCfgAllocator()->Allocate<T>(Num); |
72 } | 73 } |
73 void deallocate(T *, std::size_t) {} | 74 void deallocate(T *, std::size_t) {} |
74 }; | 75 }; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return llvm::make_range(Container.rbegin(), Container.rend()); | 166 return llvm::make_range(Container.rbegin(), Container.rend()); |
166 } | 167 } |
167 template <typename T> | 168 template <typename T> |
168 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { | 169 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { |
169 return llvm::make_range(Container.rbegin(), Container.rend()); | 170 return llvm::make_range(Container.rbegin(), Container.rend()); |
170 } | 171 } |
171 | 172 |
172 } // end of namespace Ice | 173 } // end of namespace Ice |
173 | 174 |
174 #endif // SUBZERO_SRC_ICEDEFS_H | 175 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |