Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: src/IceDefs.h

Issue 1216963007: Doxygenize the documentation comments (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rebase to master Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceConverter.cpp ('k') | src/IceELFObjectWriter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceDefs.h - Common Subzero declarations ------*- C++ -*-===// 1 //===- subzero/src/IceDefs.h - Common Subzero declarations ------*- 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 widespread use 10 /// \file
11 // across Subzero. Every Subzero source file is expected to include IceDefs.h. 11 /// This file declares various useful types and classes that have widespread use
12 // 12 /// across Subzero. Every Subzero source file is expected to include IceDefs.h.
13 ///
13 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
14 15
15 #ifndef SUBZERO_SRC_ICEDEFS_H 16 #ifndef SUBZERO_SRC_ICEDEFS_H
16 #define SUBZERO_SRC_ICEDEFS_H 17 #define SUBZERO_SRC_ICEDEFS_H
17 18
18 #include "IceBuildDefs.h" // TODO(stichnot): move into individual files 19 #include "IceBuildDefs.h" // TODO(stichnot): move into individual files
19 #include "IceTLS.h" 20 #include "IceTLS.h"
20 21
21 #include "llvm/ADT/ArrayRef.h" 22 #include "llvm/ADT/ArrayRef.h"
22 #include "llvm/ADT/BitVector.h" 23 #include "llvm/ADT/BitVector.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // AssignList, but this runs into issues with SFINAE. 141 // AssignList, but this runs into issues with SFINAE.
141 typedef InstList PhiList; 142 typedef InstList PhiList;
142 typedef InstList AssignList; 143 typedef InstList AssignList;
143 // VarList and NodeList are arena-allocated from the Cfg's allocator. 144 // VarList and NodeList are arena-allocated from the Cfg's allocator.
144 typedef std::vector<Variable *, CfgLocalAllocator<Variable *>> VarList; 145 typedef std::vector<Variable *, CfgLocalAllocator<Variable *>> VarList;
145 typedef std::vector<CfgNode *, CfgLocalAllocator<CfgNode *>> NodeList; 146 typedef std::vector<CfgNode *, CfgLocalAllocator<CfgNode *>> NodeList;
146 typedef std::vector<Constant *> ConstantList; 147 typedef std::vector<Constant *> ConstantList;
147 148
148 typedef std::vector<VariableDeclaration *> VariableDeclarationList; 149 typedef std::vector<VariableDeclaration *> VariableDeclarationList;
149 150
150 // SizeT is for holding small-ish limits like number of source 151 /// SizeT is for holding small-ish limits like number of source
151 // operands in an instruction. It is used instead of size_t (which 152 /// operands in an instruction. It is used instead of size_t (which
152 // may be 64-bits wide) when we want to save space. 153 /// may be 64-bits wide) when we want to save space.
153 typedef uint32_t SizeT; 154 typedef uint32_t SizeT;
154 155
155 // InstNumberT is for holding an instruction number. Instruction 156 /// InstNumberT is for holding an instruction number. Instruction
156 // numbers are used for representing Variable live ranges. 157 /// numbers are used for representing Variable live ranges.
157 typedef int32_t InstNumberT; 158 typedef int32_t InstNumberT;
158 159
159 // A LiveBeginEndMapEntry maps a Variable::Number value to an 160 /// A LiveBeginEndMapEntry maps a Variable::Number value to an
160 // Inst::Number value, giving the instruction number that begins or 161 /// Inst::Number value, giving the instruction number that begins or
161 // ends a variable's live range. 162 /// ends a variable's live range.
162 typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry; 163 typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry;
163 typedef std::vector<LiveBeginEndMapEntry, 164 typedef std::vector<LiveBeginEndMapEntry,
164 CfgLocalAllocator<LiveBeginEndMapEntry>> LiveBeginEndMap; 165 CfgLocalAllocator<LiveBeginEndMapEntry>> LiveBeginEndMap;
165 typedef llvm::BitVector LivenessBV; 166 typedef llvm::BitVector LivenessBV;
166 167
167 typedef uint32_t TimerStackIdT; 168 typedef uint32_t TimerStackIdT;
168 typedef uint32_t TimerIdT; 169 typedef uint32_t TimerIdT;
169 170
170 // Use alignas(MaxCacheLineSize) to isolate variables/fields that 171 /// Use alignas(MaxCacheLineSize) to isolate variables/fields that
171 // might be contended while multithreading. Assumes the maximum cache 172 /// might be contended while multithreading. Assumes the maximum cache
172 // line size is 64. 173 /// line size is 64.
173 enum { MaxCacheLineSize = 64 }; 174 enum { MaxCacheLineSize = 64 };
174 // Use ICE_CACHELINE_BOUNDARY to force the next field in a declaration 175 // Use ICE_CACHELINE_BOUNDARY to force the next field in a declaration
175 // list to be aligned to the next cache line. 176 // list to be aligned to the next cache line.
176 // Note: zero is added to work around the following GCC 4.8 bug (fixed in 4.9): 177 // Note: zero is added to work around the following GCC 4.8 bug (fixed in 4.9):
177 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 178 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382
178 #define ICE_CACHELINE_BOUNDARY \ 179 #define ICE_CACHELINE_BOUNDARY \
179 __attribute__((aligned(MaxCacheLineSize + 0))) int : 0 180 __attribute__((aligned(MaxCacheLineSize + 0))) int : 0
180 181
181 // PNaCl is ILP32, so theoretically we should only need 32-bit offsets. 182 /// PNaCl is ILP32, so theoretically we should only need 32-bit offsets.
182 typedef int32_t RelocOffsetT; 183 typedef int32_t RelocOffsetT;
183 enum { RelocAddrSize = 4 }; 184 enum { RelocAddrSize = 4 };
184 185
185 enum LivenessMode { 186 enum LivenessMode {
186 // Basic version of live-range-end calculation. Marks the last uses 187 /// Basic version of live-range-end calculation. Marks the last uses
187 // of variables based on dataflow analysis. Records the set of 188 /// of variables based on dataflow analysis. Records the set of
188 // live-in and live-out variables for each block. Identifies and 189 /// live-in and live-out variables for each block. Identifies and
189 // deletes dead instructions (primarily stores). 190 /// deletes dead instructions (primarily stores).
190 Liveness_Basic, 191 Liveness_Basic,
191 192
192 // In addition to Liveness_Basic, also calculate the complete 193 /// In addition to Liveness_Basic, also calculate the complete
193 // live range for each variable in a form suitable for interference 194 /// live range for each variable in a form suitable for interference
194 // calculation and register allocation. 195 /// calculation and register allocation.
195 Liveness_Intervals 196 Liveness_Intervals
196 }; 197 };
197 198
198 enum RegAllocKind { 199 enum RegAllocKind {
199 RAK_Global, // full, global register allocation 200 RAK_Global, /// full, global register allocation
200 RAK_InfOnly // allocation only for infinite-weight Variables 201 RAK_InfOnly /// allocation only for infinite-weight Variables
201 }; 202 };
202 203
203 enum VerboseItem { 204 enum VerboseItem {
204 IceV_None = 0, 205 IceV_None = 0,
205 IceV_Instructions = 1 << 0, 206 IceV_Instructions = 1 << 0,
206 IceV_Deleted = 1 << 1, 207 IceV_Deleted = 1 << 1,
207 IceV_InstNumbers = 1 << 2, 208 IceV_InstNumbers = 1 << 2,
208 IceV_Preds = 1 << 3, 209 IceV_Preds = 1 << 3,
209 IceV_Succs = 1 << 4, 210 IceV_Succs = 1 << 4,
210 IceV_Liveness = 1 << 5, 211 IceV_Liveness = 1 << 5,
211 IceV_RegOrigins = 1 << 6, 212 IceV_RegOrigins = 1 << 6,
212 IceV_LinearScan = 1 << 7, 213 IceV_LinearScan = 1 << 7,
213 IceV_Frame = 1 << 8, 214 IceV_Frame = 1 << 8,
214 IceV_AddrOpt = 1 << 9, 215 IceV_AddrOpt = 1 << 9,
215 IceV_Random = 1 << 10, 216 IceV_Random = 1 << 10,
216 IceV_Folding = 1 << 11, 217 IceV_Folding = 1 << 11,
217 IceV_RMW = 1 << 12, 218 IceV_RMW = 1 << 12,
218 IceV_All = ~IceV_None, 219 IceV_All = ~IceV_None,
219 IceV_Most = IceV_All & ~IceV_LinearScan 220 IceV_Most = IceV_All & ~IceV_LinearScan
220 }; 221 };
221 typedef uint32_t VerboseMask; 222 typedef uint32_t VerboseMask;
222 223
223 enum FileType { 224 enum FileType {
224 FT_Elf, // ELF .o file 225 FT_Elf, /// ELF .o file
225 FT_Asm, // Assembly .s file 226 FT_Asm, /// Assembly .s file
226 FT_Iasm // "Integrated assembler" .byte-style .s file 227 FT_Iasm /// "Integrated assembler" .byte-style .s file
227 }; 228 };
228 229
229 typedef llvm::raw_ostream Ostream; 230 typedef llvm::raw_ostream Ostream;
230 typedef llvm::raw_fd_ostream Fdstream; 231 typedef llvm::raw_fd_ostream Fdstream;
231 232
232 typedef std::mutex GlobalLockType; 233 typedef std::mutex GlobalLockType;
233 234
234 enum ErrorCodes { EC_None = 0, EC_Args, EC_Bitcode, EC_Translation }; 235 enum ErrorCodes { EC_None = 0, EC_Args, EC_Bitcode, EC_Translation };
235 236
236 // Wrapper around std::error_code for allowing multiple errors to be 237 /// Wrapper around std::error_code for allowing multiple errors to be
237 // folded into one. The current implementation keeps track of the 238 /// folded into one. The current implementation keeps track of the
238 // first error, which is likely to be the most useful one, and this 239 /// first error, which is likely to be the most useful one, and this
239 // could be extended to e.g. collect a vector of errors. 240 /// could be extended to e.g. collect a vector of errors.
240 class ErrorCode : public std::error_code { 241 class ErrorCode : public std::error_code {
241 ErrorCode(const ErrorCode &) = delete; 242 ErrorCode(const ErrorCode &) = delete;
242 ErrorCode &operator=(const ErrorCode &) = delete; 243 ErrorCode &operator=(const ErrorCode &) = delete;
243 244
244 public: 245 public:
245 ErrorCode() = default; 246 ErrorCode() = default;
246 void assign(ErrorCodes Code) { 247 void assign(ErrorCodes Code) {
247 if (!HasError) { 248 if (!HasError) {
248 HasError = true; 249 HasError = true;
249 std::error_code::assign(Code, std::generic_category()); 250 std::error_code::assign(Code, std::generic_category());
250 } 251 }
251 } 252 }
252 void assign(int Code) { assign(static_cast<ErrorCodes>(Code)); } 253 void assign(int Code) { assign(static_cast<ErrorCodes>(Code)); }
253 254
254 private: 255 private:
255 bool HasError = false; 256 bool HasError = false;
256 }; 257 };
257 258
258 // Reverse range adaptors written in terms of llvm::make_range(). 259 /// Reverse range adaptors written in terms of llvm::make_range().
259 template <typename T> 260 template <typename T>
260 llvm::iterator_range<typename T::const_reverse_iterator> 261 llvm::iterator_range<typename T::const_reverse_iterator>
261 reverse_range(const T &Container) { 262 reverse_range(const T &Container) {
262 return llvm::make_range(Container.rbegin(), Container.rend()); 263 return llvm::make_range(Container.rbegin(), Container.rend());
263 } 264 }
264 template <typename T> 265 template <typename T>
265 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) { 266 llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) {
266 return llvm::make_range(Container.rbegin(), Container.rend()); 267 return llvm::make_range(Container.rbegin(), Container.rend());
267 } 268 }
268 269
269 // Options for pooling and randomization of immediates 270 /// Options for pooling and randomization of immediates.
270 enum RandomizeAndPoolImmediatesEnum { RPI_None, RPI_Randomize, RPI_Pool }; 271 enum RandomizeAndPoolImmediatesEnum { RPI_None, RPI_Randomize, RPI_Pool };
271 272
272 } // end of namespace Ice 273 } // end of namespace Ice
273 274
274 #endif // SUBZERO_SRC_ICEDEFS_H 275 #endif // SUBZERO_SRC_ICEDEFS_H
OLDNEW
« no previous file with comments | « src/IceConverter.cpp ('k') | src/IceELFObjectWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698