OLD | NEW |
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 /// \file | 10 /// \file |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // the constant pool. | 193 // the constant pool. |
194 Constant *getConstantInt(Type Ty, int64_t Value); | 194 Constant *getConstantInt(Type Ty, int64_t Value); |
195 Constant *getConstantInt1(int8_t ConstantInt1); | 195 Constant *getConstantInt1(int8_t ConstantInt1); |
196 Constant *getConstantInt8(int8_t ConstantInt8); | 196 Constant *getConstantInt8(int8_t ConstantInt8); |
197 Constant *getConstantInt16(int16_t ConstantInt16); | 197 Constant *getConstantInt16(int16_t ConstantInt16); |
198 Constant *getConstantInt32(int32_t ConstantInt32); | 198 Constant *getConstantInt32(int32_t ConstantInt32); |
199 Constant *getConstantInt64(int64_t ConstantInt64); | 199 Constant *getConstantInt64(int64_t ConstantInt64); |
200 Constant *getConstantFloat(float Value); | 200 Constant *getConstantFloat(float Value); |
201 Constant *getConstantDouble(double Value); | 201 Constant *getConstantDouble(double Value); |
202 /// Returns a symbolic constant. | 202 /// Returns a symbolic constant. |
203 Constant *getConstantSym(const RelocOffsetArray &Offset, | 203 Constant *getConstantSym(const RelocOffsetT Offset, |
| 204 const RelocOffsetArray &OffsetExpr, |
204 const IceString &Name, const IceString &EmitString, | 205 const IceString &Name, const IceString &EmitString, |
205 bool SuppressMangling); | 206 bool SuppressMangling); |
206 Constant *getConstantSym(RelocOffsetT Offset, const IceString &Name, | 207 Constant *getConstantSym(RelocOffsetT Offset, const IceString &Name, |
207 bool SuppressMangling); | 208 bool SuppressMangling); |
208 Constant *getConstantExternSym(const IceString &Name); | 209 Constant *getConstantExternSym(const IceString &Name); |
209 /// Returns an undef. | 210 /// Returns an undef. |
210 Constant *getConstantUndef(Type Ty); | 211 Constant *getConstantUndef(Type Ty); |
211 /// Returns a zero value. | 212 /// Returns a zero value. |
212 Constant *getConstantZero(Type Ty); | 213 Constant *getConstantZero(Type Ty); |
213 /// getConstantPool() returns a copy of the constant pool for constants of a | 214 /// getConstantPool() returns a copy of the constant pool for constants of a |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 return Match.empty() || Match == SymbolName; | 438 return Match.empty() || Match == SymbolName; |
438 } | 439 } |
439 | 440 |
440 private: | 441 private: |
441 // Try to ensure mutexes are allocated on separate cache lines. | 442 // Try to ensure mutexes are allocated on separate cache lines. |
442 | 443 |
443 // Destructors collaborate with Allocator | 444 // Destructors collaborate with Allocator |
444 ICE_CACHELINE_BOUNDARY; | 445 ICE_CACHELINE_BOUNDARY; |
445 // Managed by getAllocator() | 446 // Managed by getAllocator() |
446 GlobalLockType AllocLock; | 447 GlobalLockType AllocLock; |
447 ArenaAllocator<> Allocator; | 448 ArenaAllocator Allocator; |
448 | 449 |
449 ICE_CACHELINE_BOUNDARY; | 450 ICE_CACHELINE_BOUNDARY; |
450 // Managed by getDestructors() | 451 // Managed by getDestructors() |
451 using DestructorArray = std::vector<std::function<void()>>; | 452 using DestructorArray = std::vector<std::function<void()>>; |
452 GlobalLockType DestructorsLock; | 453 GlobalLockType DestructorsLock; |
453 DestructorArray Destructors; | 454 DestructorArray Destructors; |
454 | 455 |
455 ICE_CACHELINE_BOUNDARY; | 456 ICE_CACHELINE_BOUNDARY; |
456 // Managed by getConstantPool() | 457 // Managed by getConstantPool() |
457 GlobalLockType ConstPoolLock; | 458 GlobalLockType ConstPoolLock; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 std::unique_ptr<TargetDataLowering> DataLowering; | 500 std::unique_ptr<TargetDataLowering> DataLowering; |
500 /// If !HasEmittedCode, SubZero will accumulate all Globals (which are "true" | 501 /// If !HasEmittedCode, SubZero will accumulate all Globals (which are "true" |
501 /// program global variables) until the first code WorkItem is seen. | 502 /// program global variables) until the first code WorkItem is seen. |
502 // TODO(jpp): move to EmitterContext. | 503 // TODO(jpp): move to EmitterContext. |
503 bool HasSeenCode = false; | 504 bool HasSeenCode = false; |
504 // TODO(jpp): move to EmitterContext. | 505 // TODO(jpp): move to EmitterContext. |
505 VariableDeclarationList Globals; | 506 VariableDeclarationList Globals; |
506 // TODO(jpp): move to EmitterContext. | 507 // TODO(jpp): move to EmitterContext. |
507 VariableDeclaration *ProfileBlockInfoVarDecl; | 508 VariableDeclaration *ProfileBlockInfoVarDecl; |
508 | 509 |
509 LockedPtr<ArenaAllocator<>> getAllocator() { | 510 LockedPtr<ArenaAllocator> getAllocator() { |
510 return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock); | 511 return LockedPtr<ArenaAllocator>(&Allocator, &AllocLock); |
511 } | 512 } |
512 LockedPtr<ConstantPool> getConstPool() { | 513 LockedPtr<ConstantPool> getConstPool() { |
513 return LockedPtr<ConstantPool>(ConstPool.get(), &ConstPoolLock); | 514 return LockedPtr<ConstantPool>(ConstPool.get(), &ConstPoolLock); |
514 } | 515 } |
515 LockedPtr<JumpTableDataList> getJumpTableList() { | 516 LockedPtr<JumpTableDataList> getJumpTableList() { |
516 return LockedPtr<JumpTableDataList>(&JumpTableList, &JumpTablesLock); | 517 return LockedPtr<JumpTableDataList>(&JumpTableList, &JumpTablesLock); |
517 } | 518 } |
518 LockedPtr<CodeStats> getStatsCumulative() { | 519 LockedPtr<CodeStats> getStatsCumulative() { |
519 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); | 520 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); |
520 } | 521 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 604 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
604 ~OstreamLocker() { Ctx->unlockStr(); } | 605 ~OstreamLocker() { Ctx->unlockStr(); } |
605 | 606 |
606 private: | 607 private: |
607 GlobalContext *const Ctx; | 608 GlobalContext *const Ctx; |
608 }; | 609 }; |
609 | 610 |
610 } // end of namespace Ice | 611 } // end of namespace Ice |
611 | 612 |
612 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 613 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |