| 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 // This file declares aspects of the compilation that persist across | 10 // This file declares aspects of the compilation that persist across |
| 11 // multiple functions. | 11 // multiple functions. |
| 12 // | 12 // |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H | 15 #ifndef SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| 16 #define SUBZERO_SRC_ICEGLOBALCONTEXT_H | 16 #define SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| 17 | 17 |
| 18 #include "llvm/ADT/OwningPtr.h" | 18 #include "llvm/ADT/OwningPtr.h" |
| 19 #include "llvm/Support/Allocator.h" | 19 #include "llvm/Support/Allocator.h" |
| 20 #include "llvm/Support/raw_ostream.h" | 20 #include "llvm/Support/raw_ostream.h" |
| 21 | 21 |
| 22 #include "IceDefs.h" | 22 #include "IceDefs.h" |
| 23 #include "IceIntrinsics.h" | 23 #include "IceIntrinsics.h" |
| 24 #include "IceRNG.h" |
| 24 #include "IceTypes.h" | 25 #include "IceTypes.h" |
| 25 | 26 |
| 26 namespace Ice { | 27 namespace Ice { |
| 27 | 28 |
| 28 class ClFlags; | 29 class ClFlags; |
| 29 | 30 |
| 30 // TODO: Accesses to all non-const fields of GlobalContext need to | 31 // TODO: Accesses to all non-const fields of GlobalContext need to |
| 31 // be synchronized, especially the constant pool, the allocator, and | 32 // be synchronized, especially the constant pool, the allocator, and |
| 32 // the output streams. | 33 // the output streams. |
| 33 class GlobalContext { | 34 class GlobalContext { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // constants of a given type. | 89 // constants of a given type. |
| 89 ConstantList getConstantPool(Type Ty) const; | 90 ConstantList getConstantPool(Type Ty) const; |
| 90 | 91 |
| 91 const ClFlags &getFlags() const { return Flags; } | 92 const ClFlags &getFlags() const { return Flags; } |
| 92 | 93 |
| 93 // Allocate data of type T using the global allocator. | 94 // Allocate data of type T using the global allocator. |
| 94 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } | 95 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } |
| 95 | 96 |
| 96 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } | 97 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } |
| 97 | 98 |
| 99 // TODO(wala,stichnot): Make the RNG play nicely with multithreaded |
| 100 // translation. |
| 101 RandomNumberGenerator &getRNG() { return RNG; } |
| 102 |
| 98 private: | 103 private: |
| 99 Ostream *StrDump; // Stream for dumping / diagnostics | 104 Ostream *StrDump; // Stream for dumping / diagnostics |
| 100 Ostream *StrEmit; // Stream for code emission | 105 Ostream *StrEmit; // Stream for code emission |
| 101 | 106 |
| 102 llvm::BumpPtrAllocator Allocator; | 107 llvm::BumpPtrAllocator Allocator; |
| 103 VerboseMask VMask; | 108 VerboseMask VMask; |
| 104 llvm::OwningPtr<class ConstantPool> ConstPool; | 109 llvm::OwningPtr<class ConstantPool> ConstPool; |
| 105 Intrinsics IntrinsicsInfo; | 110 Intrinsics IntrinsicsInfo; |
| 106 const TargetArch Arch; | 111 const TargetArch Arch; |
| 107 const OptLevel Opt; | 112 const OptLevel Opt; |
| 108 const IceString TestPrefix; | 113 const IceString TestPrefix; |
| 109 const ClFlags &Flags; | 114 const ClFlags &Flags; |
| 110 bool HasEmittedFirstMethod; | 115 bool HasEmittedFirstMethod; |
| 116 RandomNumberGenerator RNG; |
| 111 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 117 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; |
| 112 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 118 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; |
| 113 | 119 |
| 114 // Private helpers for mangleName() | 120 // Private helpers for mangleName() |
| 115 typedef llvm::SmallVector<char, 32> ManglerVector; | 121 typedef llvm::SmallVector<char, 32> ManglerVector; |
| 116 void incrementSubstitutions(ManglerVector &OldName) const; | 122 void incrementSubstitutions(ManglerVector &OldName) const; |
| 117 }; | 123 }; |
| 118 | 124 |
| 119 } // end of namespace Ice | 125 } // end of namespace Ice |
| 120 | 126 |
| 121 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 127 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| OLD | NEW |