blob: c8b429fc4b1b4c3d0a88fcf6a4534b82b8226f29 [file] [log] [blame]
Jim Stichnothc4554d72014-09-30 16:49:38 -07001//===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
Jim Stichnothf7c9a142014-04-29 10:52:43 -07002//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines aspects of the compilation that persist across
11// multiple functions.
12//
13//===----------------------------------------------------------------------===//
14
Jim Stichnoth217dc082014-07-11 14:06:55 -070015#include <ctype.h> // isdigit(), isupper()
Jan Voung839c4ce2014-07-28 15:19:43 -070016#include <locale> // locale
Jim Stichnothd97c7df2014-06-04 11:57:08 -070017
Jim Stichnothf7c9a142014-04-29 10:52:43 -070018#include "IceCfg.h"
Jim Stichnoth989a7032014-08-08 10:13:44 -070019#include "IceClFlags.h"
Jim Stichnotha18cc9c2014-09-30 19:10:22 -070020#include "IceDefs.h"
Jim Stichnothf7c9a142014-04-29 10:52:43 -070021#include "IceGlobalContext.h"
22#include "IceOperand.h"
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070023#include "IceTargetLowering.h"
Jim Stichnothc4554d72014-09-30 16:49:38 -070024#include "IceTimerTree.h"
Jim Stichnotha18cc9c2014-09-30 19:10:22 -070025#include "IceTypes.h"
Jim Stichnothf7c9a142014-04-29 10:52:43 -070026
27namespace Ice {
28
29// TypePool maps constants of type KeyType (e.g. float) to pointers to
30// type ValueType (e.g. ConstantFloat). KeyType values are compared
31// using memcmp() because of potential NaN values in KeyType values.
32// KeyTypeHasFP indicates whether KeyType is a floating-point type
33// whose values need to be compared using memcmp() for NaN
34// correctness. TODO: use std::is_floating_point<KeyType> instead of
35// KeyTypeHasFP with C++11.
36template <typename KeyType, typename ValueType, bool KeyTypeHasFP = false>
37class TypePool {
Jim Stichnoth0795ba02014-10-01 14:23:01 -070038 TypePool(const TypePool &) = delete;
39 TypePool &operator=(const TypePool &) = delete;
Jim Stichnothf7c9a142014-04-29 10:52:43 -070040
41public:
Jim Stichnothf61d5b22014-05-23 13:31:24 -070042 TypePool() : NextPoolID(0) {}
Jim Stichnothf7c9a142014-04-29 10:52:43 -070043 ValueType *getOrAdd(GlobalContext *Ctx, Type Ty, KeyType Key) {
44 TupleType TupleKey = std::make_pair(Ty, Key);
Jim Stichnothf44f3712014-10-01 14:05:51 -070045 auto Iter = Pool.find(TupleKey);
Jim Stichnothf7c9a142014-04-29 10:52:43 -070046 if (Iter != Pool.end())
47 return Iter->second;
Jim Stichnothf61d5b22014-05-23 13:31:24 -070048 ValueType *Result = ValueType::create(Ctx, Ty, Key, NextPoolID++);
Jim Stichnothf7c9a142014-04-29 10:52:43 -070049 Pool[TupleKey] = Result;
50 return Result;
51 }
Jim Stichnothf61d5b22014-05-23 13:31:24 -070052 ConstantList getConstantPool() const {
53 ConstantList Constants;
54 Constants.reserve(Pool.size());
Jim Stichnothf44f3712014-10-01 14:05:51 -070055 for (auto &I : Pool)
56 Constants.push_back(I.second);
Jim Stichnothf61d5b22014-05-23 13:31:24 -070057 return Constants;
58 }
Jim Stichnothf7c9a142014-04-29 10:52:43 -070059
60private:
61 typedef std::pair<Type, KeyType> TupleType;
62 struct TupleCompare {
Jan Voung839c4ce2014-07-28 15:19:43 -070063 bool operator()(const TupleType &A, const TupleType &B) const {
Jim Stichnothf7c9a142014-04-29 10:52:43 -070064 if (A.first != B.first)
65 return A.first < B.first;
66 if (KeyTypeHasFP)
67 return memcmp(&A.second, &B.second, sizeof(KeyType)) < 0;
68 return A.second < B.second;
69 }
70 };
71 typedef std::map<const TupleType, ValueType *, TupleCompare> ContainerType;
72 ContainerType Pool;
Jim Stichnothf61d5b22014-05-23 13:31:24 -070073 uint32_t NextPoolID;
Jim Stichnothf7c9a142014-04-29 10:52:43 -070074};
75
Matt Walad8f4a7d2014-06-18 09:55:03 -070076// UndefPool maps ICE types to the corresponding ConstantUndef values.
77class UndefPool {
Jim Stichnoth0795ba02014-10-01 14:23:01 -070078 UndefPool(const UndefPool &) = delete;
79 UndefPool &operator=(const UndefPool &) = delete;
Matt Walad8f4a7d2014-06-18 09:55:03 -070080
81public:
82 UndefPool() : NextPoolID(0) {}
83
84 ConstantUndef *getOrAdd(GlobalContext *Ctx, Type Ty) {
Jim Stichnothf44f3712014-10-01 14:05:51 -070085 auto I = Pool.find(Ty);
Matt Walad8f4a7d2014-06-18 09:55:03 -070086 if (I != Pool.end())
87 return I->second;
88 ConstantUndef *Undef = ConstantUndef::create(Ctx, Ty, NextPoolID++);
89 Pool[Ty] = Undef;
90 return Undef;
91 }
92
93private:
94 uint32_t NextPoolID;
95 typedef std::map<Type, ConstantUndef *> ContainerType;
96 ContainerType Pool;
97};
98
Jim Stichnothf7c9a142014-04-29 10:52:43 -070099// The global constant pool bundles individual pools of each type of
100// interest.
101class ConstantPool {
Jim Stichnoth0795ba02014-10-01 14:23:01 -0700102 ConstantPool(const ConstantPool &) = delete;
103 ConstantPool &operator=(const ConstantPool &) = delete;
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700104
105public:
106 ConstantPool() {}
107 TypePool<float, ConstantFloat, true> Floats;
108 TypePool<double, ConstantDouble, true> Doubles;
Jan Voungbc004632014-09-16 15:09:10 -0700109 TypePool<uint32_t, ConstantInteger32> Integers32;
110 TypePool<uint64_t, ConstantInteger64> Integers64;
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700111 TypePool<RelocatableTuple, ConstantRelocatable> Relocatables;
Matt Walad8f4a7d2014-06-18 09:55:03 -0700112 UndefPool Undefs;
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700113};
114
115GlobalContext::GlobalContext(llvm::raw_ostream *OsDump,
116 llvm::raw_ostream *OsEmit, VerboseMask Mask,
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700117 TargetArch Arch, OptLevel Opt,
Jim Stichnoth989a7032014-08-08 10:13:44 -0700118 IceString TestPrefix, const ClFlags &Flags)
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700119 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask),
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700120 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt),
Matt Wala1bd2fce2014-08-08 14:02:09 -0700121 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false),
Jim Stichnoth8363a062014-10-07 10:02:38 -0700122 RNG("") {
123 // Pre-register built-in stack names.
124 newTimerStackID("Total across all functions");
125 newTimerStackID("Per-function summary");
126}
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700127
Jim Stichnoth217dc082014-07-11 14:06:55 -0700128// Scan a string for S[0-9A-Z]*_ patterns and replace them with
129// S<num>_ where <num> is the next base-36 value. If a type name
130// legitimately contains that pattern, then the substitution will be
131// made in error and most likely the link will fail. In this case,
132// the test classes can be rewritten not to use that pattern, which is
133// much simpler and more reliable than implementing a full demangling
134// parser. Another substitution-in-error may occur if a type
135// identifier ends with the pattern S[0-9A-Z]*, because an immediately
136// following substitution string like "S1_" or "PS1_" may be combined
137// with the previous type.
138void GlobalContext::incrementSubstitutions(ManglerVector &OldName) const {
139 const std::locale CLocale("C");
140 // Provide extra space in case the length of <num> increases.
141 ManglerVector NewName(OldName.size() * 2);
142 size_t OldPos = 0;
143 size_t NewPos = 0;
144 size_t OldLen = OldName.size();
145 for (; OldPos < OldLen; ++OldPos, ++NewPos) {
146 if (OldName[OldPos] == '\0')
147 break;
148 if (OldName[OldPos] == 'S') {
149 // Search forward until we find _ or invalid character (including \0).
150 bool AllZs = true;
151 bool Found = false;
152 size_t Last;
153 for (Last = OldPos + 1; Last < OldLen; ++Last) {
154 char Ch = OldName[Last];
155 if (Ch == '_') {
156 Found = true;
157 break;
158 } else if (std::isdigit(Ch) || std::isupper(Ch, CLocale)) {
159 if (Ch != 'Z')
160 AllZs = false;
161 } else {
162 // Invalid character, stop searching.
163 break;
164 }
165 }
166 if (Found) {
167 NewName[NewPos++] = OldName[OldPos++]; // 'S'
168 size_t Length = Last - OldPos;
169 // NewPos and OldPos point just past the 'S'.
170 assert(NewName[NewPos - 1] == 'S');
171 assert(OldName[OldPos - 1] == 'S');
172 assert(OldName[OldPos + Length] == '_');
173 if (AllZs) {
Jim Stichnoth78b4c0b2014-07-11 15:29:23 -0700174 // Replace N 'Z' characters with a '0' (if N=0) or '1' (if
175 // N>0) followed by N '0' characters.
176 NewName[NewPos++] = (Length ? '1' : '0');
177 for (size_t i = 0; i < Length; ++i) {
Jim Stichnoth217dc082014-07-11 14:06:55 -0700178 NewName[NewPos++] = '0';
179 }
180 } else {
181 // Iterate right-to-left and increment the base-36 number.
182 bool Carry = true;
183 for (size_t i = 0; i < Length; ++i) {
184 size_t Offset = Length - 1 - i;
185 char Ch = OldName[OldPos + Offset];
186 if (Carry) {
187 Carry = false;
188 switch (Ch) {
189 case '9':
190 Ch = 'A';
191 break;
192 case 'Z':
193 Ch = '0';
194 Carry = true;
195 break;
196 default:
197 ++Ch;
198 break;
199 }
200 }
201 NewName[NewPos + Offset] = Ch;
202 }
203 NewPos += Length;
204 }
205 OldPos = Last;
206 // Fall through and let the '_' be copied across.
207 }
208 }
209 NewName[NewPos] = OldName[OldPos];
210 }
211 assert(NewName[NewPos] == '\0');
212 OldName = NewName;
213}
214
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700215// In this context, name mangling means to rewrite a symbol using a
216// given prefix. For a C++ symbol, nest the original symbol inside
217// the "prefix" namespace. For other symbols, just prepend the
218// prefix.
219IceString GlobalContext::mangleName(const IceString &Name) const {
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700220 // An already-nested name like foo::bar() gets pushed down one
221 // level, making it equivalent to Prefix::foo::bar().
222 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz
223 // A non-nested but mangled name like bar() gets nested, making it
224 // equivalent to Prefix::bar().
225 // _Z3barxyz ==> ZN6Prefix3barExyz
226 // An unmangled, extern "C" style name, gets a simple prefix:
227 // bar ==> Prefixbar
228 if (getTestPrefix().empty())
229 return Name;
230
231 unsigned PrefixLength = getTestPrefix().length();
Jim Stichnoth217dc082014-07-11 14:06:55 -0700232 ManglerVector NameBase(1 + Name.length());
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700233 const size_t BufLen = 30 + Name.length() + PrefixLength;
Jim Stichnoth217dc082014-07-11 14:06:55 -0700234 ManglerVector NewName(BufLen);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700235 uint32_t BaseLength = 0; // using uint32_t due to sscanf format string
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700236
Derek Schuff44712d12014-06-17 14:34:34 -0700237 int ItemsParsed = sscanf(Name.c_str(), "_ZN%s", NameBase.data());
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700238 if (ItemsParsed == 1) {
239 // Transform _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz
240 // (splice in "6Prefix") ^^^^^^^
Derek Schuff44712d12014-06-17 14:34:34 -0700241 snprintf(NewName.data(), BufLen, "_ZN%u%s%s", PrefixLength,
242 getTestPrefix().c_str(), NameBase.data());
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700243 // We ignore the snprintf return value (here and below). If we
244 // somehow miscalculated the output buffer length, the output will
245 // be truncated, but it will be truncated consistently for all
246 // mangleName() calls on the same input string.
Jim Stichnoth217dc082014-07-11 14:06:55 -0700247 incrementSubstitutions(NewName);
Derek Schuff44712d12014-06-17 14:34:34 -0700248 return NewName.data();
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700249 }
250
Jim Stichnothd97c7df2014-06-04 11:57:08 -0700251 // Artificially limit BaseLength to 9 digits (less than 1 billion)
252 // because sscanf behavior is undefined on integer overflow. If
253 // there are more than 9 digits (which we test by looking at the
254 // beginning of NameBase), then we consider this a failure to parse
255 // a namespace mangling, and fall back to the simple prefixing.
Derek Schuff44712d12014-06-17 14:34:34 -0700256 ItemsParsed = sscanf(Name.c_str(), "_Z%9u%s", &BaseLength, NameBase.data());
257 if (ItemsParsed == 2 && BaseLength <= strlen(NameBase.data()) &&
Jim Stichnothd97c7df2014-06-04 11:57:08 -0700258 !isdigit(NameBase[0])) {
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700259 // Transform _Z3barxyz ==> _ZN6Prefix3barExyz
260 // ^^^^^^^^ ^
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700261 // (splice in "N6Prefix", and insert "E" after "3bar")
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700262 // But an "I" after the identifier indicates a template argument
263 // list terminated with "E"; insert the new "E" before/after the
264 // old "E". E.g.:
265 // Transform _Z3barIabcExyz ==> _ZN6Prefix3barIabcEExyz
266 // ^^^^^^^^ ^
267 // (splice in "N6Prefix", and insert "E" after "3barIabcE")
Jim Stichnoth217dc082014-07-11 14:06:55 -0700268 ManglerVector OrigName(Name.length());
269 ManglerVector OrigSuffix(Name.length());
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700270 uint32_t ActualBaseLength = BaseLength;
271 if (NameBase[ActualBaseLength] == 'I') {
272 ++ActualBaseLength;
273 while (NameBase[ActualBaseLength] != 'E' &&
274 NameBase[ActualBaseLength] != '\0')
275 ++ActualBaseLength;
276 }
Derek Schuff44712d12014-06-17 14:34:34 -0700277 strncpy(OrigName.data(), NameBase.data(), ActualBaseLength);
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -0700278 OrigName[ActualBaseLength] = '\0';
Derek Schuff44712d12014-06-17 14:34:34 -0700279 strcpy(OrigSuffix.data(), NameBase.data() + ActualBaseLength);
280 snprintf(NewName.data(), BufLen, "_ZN%u%s%u%sE%s", PrefixLength,
281 getTestPrefix().c_str(), BaseLength, OrigName.data(),
282 OrigSuffix.data());
Jim Stichnoth217dc082014-07-11 14:06:55 -0700283 incrementSubstitutions(NewName);
Derek Schuff44712d12014-06-17 14:34:34 -0700284 return NewName.data();
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700285 }
286
287 // Transform bar ==> Prefixbar
288 // ^^^^^^
289 return getTestPrefix() + Name;
290}
291
292GlobalContext::~GlobalContext() {}
293
Jan Voungbc004632014-09-16 15:09:10 -0700294Constant *GlobalContext::getConstantInt64(Type Ty, uint64_t ConstantInt64) {
295 assert(Ty == IceType_i64);
296 return ConstPool->Integers64.getOrAdd(this, Ty, ConstantInt64);
297}
298
299Constant *GlobalContext::getConstantInt32(Type Ty, uint32_t ConstantInt32) {
Jim Stichnoth3ef786f2014-09-08 11:19:21 -0700300 if (Ty == IceType_i1)
Jan Voungbc004632014-09-16 15:09:10 -0700301 ConstantInt32 &= UINT32_C(1);
302 return ConstPool->Integers32.getOrAdd(this, Ty, ConstantInt32);
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700303}
304
305Constant *GlobalContext::getConstantFloat(float ConstantFloat) {
306 return ConstPool->Floats.getOrAdd(this, IceType_f32, ConstantFloat);
307}
308
309Constant *GlobalContext::getConstantDouble(double ConstantDouble) {
310 return ConstPool->Doubles.getOrAdd(this, IceType_f64, ConstantDouble);
311}
312
313Constant *GlobalContext::getConstantSym(Type Ty, int64_t Offset,
314 const IceString &Name,
315 bool SuppressMangling) {
316 return ConstPool->Relocatables.getOrAdd(
317 this, Ty, RelocatableTuple(Offset, Name, SuppressMangling));
318}
319
Matt Walad8f4a7d2014-06-18 09:55:03 -0700320Constant *GlobalContext::getConstantUndef(Type Ty) {
321 return ConstPool->Undefs.getOrAdd(this, Ty);
322}
323
324Constant *GlobalContext::getConstantZero(Type Ty) {
325 switch (Ty) {
326 case IceType_i1:
327 case IceType_i8:
328 case IceType_i16:
329 case IceType_i32:
Jan Voungbc004632014-09-16 15:09:10 -0700330 return getConstantInt32(Ty, 0);
Matt Walad8f4a7d2014-06-18 09:55:03 -0700331 case IceType_i64:
Jan Voungbc004632014-09-16 15:09:10 -0700332 return getConstantInt64(Ty, 0);
Matt Walad8f4a7d2014-06-18 09:55:03 -0700333 case IceType_f32:
334 return getConstantFloat(0);
335 case IceType_f64:
336 return getConstantDouble(0);
Matt Wala928f1292014-07-07 16:50:46 -0700337 case IceType_v4i1:
338 case IceType_v8i1:
339 case IceType_v16i1:
340 case IceType_v16i8:
341 case IceType_v8i16:
342 case IceType_v4i32:
343 case IceType_v4f32: {
344 IceString Str;
345 llvm::raw_string_ostream BaseOS(Str);
Jim Stichnoth78282f62014-07-27 23:14:00 -0700346 BaseOS << "Unsupported constant type: " << Ty;
Matt Wala928f1292014-07-07 16:50:46 -0700347 llvm_unreachable(BaseOS.str().c_str());
348 } break;
Matt Walad8f4a7d2014-06-18 09:55:03 -0700349 case IceType_void:
350 case IceType_NUM:
351 break;
352 }
353 llvm_unreachable("Unknown type");
354}
355
Jim Stichnothf61d5b22014-05-23 13:31:24 -0700356ConstantList GlobalContext::getConstantPool(Type Ty) const {
357 switch (Ty) {
358 case IceType_i1:
359 case IceType_i8:
360 case IceType_i16:
361 case IceType_i32:
Jan Voungbc004632014-09-16 15:09:10 -0700362 return ConstPool->Integers32.getConstantPool();
Jim Stichnothf61d5b22014-05-23 13:31:24 -0700363 case IceType_i64:
Jan Voungbc004632014-09-16 15:09:10 -0700364 return ConstPool->Integers64.getConstantPool();
Jim Stichnothf61d5b22014-05-23 13:31:24 -0700365 case IceType_f32:
366 return ConstPool->Floats.getConstantPool();
367 case IceType_f64:
368 return ConstPool->Doubles.getConstantPool();
Matt Wala928f1292014-07-07 16:50:46 -0700369 case IceType_v4i1:
370 case IceType_v8i1:
371 case IceType_v16i1:
372 case IceType_v16i8:
373 case IceType_v8i16:
374 case IceType_v4i32:
375 case IceType_v4f32: {
376 IceString Str;
377 llvm::raw_string_ostream BaseOS(Str);
Jim Stichnoth78282f62014-07-27 23:14:00 -0700378 BaseOS << "Unsupported constant type: " << Ty;
Matt Wala928f1292014-07-07 16:50:46 -0700379 llvm_unreachable(BaseOS.str().c_str());
380 } break;
Jim Stichnothf61d5b22014-05-23 13:31:24 -0700381 case IceType_void:
382 case IceType_NUM:
383 break;
384 }
385 llvm_unreachable("Unknown type");
386}
387
Jim Stichnoth8363a062014-10-07 10:02:38 -0700388TimerIdT GlobalContext::getTimerID(TimerStackIdT StackID,
389 const IceString &Name) {
390 assert(StackID < Timers.size());
391 return Timers[StackID].getTimerID(Name);
Jim Stichnothc4554d72014-09-30 16:49:38 -0700392}
393
Jim Stichnoth8363a062014-10-07 10:02:38 -0700394TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) {
395 TimerStackIdT NewID = Timers.size();
396 Timers.push_back(TimerStack(Name));
397 return NewID;
398}
Jim Stichnothc4554d72014-09-30 16:49:38 -0700399
Jim Stichnoth8363a062014-10-07 10:02:38 -0700400void GlobalContext::pushTimer(TimerIdT ID, TimerStackIdT StackID) {
401 assert(StackID < Timers.size());
402 Timers[StackID].push(ID);
403}
404
405void GlobalContext::popTimer(TimerIdT ID, TimerStackIdT StackID) {
406 assert(StackID < Timers.size());
407 Timers[StackID].pop(ID);
408}
Jim Stichnothc4554d72014-09-30 16:49:38 -0700409
Jim Stichnothd14b1a02014-10-08 08:28:36 -0700410void GlobalContext::resetTimer(TimerStackIdT StackID) {
411 assert(StackID < Timers.size());
412 Timers[StackID].reset();
413}
414
415void GlobalContext::setTimerName(TimerStackIdT StackID,
416 const IceString &NewName) {
417 assert(StackID < Timers.size());
418 Timers[StackID].setName(NewName);
419}
420
Jim Stichnothff9c7062014-09-18 04:50:49 -0700421void GlobalContext::dumpStats(const IceString &Name, bool Final) {
Jim Stichnoth18735602014-09-16 19:59:35 -0700422 if (Flags.DumpStats) {
Jim Stichnothff9c7062014-09-18 04:50:49 -0700423 if (Final) {
424 StatsCumulative.dump(Name, getStrDump());
425 } else {
426 StatsFunction.dump(Name, getStrDump());
427 StatsCumulative.dump("_TOTAL_", getStrDump());
428 }
Jim Stichnoth18735602014-09-16 19:59:35 -0700429 }
430}
431
Jim Stichnoth8363a062014-10-07 10:02:38 -0700432void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
433 assert(Timers.size() > StackID);
434 Timers[StackID].dump(getStrDump(), DumpCumulative);
435}
436
437TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func)
438 : ID(ID), Ctx(Func->getContext()),
439 Active(Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled) {
440 if (Active)
441 Ctx->pushTimer(ID);
442}
Jim Stichnothf7c9a142014-04-29 10:52:43 -0700443
444} // end of namespace Ice