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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 1024 * 1024> |
62 ArenaAllocator; | 62 ArenaAllocator; |
63 | 63 |
64 template <size_t SlabSize> | |
Jim Stichnoth
2015/01/09 22:30:35
I was wondering if you could just parameterize Are
jvoung (off chromium)
2015/01/09 22:50:19
Ah yep, that seems to work. Done.
| |
65 using SizedArenaAllocator = | |
66 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, SlabSize>; | |
67 | |
64 ArenaAllocator *getCurrentCfgAllocator(); | 68 ArenaAllocator *getCurrentCfgAllocator(); |
65 | 69 |
66 template <typename T> struct CfgLocalAllocator { | 70 template <typename T> struct CfgLocalAllocator { |
67 using value_type = T; | 71 using value_type = T; |
68 CfgLocalAllocator() = default; | 72 CfgLocalAllocator() = default; |
69 template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {} | 73 template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {} |
70 T *allocate(std::size_t Num) { | 74 T *allocate(std::size_t Num) { |
71 return getCurrentCfgAllocator()->Allocate<T>(Num); | 75 return getCurrentCfgAllocator()->Allocate<T>(Num); |
72 } | 76 } |
73 void deallocate(T *, std::size_t) {} | 77 void deallocate(T *, std::size_t) {} |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 return llvm::make_range(Container.rbegin(), Container.rend()); | 169 return llvm::make_range(Container.rbegin(), Container.rend()); |
166 } | 170 } |
167 template <typename T> | 171 template <typename T> |
168 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { | 172 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { |
169 return llvm::make_range(Container.rbegin(), Container.rend()); | 173 return llvm::make_range(Container.rbegin(), Container.rend()); |
170 } | 174 } |
171 | 175 |
172 } // end of namespace Ice | 176 } // end of namespace Ice |
173 | 177 |
174 #endif // SUBZERO_SRC_ICEDEFS_H | 178 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |