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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Returns a symbolic constant. | 151 // Returns a symbolic constant. |
152 Constant *getConstantSym(RelocOffsetT Offset, const IceString &Name, | 152 Constant *getConstantSym(RelocOffsetT Offset, const IceString &Name, |
153 bool SuppressMangling); | 153 bool SuppressMangling); |
154 // Returns an undef. | 154 // Returns an undef. |
155 Constant *getConstantUndef(Type Ty); | 155 Constant *getConstantUndef(Type Ty); |
156 // Returns a zero value. | 156 // Returns a zero value. |
157 Constant *getConstantZero(Type Ty); | 157 Constant *getConstantZero(Type Ty); |
158 // getConstantPool() returns a copy of the constant pool for | 158 // getConstantPool() returns a copy of the constant pool for |
159 // constants of a given type. | 159 // constants of a given type. |
160 ConstantList getConstantPool(Type Ty); | 160 ConstantList getConstantPool(Type Ty); |
161 // Returns a new function declaration, allocated in an internal | |
162 // memory pool. Ownership of the function is maintained by this | |
163 // class instance. | |
164 FunctionDeclaration *newFunctionDeclaration(const FuncSigType *Signature, | |
165 unsigned CallingConv, | |
166 unsigned Linkage, bool IsProto); | |
167 | |
168 // Returns a new global variable declaration, allocated in an | |
169 // internal memory pool. Ownership of the function is maintained by | |
170 // this class instance. | |
171 VariableDeclaration *newVariableDeclaration(); | |
172 | 161 |
173 const ClFlags &getFlags() const { return Flags; } | 162 const ClFlags &getFlags() const { return Flags; } |
174 | 163 |
175 bool isIRGenerationDisabled() const { | 164 bool isIRGenerationDisabled() const { |
176 return ALLOW_DISABLE_IR_GEN ? getFlags().DisableIRGeneration : false; | 165 return ALLOW_DISABLE_IR_GEN ? getFlags().DisableIRGeneration : false; |
177 } | 166 } |
178 | 167 |
179 // Allocate data of type T using the global allocator. | 168 // Allocate data of type T using the global allocator. |
180 template <typename T> T *allocate() { return getAllocator()->Allocate<T>(); } | 169 template <typename T> T *allocate() { return getAllocator()->Allocate<T>(); } |
181 | 170 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 std::unique_ptr<ConstantPool> ConstPool; | 250 std::unique_ptr<ConstantPool> ConstPool; |
262 Intrinsics IntrinsicsInfo; | 251 Intrinsics IntrinsicsInfo; |
263 const TargetArch Arch; | 252 const TargetArch Arch; |
264 const OptLevel Opt; | 253 const OptLevel Opt; |
265 const IceString TestPrefix; | 254 const IceString TestPrefix; |
266 const ClFlags &Flags; | 255 const ClFlags &Flags; |
267 RandomNumberGenerator RNG; | 256 RandomNumberGenerator RNG; |
268 std::unique_ptr<ELFObjectWriter> ObjectWriter; | 257 std::unique_ptr<ELFObjectWriter> ObjectWriter; |
269 CodeStats StatsCumulative; | 258 CodeStats StatsCumulative; |
270 std::vector<TimerStack> Timers; | 259 std::vector<TimerStack> Timers; |
271 std::vector<GlobalDeclaration *> GlobalDeclarations; | |
272 | 260 |
273 LockedPtr<ArenaAllocator<>> getAllocator() { | 261 LockedPtr<ArenaAllocator<>> getAllocator() { |
274 return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock); | 262 return LockedPtr<ArenaAllocator<>>(&Allocator, &AllocLock); |
275 } | 263 } |
276 LockedPtr<ConstantPool> getConstPool() { | 264 LockedPtr<ConstantPool> getConstPool() { |
277 return LockedPtr<ConstantPool>(ConstPool.get(), &ConstPoolLock); | 265 return LockedPtr<ConstantPool>(ConstPool.get(), &ConstPoolLock); |
278 } | 266 } |
279 LockedPtr<CodeStats> getStatsCumulative() { | 267 LockedPtr<CodeStats> getStatsCumulative() { |
280 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); | 268 return LockedPtr<CodeStats>(&StatsCumulative, &StatsLock); |
281 } | 269 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } | 322 explicit OstreamLocker(GlobalContext *Ctx) : Ctx(Ctx) { Ctx->lockStr(); } |
335 ~OstreamLocker() { Ctx->unlockStr(); } | 323 ~OstreamLocker() { Ctx->unlockStr(); } |
336 | 324 |
337 private: | 325 private: |
338 GlobalContext *const Ctx; | 326 GlobalContext *const Ctx; |
339 }; | 327 }; |
340 | 328 |
341 } // end of namespace Ice | 329 } // end of namespace Ice |
342 | 330 |
343 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 331 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |