OLD | NEW |
1 //===- subzero/src/IceGlobalInits.h - Global declarations -------*- C++ -*-===// | 1 //===- subzero/src/IceGlobalInits.h - Global declarations -------*- 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 the representation of function declarations, | 10 // This file declares the representation of function declarations, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void dump(GlobalContext *Ctx, Ostream &Stream) const final; | 209 void dump(GlobalContext *Ctx, Ostream &Stream) const final; |
210 static bool classof(const Initializer *Z) { | 210 static bool classof(const Initializer *Z) { |
211 return Z->getKind() == ZeroInitializerKind; | 211 return Z->getKind() == ZeroInitializerKind; |
212 } | 212 } |
213 | 213 |
214 private: | 214 private: |
215 // The number of bytes to be zero initialized. | 215 // The number of bytes to be zero initialized. |
216 SizeT Size; | 216 SizeT Size; |
217 }; | 217 }; |
218 | 218 |
219 // Relocation address offsets must be 32 bit values. | |
220 typedef int32_t RelocOffsetType; | |
221 static const SizeT RelocAddrSize = 4; | |
222 | |
223 /// Defines the relocation value of another global declaration. | 219 /// Defines the relocation value of another global declaration. |
224 class RelocInitializer : public Initializer { | 220 class RelocInitializer : public Initializer { |
225 RelocInitializer(const RelocInitializer &) = delete; | 221 RelocInitializer(const RelocInitializer &) = delete; |
226 RelocInitializer &operator=(const RelocInitializer &) = delete; | 222 RelocInitializer &operator=(const RelocInitializer &) = delete; |
227 | 223 |
228 public: | 224 public: |
229 RelocInitializer(const GlobalDeclaration *Declaration, | 225 RelocInitializer(const GlobalDeclaration *Declaration, RelocOffsetT Offset) |
230 RelocOffsetType Offset) | |
231 : Initializer(RelocInitializerKind), Declaration(Declaration), | 226 : Initializer(RelocInitializerKind), Declaration(Declaration), |
232 Offset(Offset) {} | 227 Offset(Offset) {} |
233 ~RelocInitializer() override {} | 228 ~RelocInitializer() override {} |
234 RelocOffsetType getOffset() const { return Offset; } | 229 RelocOffsetT getOffset() const { return Offset; } |
235 const GlobalDeclaration *getDeclaration() const { return Declaration; } | 230 const GlobalDeclaration *getDeclaration() const { return Declaration; } |
236 SizeT getNumBytes() const final { return RelocAddrSize; } | 231 SizeT getNumBytes() const final { return RelocAddrSize; } |
237 void dump(GlobalContext *Ctx, Ostream &Stream) const final; | 232 void dump(GlobalContext *Ctx, Ostream &Stream) const final; |
238 void dumpType(Ostream &Stream) const final; | 233 void dumpType(Ostream &Stream) const final; |
239 static bool classof(const Initializer *R) { | 234 static bool classof(const Initializer *R) { |
240 return R->getKind() == RelocInitializerKind; | 235 return R->getKind() == RelocInitializerKind; |
241 } | 236 } |
242 | 237 |
243 private: | 238 private: |
244 // The global declaration used in the relocation. | 239 // The global declaration used in the relocation. |
245 const GlobalDeclaration *Declaration; | 240 const GlobalDeclaration *Declaration; |
246 // The offset to add to the relocation. | 241 // The offset to add to the relocation. |
247 const RelocOffsetType Offset; | 242 const RelocOffsetT Offset; |
248 }; | 243 }; |
249 | 244 |
250 /// Models the list of initializers. | 245 /// Models the list of initializers. |
251 typedef std::vector<Initializer *> InitializerListType; | 246 typedef std::vector<Initializer *> InitializerListType; |
252 | 247 |
253 static VariableDeclaration *create(GlobalContext *Ctx); | 248 static VariableDeclaration *create(GlobalContext *Ctx); |
254 ~VariableDeclaration() final; | 249 ~VariableDeclaration() final; |
255 | 250 |
256 const InitializerListType &getInitializers() const { return Initializers; } | 251 const InitializerListType &getInitializers() const { return Initializers; } |
257 bool getIsConstant() const { return IsConstant; } | 252 bool getIsConstant() const { return IsConstant; } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 template <class StreamType> | 315 template <class StreamType> |
321 inline StreamType &operator<<(StreamType &Stream, | 316 inline StreamType &operator<<(StreamType &Stream, |
322 const GlobalDeclaration &Addr) { | 317 const GlobalDeclaration &Addr) { |
323 Addr.dump(Stream); | 318 Addr.dump(Stream); |
324 return Stream; | 319 return Stream; |
325 } | 320 } |
326 | 321 |
327 } // end of namespace Ice | 322 } // end of namespace Ice |
328 | 323 |
329 #endif // SUBZERO_SRC_ICEGLOBALINITS_H | 324 #endif // SUBZERO_SRC_ICEGLOBALINITS_H |
OLD | NEW |