| 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 "IceTypes.h" | 24 #include "IceTypes.h" |
| 24 | 25 |
| 25 namespace Ice { | 26 namespace Ice { |
| 26 | 27 |
| 27 // TODO: Accesses to all non-const fields of GlobalContext need to | 28 // TODO: Accesses to all non-const fields of GlobalContext need to |
| 28 // be synchronized, especially the constant pool, the allocator, and | 29 // be synchronized, especially the constant pool, the allocator, and |
| 29 // the output streams. | 30 // the output streams. |
| 30 class GlobalContext { | 31 class GlobalContext { |
| 31 public: | 32 public: |
| 32 GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit, | 33 GlobalContext(llvm::raw_ostream *OsDump, llvm::raw_ostream *OsEmit, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 Constant *getConstantUndef(Type Ty); | 82 Constant *getConstantUndef(Type Ty); |
| 82 // Returns a zero value. | 83 // Returns a zero value. |
| 83 Constant *getConstantZero(Type Ty); | 84 Constant *getConstantZero(Type Ty); |
| 84 // getConstantPool() returns a copy of the constant pool for | 85 // getConstantPool() returns a copy of the constant pool for |
| 85 // constants of a given type. | 86 // constants of a given type. |
| 86 ConstantList getConstantPool(Type Ty) const; | 87 ConstantList getConstantPool(Type Ty) const; |
| 87 | 88 |
| 88 // Allocate data of type T using the global allocator. | 89 // Allocate data of type T using the global allocator. |
| 89 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } | 90 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } |
| 90 | 91 |
| 92 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } |
| 93 |
| 91 private: | 94 private: |
| 92 Ostream StrDump; // Stream for dumping / diagnostics | 95 Ostream StrDump; // Stream for dumping / diagnostics |
| 93 Ostream StrEmit; // Stream for code emission | 96 Ostream StrEmit; // Stream for code emission |
| 94 | 97 |
| 95 llvm::BumpPtrAllocator Allocator; | 98 llvm::BumpPtrAllocator Allocator; |
| 96 VerboseMask VMask; | 99 VerboseMask VMask; |
| 97 llvm::OwningPtr<class ConstantPool> ConstPool; | 100 llvm::OwningPtr<class ConstantPool> ConstPool; |
| 101 Intrinsics IntrinsicsInfo; |
| 98 const TargetArch Arch; | 102 const TargetArch Arch; |
| 99 const OptLevel Opt; | 103 const OptLevel Opt; |
| 100 const IceString TestPrefix; | 104 const IceString TestPrefix; |
| 101 bool HasEmittedFirstMethod; | 105 bool HasEmittedFirstMethod; |
| 102 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 106 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; |
| 103 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 107 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; |
| 104 }; | 108 }; |
| 105 | 109 |
| 106 } // end of namespace Ice | 110 } // end of namespace Ice |
| 107 | 111 |
| 108 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 112 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
| OLD | NEW |