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

Side by Side Diff: src/IceDefs.h

Issue 1343843003: Refactor all instances of `typedef y x` to the C++11 `using x = y` syntax. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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.h ('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 /// \file 10 /// \file
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } // end of namespace Internal 131 } // end of namespace Internal
132 132
133 template <class T, class... Args> 133 template <class T, class... Args>
134 static std::unique_ptr<T> makeUnique(Args &&... TheArgs) { 134 static std::unique_ptr<T> makeUnique(Args &&... TheArgs) {
135 return ::Ice::Internal::MakeUniqueEnabler::create<T>( 135 return ::Ice::Internal::MakeUniqueEnabler::create<T>(
136 std::forward<Args>(TheArgs)...); 136 std::forward<Args>(TheArgs)...);
137 } 137 }
138 138
139 #define ENABLE_MAKE_UNIQUE friend struct ::Ice::Internal::MakeUniqueEnabler 139 #define ENABLE_MAKE_UNIQUE friend struct ::Ice::Internal::MakeUniqueEnabler
140 140
141 typedef std::string IceString; 141 using IceString = std::string;
142 typedef llvm::ilist<Inst> InstList; 142 using InstList = llvm::ilist<Inst>;
143 // Ideally PhiList would be llvm::ilist<InstPhi>, and similar for 143 // Ideally PhiList would be llvm::ilist<InstPhi>, and similar for
144 // AssignList, but this runs into issues with SFINAE. 144 // AssignList, but this runs into issues with SFINAE.
145 typedef InstList PhiList; 145 using PhiList = InstList;
146 typedef InstList AssignList; 146 using AssignList = InstList;
147 147
148 // Containers that are arena-allocated from the Cfg's allocator. 148 // Containers that are arena-allocated from the Cfg's allocator.
149 typedef std::vector<Operand *, CfgLocalAllocator<Operand *>> OperandList; 149 using OperandList = std::vector<Operand *, CfgLocalAllocator<Operand *>>;
150 typedef std::vector<Variable *, CfgLocalAllocator<Variable *>> VarList; 150 using VarList = std::vector<Variable *, CfgLocalAllocator<Variable *>>;
151 typedef std::vector<CfgNode *, CfgLocalAllocator<CfgNode *>> NodeList; 151 using NodeList = std::vector<CfgNode *, CfgLocalAllocator<CfgNode *>>;
152 152
153 // Contains that use the default (global) allocator. 153 // Contains that use the default (global) allocator.
154 typedef std::vector<Constant *> ConstantList; 154 using ConstantList = std::vector<Constant *>;
155 typedef std::vector<FunctionDeclaration *> FunctionDeclarationList; 155 using FunctionDeclarationList = std::vector<FunctionDeclaration *>;
156 typedef std::vector<VariableDeclaration *> VariableDeclarationList; 156 using VariableDeclarationList = std::vector<VariableDeclaration *>;
157 157
158 /// SizeT is for holding small-ish limits like number of source 158 /// SizeT is for holding small-ish limits like number of source
159 /// operands in an instruction. It is used instead of size_t (which 159 /// operands in an instruction. It is used instead of size_t (which
160 /// may be 64-bits wide) when we want to save space. 160 /// may be 64-bits wide) when we want to save space.
161 typedef uint32_t SizeT; 161 using SizeT = uint32_t;
162 162
163 /// InstNumberT is for holding an instruction number. Instruction 163 /// InstNumberT is for holding an instruction number. Instruction
164 /// numbers are used for representing Variable live ranges. 164 /// numbers are used for representing Variable live ranges.
165 typedef int32_t InstNumberT; 165 using InstNumberT = int32_t;
166 166
167 /// A LiveBeginEndMapEntry maps a Variable::Number value to an 167 /// A LiveBeginEndMapEntry maps a Variable::Number value to an
168 /// Inst::Number value, giving the instruction number that begins or 168 /// Inst::Number value, giving the instruction number that begins or
169 /// ends a variable's live range. 169 /// ends a variable's live range.
170 typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry; 170 using LiveBeginEndMapEntry = std::pair<SizeT, InstNumberT>;
171 typedef std::vector<LiveBeginEndMapEntry, 171 using LiveBeginEndMap =
172 CfgLocalAllocator<LiveBeginEndMapEntry>> LiveBeginEndMap; 172 std::vector<LiveBeginEndMapEntry, CfgLocalAllocator<LiveBeginEndMapEntry>>;
173 typedef llvm::BitVector LivenessBV; 173 using LivenessBV = llvm::BitVector;
174 174
175 typedef uint32_t TimerStackIdT; 175 using TimerStackIdT = uint32_t;
176 typedef uint32_t TimerIdT; 176 using TimerIdT = uint32_t;
177 177
178 /// Use alignas(MaxCacheLineSize) to isolate variables/fields that 178 /// Use alignas(MaxCacheLineSize) to isolate variables/fields that
179 /// might be contended while multithreading. Assumes the maximum cache 179 /// might be contended while multithreading. Assumes the maximum cache
180 /// line size is 64. 180 /// line size is 64.
181 enum { MaxCacheLineSize = 64 }; 181 enum { MaxCacheLineSize = 64 };
182 // Use ICE_CACHELINE_BOUNDARY to force the next field in a declaration 182 // Use ICE_CACHELINE_BOUNDARY to force the next field in a declaration
183 // list to be aligned to the next cache line. 183 // list to be aligned to the next cache line.
184 // Note: zero is added to work around the following GCC 4.8 bug (fixed in 4.9): 184 // Note: zero is added to work around the following GCC 4.8 bug (fixed in 4.9):
185 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 185 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382
186 #define ICE_CACHELINE_BOUNDARY \ 186 #define ICE_CACHELINE_BOUNDARY \
187 __attribute__((aligned(MaxCacheLineSize + 0))) int : 0 187 __attribute__((aligned(MaxCacheLineSize + 0))) int : 0
188 188
189 /// PNaCl is ILP32, so theoretically we should only need 32-bit offsets. 189 /// PNaCl is ILP32, so theoretically we should only need 32-bit offsets.
190 typedef int32_t RelocOffsetT; 190 using RelocOffsetT = int32_t;
191 enum { RelocAddrSize = 4 }; 191 enum { RelocAddrSize = 4 };
192 192
193 enum LivenessMode { 193 enum LivenessMode {
194 /// Basic version of live-range-end calculation. Marks the last uses 194 /// Basic version of live-range-end calculation. Marks the last uses
195 /// of variables based on dataflow analysis. Records the set of 195 /// of variables based on dataflow analysis. Records the set of
196 /// live-in and live-out variables for each block. Identifies and 196 /// live-in and live-out variables for each block. Identifies and
197 /// deletes dead instructions (primarily stores). 197 /// deletes dead instructions (primarily stores).
198 Liveness_Basic, 198 Liveness_Basic,
199 199
200 /// In addition to Liveness_Basic, also calculate the complete 200 /// In addition to Liveness_Basic, also calculate the complete
(...skipping 21 matching lines...) Expand all
222 IceV_LinearScan = 1 << 7, 222 IceV_LinearScan = 1 << 7,
223 IceV_Frame = 1 << 8, 223 IceV_Frame = 1 << 8,
224 IceV_AddrOpt = 1 << 9, 224 IceV_AddrOpt = 1 << 9,
225 IceV_Random = 1 << 10, 225 IceV_Random = 1 << 10,
226 IceV_Folding = 1 << 11, 226 IceV_Folding = 1 << 11,
227 IceV_RMW = 1 << 12, 227 IceV_RMW = 1 << 12,
228 IceV_Loop = 1 << 13, 228 IceV_Loop = 1 << 13,
229 IceV_All = ~IceV_None, 229 IceV_All = ~IceV_None,
230 IceV_Most = IceV_All & ~IceV_LinearScan 230 IceV_Most = IceV_All & ~IceV_LinearScan
231 }; 231 };
232 typedef uint32_t VerboseMask; 232 using VerboseMask = uint32_t;
233 233
234 enum FileType { 234 enum FileType {
235 FT_Elf, /// ELF .o file 235 FT_Elf, /// ELF .o file
236 FT_Asm, /// Assembly .s file 236 FT_Asm, /// Assembly .s file
237 FT_Iasm /// "Integrated assembler" .byte-style .s file 237 FT_Iasm /// "Integrated assembler" .byte-style .s file
238 }; 238 };
239 239
240 typedef llvm::raw_ostream Ostream; 240 using Ostream = llvm::raw_ostream;
241 typedef llvm::raw_fd_ostream Fdstream; 241 using Fdstream = llvm::raw_fd_ostream;
242 242
243 typedef std::mutex GlobalLockType; 243 using GlobalLockType = std::mutex;
244 244
245 enum ErrorCodes { EC_None = 0, EC_Args, EC_Bitcode, EC_Translation }; 245 enum ErrorCodes { EC_None = 0, EC_Args, EC_Bitcode, EC_Translation };
246 246
247 /// Wrapper around std::error_code for allowing multiple errors to be 247 /// Wrapper around std::error_code for allowing multiple errors to be
248 /// folded into one. The current implementation keeps track of the 248 /// folded into one. The current implementation keeps track of the
249 /// first error, which is likely to be the most useful one, and this 249 /// first error, which is likely to be the most useful one, and this
250 /// could be extended to e.g. collect a vector of errors. 250 /// could be extended to e.g. collect a vector of errors.
251 class ErrorCode : public std::error_code { 251 class ErrorCode : public std::error_code {
252 ErrorCode(const ErrorCode &) = delete; 252 ErrorCode(const ErrorCode &) = delete;
253 ErrorCode &operator=(const ErrorCode &) = delete; 253 ErrorCode &operator=(const ErrorCode &) = delete;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 RPE_GlobalVariableReordering, 288 RPE_GlobalVariableReordering,
289 RPE_NopInsertion, 289 RPE_NopInsertion,
290 RPE_PooledConstantReordering, 290 RPE_PooledConstantReordering,
291 RPE_RegAllocRandomization, 291 RPE_RegAllocRandomization,
292 RPE_num 292 RPE_num
293 }; 293 };
294 294
295 } // end of namespace Ice 295 } // end of namespace Ice
296 296
297 #endif // SUBZERO_SRC_ICEDEFS_H 297 #endif // SUBZERO_SRC_ICEDEFS_H
OLDNEW
« no previous file with comments | « src/IceConverter.h ('k') | src/IceELFObjectWriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698