Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/IceGlobalInits.h

Issue 1341423002: Reflow comments to use the full width. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix spelling and rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceGlobalInits.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// \file 10 /// \file
11 /// This file declares the representation of function declarations, 11 /// This file declares the representation of function declarations, global
12 /// global variable declarations, and the corresponding variable 12 /// variable declarations, and the corresponding variable initializers in
13 /// initializers in Subzero. Global variable initializers are 13 /// Subzero. Global variable initializers are represented as a sequence of
14 /// represented as a sequence of simple initializers. 14 /// simple initializers.
15 /// 15 ///
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 #ifndef SUBZERO_SRC_ICEGLOBALINITS_H 18 #ifndef SUBZERO_SRC_ICEGLOBALINITS_H
19 #define SUBZERO_SRC_ICEGLOBALINITS_H 19 #define SUBZERO_SRC_ICEGLOBALINITS_H
20 20
21 #include "IceDefs.h" 21 #include "IceDefs.h"
22 #include "IceGlobalContext.h" 22 #include "IceGlobalContext.h"
23 #include "IceTypes.h" 23 #include "IceTypes.h"
24 24
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void dump(Ostream &Stream) const { 74 void dump(Ostream &Stream) const {
75 if (!BuildDefs::dump()) 75 if (!BuildDefs::dump())
76 return; 76 return;
77 GlobalContext *const Ctx = nullptr; 77 GlobalContext *const Ctx = nullptr;
78 dump(Ctx, Stream); 78 dump(Ctx, Stream);
79 } 79 }
80 80
81 /// Returns true if when emitting names, we should suppress mangling. 81 /// Returns true if when emitting names, we should suppress mangling.
82 virtual bool getSuppressMangling() const = 0; 82 virtual bool getSuppressMangling() const = 0;
83 83
84 /// Mangles name for cross tests, unless external and not defined locally 84 /// Mangles name for cross tests, unless external and not defined locally (so
85 /// (so that relocations accross pnacl-sz and pnacl-llc will work). 85 /// that relocations across pnacl-sz and pnacl-llc will work).
86 virtual IceString mangleName(GlobalContext *Ctx) const { 86 virtual IceString mangleName(GlobalContext *Ctx) const {
87 return getSuppressMangling() ? Name : Ctx->mangleName(Name); 87 return getSuppressMangling() ? Name : Ctx->mangleName(Name);
88 } 88 }
89 89
90 protected: 90 protected:
91 GlobalDeclaration(GlobalDeclarationKind Kind, 91 GlobalDeclaration(GlobalDeclarationKind Kind,
92 llvm::GlobalValue::LinkageTypes Linkage) 92 llvm::GlobalValue::LinkageTypes Linkage)
93 : Kind(Kind), Linkage(Linkage) {} 93 : Kind(Kind), Linkage(Linkage) {}
94 94
95 const GlobalDeclarationKind Kind; 95 const GlobalDeclarationKind Kind;
96 IceString Name; 96 IceString Name;
97 llvm::GlobalValue::LinkageTypes Linkage; 97 llvm::GlobalValue::LinkageTypes Linkage;
98 }; 98 };
99 99
100 /// Models a function declaration. This includes the type signature of 100 /// Models a function declaration. This includes the type signature of the
101 /// the function, its calling conventions, and its linkage. 101 /// function, its calling conventions, and its linkage.
102 class FunctionDeclaration : public GlobalDeclaration { 102 class FunctionDeclaration : public GlobalDeclaration {
103 FunctionDeclaration() = delete; 103 FunctionDeclaration() = delete;
104 FunctionDeclaration(const FunctionDeclaration &) = delete; 104 FunctionDeclaration(const FunctionDeclaration &) = delete;
105 FunctionDeclaration &operator=(const FunctionDeclaration &) = delete; 105 FunctionDeclaration &operator=(const FunctionDeclaration &) = delete;
106 106
107 public: 107 public:
108 static FunctionDeclaration *create(GlobalContext *Context, 108 static FunctionDeclaration *create(GlobalContext *Context,
109 const FuncSigType &Signature, 109 const FuncSigType &Signature,
110 llvm::CallingConv::ID CallingConv, 110 llvm::CallingConv::ID CallingConv,
111 llvm::GlobalValue::LinkageTypes Linkage, 111 llvm::GlobalValue::LinkageTypes Linkage,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 bool getIsConstant() const { return IsConstant; } 279 bool getIsConstant() const { return IsConstant; }
280 void setIsConstant(bool NewValue) { IsConstant = NewValue; } 280 void setIsConstant(bool NewValue) { IsConstant = NewValue; }
281 uint32_t getAlignment() const { return Alignment; } 281 uint32_t getAlignment() const { return Alignment; }
282 void setAlignment(uint32_t NewAlignment) { Alignment = NewAlignment; } 282 void setAlignment(uint32_t NewAlignment) { Alignment = NewAlignment; }
283 bool hasInitializer() const { return HasInitializer; } 283 bool hasInitializer() const { return HasInitializer; }
284 bool hasNonzeroInitializer() const { 284 bool hasNonzeroInitializer() const {
285 return !(Initializers->size() == 1 && 285 return !(Initializers->size() == 1 &&
286 llvm::isa<ZeroInitializer>((*Initializers)[0].get())); 286 llvm::isa<ZeroInitializer>((*Initializers)[0].get()));
287 } 287 }
288 288
289 /// Returns the number of bytes for the initializer of the global 289 /// Returns the number of bytes for the initializer of the global address.
290 /// address.
291 SizeT getNumBytes() const { 290 SizeT getNumBytes() const {
292 SizeT Count = 0; 291 SizeT Count = 0;
293 for (const std::unique_ptr<Initializer> &Init : *Initializers) { 292 for (const std::unique_ptr<Initializer> &Init : *Initializers) {
294 Count += Init->getNumBytes(); 293 Count += Init->getNumBytes();
295 } 294 }
296 return Count; 295 return Count;
297 } 296 }
298 297
299 /// Adds Initializer to the list of initializers. Takes ownership of 298 /// Adds Initializer to the list of initializers. Takes ownership of the
300 /// the initializer. 299 /// initializer.
301 void addInitializer(std::unique_ptr<Initializer> Initializer) { 300 void addInitializer(std::unique_ptr<Initializer> Initializer) {
302 Initializers->emplace_back(std::move(Initializer)); 301 Initializers->emplace_back(std::move(Initializer));
303 HasInitializer = true; 302 HasInitializer = true;
304 } 303 }
305 304
306 /// Prints out type for initializer associated with the declaration 305 /// Prints out type for initializer associated with the declaration to Stream.
307 /// to Stream.
308 void dumpType(Ostream &Stream) const final; 306 void dumpType(Ostream &Stream) const final;
309 307
310 /// Prints out the definition of the global variable declaration 308 /// Prints out the definition of the global variable declaration (including
311 /// (including initialization). 309 /// initialization).
312 void dump(GlobalContext *Ctx, Ostream &Stream) const final; 310 void dump(GlobalContext *Ctx, Ostream &Stream) const final;
313 311
314 static bool classof(const GlobalDeclaration *Addr) { 312 static bool classof(const GlobalDeclaration *Addr) {
315 return Addr->getKind() == VariableDeclarationKind; 313 return Addr->getKind() == VariableDeclarationKind;
316 } 314 }
317 315
318 bool getSuppressMangling() const final { 316 bool getSuppressMangling() const final {
319 if (ForceSuppressMangling) 317 if (ForceSuppressMangling)
320 return true; 318 return true;
321 return isExternal() && !hasInitializer(); 319 return isExternal() && !hasInitializer();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 template <class StreamType> 351 template <class StreamType>
354 inline StreamType &operator<<(StreamType &Stream, 352 inline StreamType &operator<<(StreamType &Stream,
355 const GlobalDeclaration &Addr) { 353 const GlobalDeclaration &Addr) {
356 Addr.dump(Stream); 354 Addr.dump(Stream);
357 return Stream; 355 return Stream;
358 } 356 }
359 357
360 } // end of namespace Ice 358 } // end of namespace Ice
361 359
362 #endif // SUBZERO_SRC_ICEGLOBALINITS_H 360 #endif // SUBZERO_SRC_ICEGLOBALINITS_H
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceGlobalInits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698