| OLD | NEW | 
|---|
| 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- C++ -*-===// | 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- 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 aspects of the compilation that persist across | 10 // This file declares aspects of the compilation that persist across | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 62 // the output streams. | 62 // the output streams. | 
| 63 class GlobalContext { | 63 class GlobalContext { | 
| 64 public: | 64 public: | 
| 65   GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit, | 65   GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit, | 
| 66                 VerboseMask Mask, TargetArch Arch, OptLevel Opt, | 66                 VerboseMask Mask, TargetArch Arch, OptLevel Opt, | 
| 67                 IceString TestPrefix, const ClFlags &Flags); | 67                 IceString TestPrefix, const ClFlags &Flags); | 
| 68   ~GlobalContext(); | 68   ~GlobalContext(); | 
| 69 | 69 | 
| 70   // Returns true if any of the specified options in the verbose mask | 70   // Returns true if any of the specified options in the verbose mask | 
| 71   // are set.  If the argument is omitted, it checks if any verbose | 71   // are set.  If the argument is omitted, it checks if any verbose | 
| 72   // options at all are set.  IceV_Timing is treated specially, so | 72   // options at all are set. | 
| 73   // that running with just IceV_Timing verbosity doesn't trigger an | 73   bool isVerbose(VerboseMask Mask = IceV_All) const { return VMask & Mask; } | 
| 74   // avalanche of extra output. |  | 
| 75   bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const { |  | 
| 76     return VMask & Mask; |  | 
| 77   } |  | 
| 78   void setVerbose(VerboseMask Mask) { VMask = Mask; } | 74   void setVerbose(VerboseMask Mask) { VMask = Mask; } | 
| 79   void addVerbose(VerboseMask Mask) { VMask |= Mask; } | 75   void addVerbose(VerboseMask Mask) { VMask |= Mask; } | 
| 80   void subVerbose(VerboseMask Mask) { VMask &= ~Mask; } | 76   void subVerbose(VerboseMask Mask) { VMask &= ~Mask; } | 
| 81 | 77 | 
| 82   Ostream &getStrDump() { return *StrDump; } | 78   Ostream &getStrDump() { return *StrDump; } | 
| 83   Ostream &getStrEmit() { return *StrEmit; } | 79   Ostream &getStrEmit() { return *StrEmit; } | 
| 84 | 80 | 
| 85   TargetArch getTargetArch() const { return Arch; } | 81   TargetArch getTargetArch() const { return Arch; } | 
| 86   OptLevel getOptLevel() const { return Opt; } | 82   OptLevel getOptLevel() const { return Opt; } | 
| 87 | 83 | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147   } | 143   } | 
| 148   void statsUpdateSpills() { | 144   void statsUpdateSpills() { | 
| 149     StatsFunction.updateSpills(); | 145     StatsFunction.updateSpills(); | 
| 150     StatsCumulative.updateSpills(); | 146     StatsCumulative.updateSpills(); | 
| 151   } | 147   } | 
| 152   void statsUpdateFills() { | 148   void statsUpdateFills() { | 
| 153     StatsFunction.updateFills(); | 149     StatsFunction.updateFills(); | 
| 154     StatsCumulative.updateFills(); | 150     StatsCumulative.updateFills(); | 
| 155   } | 151   } | 
| 156 | 152 | 
|  | 153   static TimerIdT getTimerID(const IceString &Name); | 
|  | 154   void pushTimer(TimerIdT ID); | 
|  | 155   void popTimer(TimerIdT ID); | 
|  | 156   void dumpTimers(); | 
|  | 157 | 
| 157 private: | 158 private: | 
| 158   Ostream *StrDump; // Stream for dumping / diagnostics | 159   Ostream *StrDump; // Stream for dumping / diagnostics | 
| 159   Ostream *StrEmit; // Stream for code emission | 160   Ostream *StrEmit; // Stream for code emission | 
| 160 | 161 | 
| 161   llvm::BumpPtrAllocator Allocator; | 162   llvm::BumpPtrAllocator Allocator; | 
| 162   VerboseMask VMask; | 163   VerboseMask VMask; | 
| 163   llvm::OwningPtr<class ConstantPool> ConstPool; | 164   llvm::OwningPtr<class ConstantPool> ConstPool; | 
| 164   Intrinsics IntrinsicsInfo; | 165   Intrinsics IntrinsicsInfo; | 
| 165   const TargetArch Arch; | 166   const TargetArch Arch; | 
| 166   const OptLevel Opt; | 167   const OptLevel Opt; | 
| 167   const IceString TestPrefix; | 168   const IceString TestPrefix; | 
| 168   const ClFlags &Flags; | 169   const ClFlags &Flags; | 
| 169   bool HasEmittedFirstMethod; | 170   bool HasEmittedFirstMethod; | 
| 170   RandomNumberGenerator RNG; | 171   RandomNumberGenerator RNG; | 
| 171   CodeStats StatsFunction; | 172   CodeStats StatsFunction; | 
| 172   CodeStats StatsCumulative; | 173   CodeStats StatsCumulative; | 
|  | 174   llvm::OwningPtr<class TimerStack> Timers; | 
| 173   GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 175   GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 
| 174   GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 176   GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 
| 175 | 177 | 
| 176   // Private helpers for mangleName() | 178   // Private helpers for mangleName() | 
| 177   typedef llvm::SmallVector<char, 32> ManglerVector; | 179   typedef llvm::SmallVector<char, 32> ManglerVector; | 
| 178   void incrementSubstitutions(ManglerVector &OldName) const; | 180   void incrementSubstitutions(ManglerVector &OldName) const; | 
| 179 }; | 181 }; | 
| 180 | 182 | 
|  | 183 // Helper class to push and pop a timer marker.  The constructor | 
|  | 184 // pushes a marker, and the destructor pops it.  This is for | 
|  | 185 // convenient timing of regions of code. | 
|  | 186 class TimerMarker { | 
|  | 187   TimerMarker(const TimerMarker &) LLVM_DELETED_FUNCTION; | 
|  | 188   TimerMarker &operator=(const TimerMarker &) LLVM_DELETED_FUNCTION; | 
|  | 189 | 
|  | 190 public: | 
|  | 191   TimerMarker(TimerIdT ID, GlobalContext *Ctx) | 
|  | 192       : ID(ID), Ctx(Ctx), Active(Ctx->getFlags().SubzeroTimingEnabled) { | 
|  | 193     if (Active) | 
|  | 194       Ctx->pushTimer(ID); | 
|  | 195   } | 
|  | 196   ~TimerMarker() { | 
|  | 197     if (Active) | 
|  | 198       Ctx->popTimer(ID); | 
|  | 199   } | 
|  | 200 | 
|  | 201 private: | 
|  | 202   TimerIdT ID; | 
|  | 203   GlobalContext *const Ctx; | 
|  | 204   const bool Active; | 
|  | 205 }; | 
|  | 206 | 
| 181 } // end of namespace Ice | 207 } // end of namespace Ice | 
| 182 | 208 | 
| 183 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 209 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 
| OLD | NEW | 
|---|