Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/IceDefs.h

Issue 413393005: Subzero: Make Ice::Ostream a typedef for llvm::raw_ostream. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 IceV_Liveness = 1 << 5, 98 IceV_Liveness = 1 << 5,
99 IceV_RegManager = 1 << 6, 99 IceV_RegManager = 1 << 6,
100 IceV_RegOrigins = 1 << 7, 100 IceV_RegOrigins = 1 << 7,
101 IceV_LinearScan = 1 << 8, 101 IceV_LinearScan = 1 << 8,
102 IceV_Frame = 1 << 9, 102 IceV_Frame = 1 << 9,
103 IceV_Timing = 1 << 10, 103 IceV_Timing = 1 << 10,
104 IceV_All = ~IceV_None 104 IceV_All = ~IceV_None
105 }; 105 };
106 typedef uint32_t VerboseMask; 106 typedef uint32_t VerboseMask;
107 107
108 // The Ostream class wraps an output stream and a Cfg pointer, so 108 typedef llvm::raw_ostream Ostream;
109 // that dump routines have access to the Cfg object and can print
110 // labels and variable names.
111
112 class Ostream {
113 public:
114 Ostream(llvm::raw_ostream *Stream) : Stream(Stream) {}
115
116 llvm::raw_ostream *Stream;
117
118 private:
119 Ostream(const Ostream &) LLVM_DELETED_FUNCTION;
120 Ostream &operator=(const Ostream &) LLVM_DELETED_FUNCTION;
121 };
122
123 template <typename T> inline Ostream &operator<<(Ostream &Str, const T &Val) {
124 if (Str.Stream)
125 (*Str.Stream) << Val;
126 return Str;
127 }
128 109
129 // TODO: Implement in terms of std::chrono after switching to C++11. 110 // TODO: Implement in terms of std::chrono after switching to C++11.
130 class Timer { 111 class Timer {
131 public: 112 public:
132 Timer() : Start(llvm::TimeRecord::getCurrentTime(false)) {} 113 Timer() : Start(llvm::TimeRecord::getCurrentTime(false)) {}
133 uint64_t getElapsedNs() const { return getElapsedSec() * 1000 * 1000 * 1000; } 114 uint64_t getElapsedNs() const { return getElapsedSec() * 1000 * 1000 * 1000; }
134 uint64_t getElapsedUs() const { return getElapsedSec() * 1000 * 1000; } 115 uint64_t getElapsedUs() const { return getElapsedSec() * 1000 * 1000; }
135 uint64_t getElapsedMs() const { return getElapsedSec() * 1000; } 116 uint64_t getElapsedMs() const { return getElapsedSec() * 1000; }
136 double getElapsedSec() const { 117 double getElapsedSec() const {
137 llvm::TimeRecord End = llvm::TimeRecord::getCurrentTime(false); 118 llvm::TimeRecord End = llvm::TimeRecord::getCurrentTime(false);
138 return End.getWallTime() - Start.getWallTime(); 119 return End.getWallTime() - Start.getWallTime();
139 } 120 }
140 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; 121 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const;
141 122
142 private: 123 private:
143 const llvm::TimeRecord Start; 124 const llvm::TimeRecord Start;
144 Timer(const Timer &) LLVM_DELETED_FUNCTION; 125 Timer(const Timer &) LLVM_DELETED_FUNCTION;
145 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; 126 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION;
146 }; 127 };
147 128
148 } // end of namespace Ice 129 } // end of namespace Ice
149 130
150 #endif // SUBZERO_SRC_ICEDEFS_H 131 #endif // SUBZERO_SRC_ICEDEFS_H
OLDNEW
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698