OLD | NEW |
1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// | 1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- 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 | 10 // This file declares various useful types and classes that have |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 IceV_Instructions = 1 << 0, | 96 IceV_Instructions = 1 << 0, |
97 IceV_Deleted = 1 << 1, | 97 IceV_Deleted = 1 << 1, |
98 IceV_InstNumbers = 1 << 2, | 98 IceV_InstNumbers = 1 << 2, |
99 IceV_Preds = 1 << 3, | 99 IceV_Preds = 1 << 3, |
100 IceV_Succs = 1 << 4, | 100 IceV_Succs = 1 << 4, |
101 IceV_Liveness = 1 << 5, | 101 IceV_Liveness = 1 << 5, |
102 IceV_RegManager = 1 << 6, | 102 IceV_RegManager = 1 << 6, |
103 IceV_RegOrigins = 1 << 7, | 103 IceV_RegOrigins = 1 << 7, |
104 IceV_LinearScan = 1 << 8, | 104 IceV_LinearScan = 1 << 8, |
105 IceV_Frame = 1 << 9, | 105 IceV_Frame = 1 << 9, |
106 IceV_Timing = 1 << 10, | 106 IceV_AddrOpt = 1 << 10, |
107 IceV_AddrOpt = 1 << 11, | |
108 IceV_All = ~IceV_None, | 107 IceV_All = ~IceV_None, |
109 IceV_Most = IceV_All & ~(IceV_Timing | IceV_LinearScan) | 108 IceV_Most = IceV_All & ~IceV_LinearScan |
110 }; | 109 }; |
111 typedef uint32_t VerboseMask; | 110 typedef uint32_t VerboseMask; |
112 | 111 |
113 typedef llvm::raw_ostream Ostream; | 112 typedef llvm::raw_ostream Ostream; |
114 | 113 |
115 // TODO: Implement in terms of std::chrono after switching to C++11. | |
116 class Timer { | |
117 public: | |
118 Timer() : Start(llvm::TimeRecord::getCurrentTime(false)) {} | |
119 uint64_t getElapsedNs() const { return getElapsedSec() * 1000 * 1000 * 1000; } | |
120 uint64_t getElapsedUs() const { return getElapsedSec() * 1000 * 1000; } | |
121 uint64_t getElapsedMs() const { return getElapsedSec() * 1000; } | |
122 double getElapsedSec() const { | |
123 llvm::TimeRecord End = llvm::TimeRecord::getCurrentTime(false); | |
124 return End.getWallTime() - Start.getWallTime(); | |
125 } | |
126 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; | |
127 | |
128 private: | |
129 const llvm::TimeRecord Start; | |
130 Timer(const Timer &) LLVM_DELETED_FUNCTION; | |
131 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; | |
132 }; | |
133 | |
134 } // end of namespace Ice | 114 } // end of namespace Ice |
135 | 115 |
136 #endif // SUBZERO_SRC_ICEDEFS_H | 116 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |