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

Side by Side Diff: src/IceGlobalContext.h

Issue 1024203002: Move some flag-like props from GlobalContext and TargetLowering to ClFlags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review / clean up formatting Created 5 years, 9 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 | « src/IceELFObjectWriter.cpp ('k') | src/IceGlobalContext.cpp » ('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/IceGlobalContext.h - Global context defs -----*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.h - Global context defs -----*- 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 aspects of the compilation that persist across 10 // This file declares aspects of the compilation that persist across
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 public: 140 public:
141 ThreadContext() {} 141 ThreadContext() {}
142 CodeStats StatsFunction; 142 CodeStats StatsFunction;
143 CodeStats StatsCumulative; 143 CodeStats StatsCumulative;
144 TimerList Timers; 144 TimerList Timers;
145 }; 145 };
146 146
147 public: 147 public:
148 GlobalContext(Ostream *OsDump, Ostream *OsEmit, ELFStreamer *ELFStreamer, 148 GlobalContext(Ostream *OsDump, Ostream *OsEmit, ELFStreamer *ELFStreamer,
149 VerboseMask Mask, TargetArch Arch, OptLevel Opt, 149 const ClFlags &Flags);
150 IceString TestPrefix, const ClFlags &Flags);
151 ~GlobalContext(); 150 ~GlobalContext();
152 151
153 VerboseMask getVerbose() const { return VMask; }
154
155 // The dump and emit streams need to be used by only one thread at a 152 // The dump and emit streams need to be used by only one thread at a
156 // time. This is done by exclusively reserving the streams via 153 // time. This is done by exclusively reserving the streams via
157 // lockStr() and unlockStr(). The OstreamLocker class can be used 154 // lockStr() and unlockStr(). The OstreamLocker class can be used
158 // to conveniently manage this. 155 // to conveniently manage this.
159 // 156 //
160 // The model is that a thread grabs the stream lock, then does an 157 // The model is that a thread grabs the stream lock, then does an
161 // arbitrary amount of work during which far-away callees may grab 158 // arbitrary amount of work during which far-away callees may grab
162 // the stream and do something with it, and finally the thread 159 // the stream and do something with it, and finally the thread
163 // releases the stream lock. This allows large chunks of output to 160 // releases the stream lock. This allows large chunks of output to
164 // be dumped or emitted without risking interleaving from multiple 161 // be dumped or emitted without risking interleaving from multiple
165 // threads. 162 // threads.
166 void lockStr() { StrLock.lock(); } 163 void lockStr() { StrLock.lock(); }
167 void unlockStr() { StrLock.unlock(); } 164 void unlockStr() { StrLock.unlock(); }
168 Ostream &getStrDump() { return *StrDump; } 165 Ostream &getStrDump() { return *StrDump; }
169 Ostream &getStrEmit() { return *StrEmit; } 166 Ostream &getStrEmit() { return *StrEmit; }
170 167
171 TargetArch getTargetArch() const { return Arch; }
172 OptLevel getOptLevel() const { return Opt; }
173 LockedPtr<ErrorCode> getErrorStatus() { 168 LockedPtr<ErrorCode> getErrorStatus() {
174 return LockedPtr<ErrorCode>(&ErrorStatus, &ErrorStatusLock); 169 return LockedPtr<ErrorCode>(&ErrorStatus, &ErrorStatusLock);
175 } 170 }
176 171
177 // When emitting assembly, we allow a string to be prepended to 172 // When emitting assembly, we allow a string to be prepended to
178 // names of translated functions. This makes it easier to create an 173 // names of translated functions. This makes it easier to create an
179 // execution test against a reference translator like llc, with both 174 // execution test against a reference translator like llc, with both
180 // translators using the same bitcode as input. 175 // translators using the same bitcode as input.
181 IceString getTestPrefix() const { return TestPrefix; }
182 IceString mangleName(const IceString &Name) const; 176 IceString mangleName(const IceString &Name) const;
183 177
184 // Manage Constants. 178 // Manage Constants.
185 // getConstant*() functions are not const because they might add 179 // getConstant*() functions are not const because they might add
186 // something to the constant pool. 180 // something to the constant pool.
187 Constant *getConstantInt(Type Ty, int64_t Value); 181 Constant *getConstantInt(Type Ty, int64_t Value);
188 Constant *getConstantInt1(int8_t ConstantInt1); 182 Constant *getConstantInt1(int8_t ConstantInt1);
189 Constant *getConstantInt8(int8_t ConstantInt8); 183 Constant *getConstantInt8(int8_t ConstantInt8);
190 Constant *getConstantInt16(int16_t ConstantInt16); 184 Constant *getConstantInt16(int16_t ConstantInt16);
191 Constant *getConstantInt32(int32_t ConstantInt32); 185 Constant *getConstantInt32(int32_t ConstantInt32);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 406
413 ICE_CACHELINE_BOUNDARY; 407 ICE_CACHELINE_BOUNDARY;
414 // StrLock is a global lock on the dump and emit output streams. 408 // StrLock is a global lock on the dump and emit output streams.
415 typedef std::mutex StrLockType; 409 typedef std::mutex StrLockType;
416 StrLockType StrLock; 410 StrLockType StrLock;
417 Ostream *StrDump; // Stream for dumping / diagnostics 411 Ostream *StrDump; // Stream for dumping / diagnostics
418 Ostream *StrEmit; // Stream for code emission 412 Ostream *StrEmit; // Stream for code emission
419 413
420 ICE_CACHELINE_BOUNDARY; 414 ICE_CACHELINE_BOUNDARY;
421 415
422 const VerboseMask VMask;
423 Intrinsics IntrinsicsInfo; 416 Intrinsics IntrinsicsInfo;
424 const TargetArch Arch;
425 const OptLevel Opt;
426 const IceString TestPrefix;
427 const ClFlags &Flags; 417 const ClFlags &Flags;
428 RandomNumberGenerator RNG; // TODO(stichnot): Move into Cfg. 418 RandomNumberGenerator RNG; // TODO(stichnot): Move into Cfg.
429 std::unique_ptr<ELFObjectWriter> ObjectWriter; 419 std::unique_ptr<ELFObjectWriter> ObjectWriter;
430 BoundedProducerConsumerQueue<Cfg> OptQ; 420 BoundedProducerConsumerQueue<Cfg> OptQ;
431 BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ; 421 BoundedProducerConsumerQueue<EmitterWorkItem> EmitQ;
432 422
433 LockedPtr<ArenaAllocator<>> getAllocator() { 423 LockedPtr<ArenaAllocator<>> getAllocator() {
434 return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock); 424 return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock);
435 } 425 }
436 LockedPtr<ConstantPool> getConstPool() { 426 LockedPtr<ConstantPool> getConstPool() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } 497 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); }
508 ~OstreamLocker() { Ctx->unlockStr(); } 498 ~OstreamLocker() { Ctx->unlockStr(); }
509 499
510 private: 500 private:
511 GlobalContext *const Ctx; 501 GlobalContext *const Ctx;
512 }; 502 };
513 503
514 } // end of namespace Ice 504 } // end of namespace Ice
515 505
516 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 506 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698