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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return End.getWallTime() - Start.getWallTime(); | 123 return End.getWallTime() - Start.getWallTime(); |
124 } | 124 } |
125 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; | 125 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; |
126 | 126 |
127 private: | 127 private: |
128 const llvm::TimeRecord Start; | 128 const llvm::TimeRecord Start; |
129 Timer(const Timer &) LLVM_DELETED_FUNCTION; | 129 Timer(const Timer &) LLVM_DELETED_FUNCTION; |
130 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; | 130 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; |
131 }; | 131 }; |
132 | 132 |
133 template <typename T> bool WouldOverflowAdd(T X, T Y) { | |
134 return ((X > 0 && Y > 0 && (X > std::numeric_limits<T>::max() - Y)) || | |
135 (X < 0 && Y < 0 && (X < std::numeric_limits<T>::min() - Y))); | |
136 } | |
137 | |
138 } // end of namespace Ice | 133 } // end of namespace Ice |
139 | 134 |
140 #endif // SUBZERO_SRC_ICEDEFS_H | 135 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |