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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 // SizeT is for holding small-ish limits like number of source | 72 // SizeT is for holding small-ish limits like number of source |
73 // operands in an instruction. It is used instead of size_t (which | 73 // operands in an instruction. It is used instead of size_t (which |
74 // may be 64-bits wide) when we want to save space. | 74 // may be 64-bits wide) when we want to save space. |
75 typedef uint32_t SizeT; | 75 typedef uint32_t SizeT; |
76 | 76 |
77 // InstNumberT is for holding an instruction number. Instruction | 77 // InstNumberT is for holding an instruction number. Instruction |
78 // numbers are used for representing Variable live ranges. | 78 // numbers are used for representing Variable live ranges. |
79 typedef int32_t InstNumberT; | 79 typedef int32_t InstNumberT; |
80 | 80 |
| 81 typedef uint32_t TimerIdT; |
| 82 |
81 enum LivenessMode { | 83 enum LivenessMode { |
82 // Basic version of live-range-end calculation. Marks the last uses | 84 // Basic version of live-range-end calculation. Marks the last uses |
83 // of variables based on dataflow analysis. Records the set of | 85 // of variables based on dataflow analysis. Records the set of |
84 // live-in and live-out variables for each block. Identifies and | 86 // live-in and live-out variables for each block. Identifies and |
85 // deletes dead instructions (primarily stores). | 87 // deletes dead instructions (primarily stores). |
86 Liveness_Basic, | 88 Liveness_Basic, |
87 | 89 |
88 // In addition to Liveness_Basic, also calculate the complete | 90 // In addition to Liveness_Basic, also calculate the complete |
89 // live range for each variable in a form suitable for interference | 91 // live range for each variable in a form suitable for interference |
90 // calculation and register allocation. | 92 // calculation and register allocation. |
91 Liveness_Intervals | 93 Liveness_Intervals |
92 }; | 94 }; |
93 | 95 |
94 enum VerboseItem { | 96 enum VerboseItem { |
95 IceV_None = 0, | 97 IceV_None = 0, |
96 IceV_Instructions = 1 << 0, | 98 IceV_Instructions = 1 << 0, |
97 IceV_Deleted = 1 << 1, | 99 IceV_Deleted = 1 << 1, |
98 IceV_InstNumbers = 1 << 2, | 100 IceV_InstNumbers = 1 << 2, |
99 IceV_Preds = 1 << 3, | 101 IceV_Preds = 1 << 3, |
100 IceV_Succs = 1 << 4, | 102 IceV_Succs = 1 << 4, |
101 IceV_Liveness = 1 << 5, | 103 IceV_Liveness = 1 << 5, |
102 IceV_RegManager = 1 << 6, | 104 IceV_RegManager = 1 << 6, |
103 IceV_RegOrigins = 1 << 7, | 105 IceV_RegOrigins = 1 << 7, |
104 IceV_LinearScan = 1 << 8, | 106 IceV_LinearScan = 1 << 8, |
105 IceV_Frame = 1 << 9, | 107 IceV_Frame = 1 << 9, |
106 IceV_Timing = 1 << 10, | 108 IceV_AddrOpt = 1 << 10, |
107 IceV_AddrOpt = 1 << 11, | |
108 IceV_All = ~IceV_None, | 109 IceV_All = ~IceV_None, |
109 IceV_Most = IceV_All & ~(IceV_Timing | IceV_LinearScan) | 110 IceV_Most = IceV_All & ~IceV_LinearScan |
110 }; | 111 }; |
111 typedef uint32_t VerboseMask; | 112 typedef uint32_t VerboseMask; |
112 | 113 |
113 typedef llvm::raw_ostream Ostream; | 114 typedef llvm::raw_ostream Ostream; |
114 | 115 |
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 | 116 } // end of namespace Ice |
135 | 117 |
136 #endif // SUBZERO_SRC_ICEDEFS_H | 118 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |