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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Returns a symbolic constant. | 78 // Returns a symbolic constant. |
78 Constant *getConstantSym(Type Ty, int64_t Offset, const IceString &Name = "", | 79 Constant *getConstantSym(Type Ty, int64_t Offset, const IceString &Name = "", |
79 bool SuppressMangling = false); | 80 bool SuppressMangling = false); |
80 // getConstantPool() returns a copy of the constant pool for | 81 // getConstantPool() returns a copy of the constant pool for |
81 // constants of a given type. | 82 // constants of a given type. |
82 ConstantList getConstantPool(Type Ty) const; | 83 ConstantList getConstantPool(Type Ty) const; |
83 | 84 |
84 // Allocate data of type T using the global allocator. | 85 // Allocate data of type T using the global allocator. |
85 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } | 86 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } |
86 | 87 |
| 88 // Return the IntrinsicInfo for a function with the given Name. |
| 89 // Return UnknownIntrinsicInfo if the name does not match any |
| 90 // known intrinsics. |
| 91 IntrinsicInfo getIntrinsicInfo(const IceString &Name) const; |
| 92 |
87 private: | 93 private: |
88 Ostream StrDump; // Stream for dumping / diagnostics | 94 Ostream StrDump; // Stream for dumping / diagnostics |
89 Ostream StrEmit; // Stream for code emission | 95 Ostream StrEmit; // Stream for code emission |
90 | 96 |
91 llvm::BumpPtrAllocator Allocator; | 97 llvm::BumpPtrAllocator Allocator; |
92 VerboseMask VMask; | 98 VerboseMask VMask; |
93 llvm::OwningPtr<class ConstantPool> ConstPool; | 99 llvm::OwningPtr<class ConstantPool> ConstPool; |
| 100 IntrinsicMap IntrinsicInfos; |
94 const TargetArch Arch; | 101 const TargetArch Arch; |
95 const OptLevel Opt; | 102 const OptLevel Opt; |
96 const IceString TestPrefix; | 103 const IceString TestPrefix; |
97 bool HasEmittedFirstMethod; | 104 bool HasEmittedFirstMethod; |
98 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 105 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; |
99 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 106 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; |
100 }; | 107 }; |
101 | 108 |
102 } // end of namespace Ice | 109 } // end of namespace Ice |
103 | 110 |
104 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 111 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |