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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 /// Prints out the definition of the global variable declaration | 280 /// Prints out the definition of the global variable declaration |
281 /// (including initialization). | 281 /// (including initialization). |
282 void dump(GlobalContext *Ctx, Ostream &Stream) const final; | 282 void dump(GlobalContext *Ctx, Ostream &Stream) const final; |
283 | 283 |
284 static bool classof(const GlobalDeclaration *Addr) { | 284 static bool classof(const GlobalDeclaration *Addr) { |
285 return Addr->getKind() == VariableDeclarationKind; | 285 return Addr->getKind() == VariableDeclarationKind; |
286 } | 286 } |
287 | 287 |
288 bool getSuppressMangling() const final { | 288 bool getSuppressMangling() const final { |
| 289 if (ForceSuppressMangling) |
| 290 return true; |
289 return isExternal() && !hasInitializer(); | 291 return isExternal() && !hasInitializer(); |
290 } | 292 } |
291 | 293 |
| 294 void setSuppressMangling() { |
| 295 ForceSuppressMangling = true; |
| 296 } |
| 297 |
292 private: | 298 private: |
293 // list of initializers for the declared variable. | 299 // list of initializers for the declared variable. |
294 InitializerListType Initializers; | 300 InitializerListType Initializers; |
295 // The alignment of the declared variable. | 301 // The alignment of the declared variable. |
296 uint32_t Alignment; | 302 uint32_t Alignment; |
297 // True if a declared (global) constant. | 303 // True if a declared (global) constant. |
298 bool IsConstant; | 304 bool IsConstant; |
| 305 // If set to true, force getSuppressMangling() to return true. |
| 306 bool ForceSuppressMangling; |
299 | 307 |
300 VariableDeclaration() | 308 VariableDeclaration() |
301 : GlobalDeclaration(VariableDeclarationKind, | 309 : GlobalDeclaration(VariableDeclarationKind, |
302 llvm::GlobalValue::InternalLinkage), | 310 llvm::GlobalValue::InternalLinkage), |
303 Alignment(0), IsConstant(false) {} | 311 Alignment(0), IsConstant(false), ForceSuppressMangling(false) {} |
304 }; | 312 }; |
305 | 313 |
306 template <class StreamType> | 314 template <class StreamType> |
307 inline StreamType &operator<<(StreamType &Stream, | 315 inline StreamType &operator<<(StreamType &Stream, |
308 const VariableDeclaration::Initializer &Init) { | 316 const VariableDeclaration::Initializer &Init) { |
309 Init.dump(Stream); | 317 Init.dump(Stream); |
310 return Stream; | 318 return Stream; |
311 } | 319 } |
312 | 320 |
313 template <class StreamType> | 321 template <class StreamType> |
314 inline StreamType &operator<<(StreamType &Stream, | 322 inline StreamType &operator<<(StreamType &Stream, |
315 const GlobalDeclaration &Addr) { | 323 const GlobalDeclaration &Addr) { |
316 Addr.dump(Stream); | 324 Addr.dump(Stream); |
317 return Stream; | 325 return Stream; |
318 } | 326 } |
319 | 327 |
320 } // end of namespace Ice | 328 } // end of namespace Ice |
321 | 329 |
322 #endif // SUBZERO_SRC_ICEGLOBALINITS_H | 330 #endif // SUBZERO_SRC_ICEGLOBALINITS_H |
OLD | NEW |