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