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 <memory> | 18 #include <memory> |
19 | 19 |
20 #include "llvm/Support/Allocator.h" | 20 #include "llvm/Support/Allocator.h" |
21 #include "llvm/Support/raw_ostream.h" | 21 #include "llvm/Support/raw_ostream.h" |
22 | 22 |
23 #include "IceDefs.h" | 23 #include "IceDefs.h" |
24 #include "IceClFlags.h" | |
Jim Stichnoth
2014/10/10 13:15:00
Is this new include necessary?
Karl
2014/10/10 20:17:30
See line 220. On that line it uses Ctx>getFlags().
| |
24 #include "IceIntrinsics.h" | 25 #include "IceIntrinsics.h" |
25 #include "IceRNG.h" | 26 #include "IceRNG.h" |
26 #include "IceTimerTree.h" | 27 #include "IceTimerTree.h" |
27 #include "IceTypes.h" | 28 #include "IceTypes.h" |
28 | 29 |
29 namespace Ice { | 30 namespace Ice { |
30 | 31 |
31 class ClFlags; | 32 class ClFlags; |
33 class FuncSigType; | |
34 class Function; | |
35 class GlobalVariable; | |
32 | 36 |
33 // This class collects rudimentary statistics during translation. | 37 // This class collects rudimentary statistics during translation. |
34 class CodeStats { | 38 class CodeStats { |
35 public: | 39 public: |
36 CodeStats() | 40 CodeStats() |
37 : InstructionsEmitted(0), RegistersSaved(0), FrameBytes(0), Spills(0), | 41 : InstructionsEmitted(0), RegistersSaved(0), FrameBytes(0), Spills(0), |
38 Fills(0) {} | 42 Fills(0) {} |
39 void reset() { *this = CodeStats(); } | 43 void reset() { *this = CodeStats(); } |
40 void updateEmitted(uint32_t InstCount) { InstructionsEmitted += InstCount; } | 44 void updateEmitted(uint32_t InstCount) { InstructionsEmitted += InstCount; } |
41 void updateRegistersSaved(uint32_t Num) { RegistersSaved += Num; } | 45 void updateRegistersSaved(uint32_t Num) { RegistersSaved += Num; } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // Returns a symbolic constant. | 114 // Returns a symbolic constant. |
111 Constant *getConstantSym(Type Ty, int64_t Offset, const IceString &Name = "", | 115 Constant *getConstantSym(Type Ty, int64_t Offset, const IceString &Name = "", |
112 bool SuppressMangling = false); | 116 bool SuppressMangling = false); |
113 // Returns an undef. | 117 // Returns an undef. |
114 Constant *getConstantUndef(Type Ty); | 118 Constant *getConstantUndef(Type Ty); |
115 // Returns a zero value. | 119 // Returns a zero value. |
116 Constant *getConstantZero(Type Ty); | 120 Constant *getConstantZero(Type Ty); |
117 // getConstantPool() returns a copy of the constant pool for | 121 // getConstantPool() returns a copy of the constant pool for |
118 // constants of a given type. | 122 // constants of a given type. |
119 ConstantList getConstantPool(Type Ty) const; | 123 ConstantList getConstantPool(Type Ty) const; |
124 // Returns a new function, allocated in an internal memory pool. | |
125 // Ownership of the function is maintained by this class instance. | |
126 Function *newFunction(const FuncSigType *Signature, unsigned CallingConv, | |
127 unsigned Linkage, bool IsProto); | |
128 | |
129 // Returns a new global variable, allocated in an internal memory | |
130 // pool. Ownership of the function is maintained by this class | |
131 // instance. | |
132 GlobalVariable *newGlobalVariable(); | |
120 | 133 |
121 const ClFlags &getFlags() const { return Flags; } | 134 const ClFlags &getFlags() const { return Flags; } |
122 | 135 |
123 // Allocate data of type T using the global allocator. | 136 // Allocate data of type T using the global allocator. |
124 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } | 137 template <typename T> T *allocate() { return Allocator.Allocate<T>(); } |
125 | 138 |
126 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } | 139 const Intrinsics &getIntrinsicsInfo() const { return IntrinsicsInfo; } |
127 | 140 |
128 // TODO(wala,stichnot): Make the RNG play nicely with multithreaded | 141 // TODO(wala,stichnot): Make the RNG play nicely with multithreaded |
129 // translation. | 142 // translation. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 Intrinsics IntrinsicsInfo; | 192 Intrinsics IntrinsicsInfo; |
180 const TargetArch Arch; | 193 const TargetArch Arch; |
181 const OptLevel Opt; | 194 const OptLevel Opt; |
182 const IceString TestPrefix; | 195 const IceString TestPrefix; |
183 const ClFlags &Flags; | 196 const ClFlags &Flags; |
184 bool HasEmittedFirstMethod; | 197 bool HasEmittedFirstMethod; |
185 RandomNumberGenerator RNG; | 198 RandomNumberGenerator RNG; |
186 CodeStats StatsFunction; | 199 CodeStats StatsFunction; |
187 CodeStats StatsCumulative; | 200 CodeStats StatsCumulative; |
188 std::vector<TimerStack> Timers; | 201 std::vector<TimerStack> Timers; |
202 std::vector<GlobalAddress *> GlobalAddresses; | |
189 GlobalContext(const GlobalContext &) = delete; | 203 GlobalContext(const GlobalContext &) = delete; |
190 GlobalContext &operator=(const GlobalContext &) = delete; | 204 GlobalContext &operator=(const GlobalContext &) = delete; |
191 | 205 |
192 // Private helpers for mangleName() | 206 // Private helpers for mangleName() |
193 typedef llvm::SmallVector<char, 32> ManglerVector; | 207 typedef llvm::SmallVector<char, 32> ManglerVector; |
194 void incrementSubstitutions(ManglerVector &OldName) const; | 208 void incrementSubstitutions(ManglerVector &OldName) const; |
195 }; | 209 }; |
196 | 210 |
197 // Helper class to push and pop a timer marker. The constructor | 211 // Helper class to push and pop a timer marker. The constructor |
198 // pushes a marker, and the destructor pops it. This is for | 212 // pushes a marker, and the destructor pops it. This is for |
(...skipping 17 matching lines...) Expand all Loading... | |
216 | 230 |
217 private: | 231 private: |
218 TimerIdT ID; | 232 TimerIdT ID; |
219 GlobalContext *const Ctx; | 233 GlobalContext *const Ctx; |
220 const bool Active; | 234 const bool Active; |
221 }; | 235 }; |
222 | 236 |
223 } // end of namespace Ice | 237 } // end of namespace Ice |
224 | 238 |
225 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H | 239 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H |
OLD | NEW |