| 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 |
| 11 // widespread use across Subzero. Every Subzero source file is | 11 // widespread use across Subzero. Every Subzero source file is |
| 12 // expected to include IceDefs.h. | 12 // expected to include IceDefs.h. |
| 13 // | 13 // |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #ifndef SUBZERO_SRC_ICEDEFS_H | 16 #ifndef SUBZERO_SRC_ICEDEFS_H |
| 17 #define SUBZERO_SRC_ICEDEFS_H | 17 #define SUBZERO_SRC_ICEDEFS_H |
| 18 | 18 |
| 19 #include <cassert> | 19 #include <cassert> |
| 20 #include <cstdint> | 20 #include <cstdint> |
| 21 #include <cstdio> // snprintf | 21 #include <cstdio> // snprintf |
| 22 #include <functional> // std::less | 22 #include <functional> // std::less |
| 23 #include <limits> | 23 #include <limits> |
| 24 #include <list> | 24 #include <list> |
| 25 #include <map> | 25 #include <map> |
| 26 #include <mutex> |
| 26 #include <string> | 27 #include <string> |
| 27 #include <vector> | 28 #include <vector> |
| 28 #include "llvm/ADT/ArrayRef.h" | 29 #include "llvm/ADT/ArrayRef.h" |
| 29 #include "llvm/ADT/BitVector.h" | 30 #include "llvm/ADT/BitVector.h" |
| 30 #include "llvm/ADT/ilist.h" | 31 #include "llvm/ADT/ilist.h" |
| 31 #include "llvm/ADT/ilist_node.h" | 32 #include "llvm/ADT/ilist_node.h" |
| 32 #include "llvm/ADT/iterator_range.h" | 33 #include "llvm/ADT/iterator_range.h" |
| 33 #include "llvm/ADT/SmallBitVector.h" | 34 #include "llvm/ADT/SmallBitVector.h" |
| 34 #include "llvm/ADT/SmallVector.h" | 35 #include "llvm/ADT/SmallVector.h" |
| 35 #include "llvm/ADT/STLExtras.h" | 36 #include "llvm/ADT/STLExtras.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 class FunctionDeclaration; | 59 class FunctionDeclaration; |
| 59 class GlobalContext; | 60 class GlobalContext; |
| 60 class GlobalDeclaration; | 61 class GlobalDeclaration; |
| 61 class Inst; | 62 class Inst; |
| 62 class InstAssign; | 63 class InstAssign; |
| 63 class InstPhi; | 64 class InstPhi; |
| 64 class InstTarget; | 65 class InstTarget; |
| 65 class LiveRange; | 66 class LiveRange; |
| 66 class Liveness; | 67 class Liveness; |
| 67 class Operand; | 68 class Operand; |
| 69 class TargetGlobalLowering; |
| 68 class TargetLowering; | 70 class TargetLowering; |
| 69 class Variable; | 71 class Variable; |
| 70 class VariableDeclaration; | 72 class VariableDeclaration; |
| 71 class VariablesMetadata; | 73 class VariablesMetadata; |
| 72 | 74 |
| 73 template <size_t SlabSize = 1024 * 1024> | 75 template <size_t SlabSize = 1024 * 1024> |
| 74 using ArenaAllocator = | 76 using ArenaAllocator = |
| 75 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, SlabSize>; | 77 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, SlabSize>; |
| 76 | 78 |
| 77 ArenaAllocator<> *getCurrentCfgAllocator(); | 79 ArenaAllocator<> *getCurrentCfgAllocator(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Inst::Number value, giving the instruction number that begins or | 122 // Inst::Number value, giving the instruction number that begins or |
| 121 // ends a variable's live range. | 123 // ends a variable's live range. |
| 122 typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry; | 124 typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry; |
| 123 typedef std::vector<LiveBeginEndMapEntry, | 125 typedef std::vector<LiveBeginEndMapEntry, |
| 124 CfgLocalAllocator<LiveBeginEndMapEntry>> LiveBeginEndMap; | 126 CfgLocalAllocator<LiveBeginEndMapEntry>> LiveBeginEndMap; |
| 125 typedef llvm::BitVector LivenessBV; | 127 typedef llvm::BitVector LivenessBV; |
| 126 | 128 |
| 127 typedef uint32_t TimerStackIdT; | 129 typedef uint32_t TimerStackIdT; |
| 128 typedef uint32_t TimerIdT; | 130 typedef uint32_t TimerIdT; |
| 129 | 131 |
| 132 // Use alignas(MaxCacheLineSize) to isolate variables/fields that |
| 133 // might be contended while multithreading. Assumes the maximum cache |
| 134 // line size is 64. |
| 135 enum { |
| 136 MaxCacheLineSize = 64 |
| 137 }; |
| 138 |
| 130 // PNaCl is ILP32, so theoretically we should only need 32-bit offsets. | 139 // PNaCl is ILP32, so theoretically we should only need 32-bit offsets. |
| 131 typedef int32_t RelocOffsetT; | 140 typedef int32_t RelocOffsetT; |
| 132 enum { RelocAddrSize = 4 }; | 141 enum { RelocAddrSize = 4 }; |
| 133 | 142 |
| 134 enum LivenessMode { | 143 enum LivenessMode { |
| 135 // Basic version of live-range-end calculation. Marks the last uses | 144 // Basic version of live-range-end calculation. Marks the last uses |
| 136 // of variables based on dataflow analysis. Records the set of | 145 // of variables based on dataflow analysis. Records the set of |
| 137 // live-in and live-out variables for each block. Identifies and | 146 // live-in and live-out variables for each block. Identifies and |
| 138 // deletes dead instructions (primarily stores). | 147 // deletes dead instructions (primarily stores). |
| 139 Liveness_Basic, | 148 Liveness_Basic, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 163 IceV_AddrOpt = 1 << 9, | 172 IceV_AddrOpt = 1 << 9, |
| 164 IceV_Random = 1 << 10, | 173 IceV_Random = 1 << 10, |
| 165 IceV_All = ~IceV_None, | 174 IceV_All = ~IceV_None, |
| 166 IceV_Most = IceV_All & ~IceV_LinearScan | 175 IceV_Most = IceV_All & ~IceV_LinearScan |
| 167 }; | 176 }; |
| 168 typedef uint32_t VerboseMask; | 177 typedef uint32_t VerboseMask; |
| 169 | 178 |
| 170 typedef llvm::raw_ostream Ostream; | 179 typedef llvm::raw_ostream Ostream; |
| 171 typedef llvm::raw_fd_ostream Fdstream; | 180 typedef llvm::raw_fd_ostream Fdstream; |
| 172 | 181 |
| 182 typedef std::mutex GlobalLockType; |
| 183 |
| 173 // Reverse range adaptors written in terms of llvm::make_range(). | 184 // Reverse range adaptors written in terms of llvm::make_range(). |
| 174 template <typename T> | 185 template <typename T> |
| 175 llvm::iterator_range<typename T::const_reverse_iterator> | 186 llvm::iterator_range<typename T::const_reverse_iterator> |
| 176 reverse_range(const T &Container) { | 187 reverse_range(const T &Container) { |
| 177 return llvm::make_range(Container.rbegin(), Container.rend()); | 188 return llvm::make_range(Container.rbegin(), Container.rend()); |
| 178 } | 189 } |
| 179 template <typename T> | 190 template <typename T> |
| 180 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { | 191 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { |
| 181 return llvm::make_range(Container.rbegin(), Container.rend()); | 192 return llvm::make_range(Container.rbegin(), Container.rend()); |
| 182 } | 193 } |
| 183 | 194 |
| 184 } // end of namespace Ice | 195 } // end of namespace Ice |
| 185 | 196 |
| 186 #endif // SUBZERO_SRC_ICEDEFS_H | 197 #endif // SUBZERO_SRC_ICEDEFS_H |
| OLD | NEW |