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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // options at all are set. IceV_Timing is treated specially, so | 40 // options at all are set. IceV_Timing is treated specially, so |
41 // that running with just IceV_Timing verbosity doesn't trigger an | 41 // that running with just IceV_Timing verbosity doesn't trigger an |
42 // avalanche of extra output. | 42 // avalanche of extra output. |
43 bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const { | 43 bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const { |
44 return VMask & Mask; | 44 return VMask & Mask; |
45 } | 45 } |
46 void setVerbose(VerboseMask Mask) { VMask = Mask; } | 46 void setVerbose(VerboseMask Mask) { VMask = Mask; } |
47 void addVerbose(VerboseMask Mask) { VMask |= Mask; } | 47 void addVerbose(VerboseMask Mask) { VMask |= Mask; } |
48 void subVerbose(VerboseMask Mask) { VMask &= ~Mask; } | 48 void subVerbose(VerboseMask Mask) { VMask &= ~Mask; } |
49 | 49 |
50 Ostream &getStrDump() { return StrDump; } | 50 Ostream &getStrDump() { return *StrDump; } |
51 Ostream &getStrEmit() { return StrEmit; } | 51 Ostream &getStrEmit() { return *StrEmit; } |
52 | 52 |
53 TargetArch getTargetArch() const { return Arch; } | 53 TargetArch getTargetArch() const { return Arch; } |
54 OptLevel getOptLevel() const { return Opt; } | 54 OptLevel getOptLevel() const { return Opt; } |
55 | 55 |
56 // When emitting assembly, we allow a string to be prepended to | 56 // When emitting assembly, we allow a string to be prepended to |
57 // names of translated functions. This makes it easier to create an | 57 // names of translated functions. This makes it easier to create an |
58 // execution test against a reference translator like llc, with both | 58 // execution test against a reference translator like llc, with both |
59 // translators using the same bitcode as input. | 59 // translators using the same bitcode as input. |
60 IceString getTestPrefix() const { return TestPrefix; } | 60 IceString getTestPrefix() const { return TestPrefix; } |
61 IceString mangleName(const IceString &Name) const; | 61 IceString mangleName(const IceString &Name) const; |
(...skipping 23 matching lines...) Expand all Loading... |
85 // getConstantPool() returns a copy of the constant pool for | 85 // getConstantPool() returns a copy of the constant pool for |
86 // constants of a given type. | 86 // constants of a given type. |
87 ConstantList getConstantPool(Type Ty) const; | 87 ConstantList getConstantPool(Type Ty) const; |
88 | 88 |
89 // Allocate data of type T using the global allocator. | 89 // Allocate data of type T using the global allocator. |
90 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } | 90 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } |
91 | 91 |
92 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } | 92 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } |
93 | 93 |
94 private: | 94 private: |
95 Ostream StrDump; // Stream for dumping / diagnostics | 95 Ostream *StrDump; // Stream for dumping / diagnostics |
96 Ostream StrEmit; // Stream for code emission | 96 Ostream *StrEmit; // Stream for code emission |
97 | 97 |
98 llvm::BumpPtrAllocator Allocator; | 98 llvm::BumpPtrAllocator Allocator; |
99 VerboseMask VMask; | 99 VerboseMask VMask; |
100 llvm::OwningPtr<class ConstantPool> ConstPool; | 100 llvm::OwningPtr<class ConstantPool> ConstPool; |
101 Intrinsics IntrinsicsInfo; | 101 Intrinsics IntrinsicsInfo; |
102 const TargetArch Arch; | 102 const TargetArch Arch; |
103 const OptLevel Opt; | 103 const OptLevel Opt; |
104 const IceString TestPrefix; | 104 const IceString TestPrefix; |
105 bool HasEmittedFirstMethod; | 105 bool HasEmittedFirstMethod; |
106 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; | 106 GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION; |
107 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; | 107 GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION; |
108 | 108 |
109 // Private helpers for mangleName() | 109 // Private helpers for mangleName() |
110 typedef llvm::SmallVector<char, 32> ManglerVector; | 110 typedef llvm::SmallVector<char, 32> ManglerVector; |
111 void incrementSubstitutions(ManglerVector &OldName) const; | 111 void incrementSubstitutions(ManglerVector &OldName) const; |
112 }; | 112 }; |
113 | 113 |
114 } // end of namespace Ice | 114 } // end of namespace Ice |
115 | 115 |
116 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 116 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |