| Index: src/IceGlobalContext.h | 
| diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h | 
| index f997b65f1ba22e698bd5dc17ad1d649234dd9b57..e1dc29a21aef3456471780d8acfd17685837b4ac 100644 | 
| --- a/src/IceGlobalContext.h | 
| +++ b/src/IceGlobalContext.h | 
| @@ -69,12 +69,8 @@ public: | 
|  | 
| // Returns true if any of the specified options in the verbose mask | 
| // are set.  If the argument is omitted, it checks if any verbose | 
| -  // options at all are set.  IceV_Timing is treated specially, so | 
| -  // that running with just IceV_Timing verbosity doesn't trigger an | 
| -  // avalanche of extra output. | 
| -  bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const { | 
| -    return VMask & Mask; | 
| -  } | 
| +  // options at all are set. | 
| +  bool isVerbose(VerboseMask Mask = IceV_All) const { return VMask & Mask; } | 
| void setVerbose(VerboseMask Mask) { VMask = Mask; } | 
| void addVerbose(VerboseMask Mask) { VMask |= Mask; } | 
| void subVerbose(VerboseMask Mask) { VMask &= ~Mask; } | 
| @@ -154,6 +150,10 @@ public: | 
| StatsCumulative.updateFills(); | 
| } | 
|  | 
| +  void pushTimer(const IceString &Name); | 
| +  void popTimer(const IceString &Name); | 
| +  void dumpTimers(); | 
| + | 
| private: | 
| Ostream *StrDump; // Stream for dumping / diagnostics | 
| Ostream *StrEmit; // Stream for code emission | 
| @@ -170,6 +170,7 @@ private: | 
| RandomNumberGenerator RNG; | 
| CodeStats StatsFunction; | 
| CodeStats StatsCumulative; | 
| +  llvm::OwningPtr<class TimerStack> Timers; | 
| GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 
| GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 
|  | 
| @@ -178,6 +179,25 @@ private: | 
| void incrementSubstitutions(ManglerVector &OldName) const; | 
| }; | 
|  | 
| +// Helper class to push and pop a timer marker.  The constructor | 
| +// pushes a marker, and the destructor pops it.  This is for | 
| +// convenient timing of regions of code. | 
| +class TimerMarker { | 
| +  TimerMarker(const TimerMarker &) LLVM_DELETED_FUNCTION; | 
| +  TimerMarker &operator=(const TimerMarker &) LLVM_DELETED_FUNCTION; | 
| + | 
| +public: | 
| +  TimerMarker(const IceString &Name, GlobalContext *Ctx) | 
| +      : Name(Name), Ctx(Ctx) { | 
| +    Ctx->pushTimer(Name); | 
| +  } | 
| +  ~TimerMarker() { Ctx->popTimer(Name); } | 
| + | 
| +private: | 
| +  const IceString &Name; | 
| +  GlobalContext *Ctx; | 
| +}; | 
| + | 
| } // end of namespace Ice | 
|  | 
| #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 
|  |