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

Side by Side Diff: src/IceGlobalContext.h

Issue 830303003: Subzero: Clean up a few areas. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Rewrite another loop using reverse_range() Created 5 years, 11 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/IceDefs.h ('k') | src/IceGlobalContext.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/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 15 matching lines...) Expand all
26 #include "IceTypes.h" 26 #include "IceTypes.h"
27 27
28 namespace Ice { 28 namespace Ice {
29 29
30 class ClFlags; 30 class ClFlags;
31 class FuncSigType; 31 class FuncSigType;
32 32
33 // This class collects rudimentary statistics during translation. 33 // This class collects rudimentary statistics during translation.
34 class CodeStats { 34 class CodeStats {
35 CodeStats(const CodeStats &) = delete; 35 CodeStats(const CodeStats &) = delete;
36 // CodeStats &operator=(const CodeStats &) = delete; 36 CodeStats &operator=(const CodeStats &) = default;
37 37
38 public: 38 public:
39 CodeStats() 39 CodeStats()
40 : InstructionsEmitted(0), RegistersSaved(0), FrameBytes(0), Spills(0), 40 : InstructionsEmitted(0), RegistersSaved(0), FrameBytes(0), Spills(0),
41 Fills(0) {} 41 Fills(0) {}
42 void reset() { *this = CodeStats(); } 42 void reset() { *this = CodeStats(); }
43 void updateEmitted(uint32_t InstCount) { InstructionsEmitted += InstCount; } 43 void updateEmitted(uint32_t InstCount) { InstructionsEmitted += InstCount; }
44 void updateRegistersSaved(uint32_t Num) { RegistersSaved += Num; } 44 void updateRegistersSaved(uint32_t Num) { RegistersSaved += Num; }
45 void updateFrameBytes(uint32_t Bytes) { FrameBytes += Bytes; } 45 void updateFrameBytes(uint32_t Bytes) { FrameBytes += Bytes; }
46 void updateSpills() { ++Spills; } 46 void updateSpills() { ++Spills; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 TargetArch getTargetArch() const { return Arch; } 83 TargetArch getTargetArch() const { return Arch; }
84 OptLevel getOptLevel() const { return Opt; } 84 OptLevel getOptLevel() const { return Opt; }
85 85
86 // When emitting assembly, we allow a string to be prepended to 86 // When emitting assembly, we allow a string to be prepended to
87 // names of translated functions. This makes it easier to create an 87 // names of translated functions. This makes it easier to create an
88 // execution test against a reference translator like llc, with both 88 // execution test against a reference translator like llc, with both
89 // translators using the same bitcode as input. 89 // translators using the same bitcode as input.
90 IceString getTestPrefix() const { return TestPrefix; } 90 IceString getTestPrefix() const { return TestPrefix; }
91 IceString mangleName(const IceString &Name) const; 91 IceString mangleName(const IceString &Name) const;
92 92
93 // The purpose of HasEmitted is to add a header comment at the
94 // beginning of assembly code emission, doing it once per file
95 // rather than once per function.
96 bool testAndSetHasEmittedFirstMethod() {
97 bool HasEmitted = HasEmittedFirstMethod;
98 HasEmittedFirstMethod = true;
99 return HasEmitted;
100 }
101
102 // Manage Constants. 93 // Manage Constants.
103 // getConstant*() functions are not const because they might add 94 // getConstant*() functions are not const because they might add
104 // something to the constant pool. 95 // something to the constant pool.
105 Constant *getConstantInt(Type Ty, int64_t Value); 96 Constant *getConstantInt(Type Ty, int64_t Value);
106 Constant *getConstantInt1(int8_t ConstantInt1); 97 Constant *getConstantInt1(int8_t ConstantInt1);
107 Constant *getConstantInt8(int8_t ConstantInt8); 98 Constant *getConstantInt8(int8_t ConstantInt8);
108 Constant *getConstantInt16(int16_t ConstantInt16); 99 Constant *getConstantInt16(int16_t ConstantInt16);
109 Constant *getConstantInt32(int32_t ConstantInt32); 100 Constant *getConstantInt32(int32_t ConstantInt32);
110 Constant *getConstantInt64(int64_t ConstantInt64); 101 Constant *getConstantInt64(int64_t ConstantInt64);
111 Constant *getConstantFloat(float Value); 102 Constant *getConstantFloat(float Value);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 Ostream *StrEmit; // Stream for code emission 198 Ostream *StrEmit; // Stream for code emission
208 199
209 ArenaAllocator Allocator; 200 ArenaAllocator Allocator;
210 VerboseMask VMask; 201 VerboseMask VMask;
211 std::unique_ptr<class ConstantPool> ConstPool; 202 std::unique_ptr<class ConstantPool> ConstPool;
212 Intrinsics IntrinsicsInfo; 203 Intrinsics IntrinsicsInfo;
213 const TargetArch Arch; 204 const TargetArch Arch;
214 const OptLevel Opt; 205 const OptLevel Opt;
215 const IceString TestPrefix; 206 const IceString TestPrefix;
216 const ClFlags &Flags; 207 const ClFlags &Flags;
217 bool HasEmittedFirstMethod;
218 RandomNumberGenerator RNG; 208 RandomNumberGenerator RNG;
219 std::unique_ptr<ELFObjectWriter> ObjectWriter; 209 std::unique_ptr<ELFObjectWriter> ObjectWriter;
220 CodeStats StatsFunction; 210 CodeStats StatsFunction;
221 CodeStats StatsCumulative; 211 CodeStats StatsCumulative;
222 std::vector<TimerStack> Timers; 212 std::vector<TimerStack> Timers;
223 std::vector<GlobalDeclaration *> GlobalDeclarations; 213 std::vector<GlobalDeclaration *> GlobalDeclarations;
224 214
225 // Private helpers for mangleName() 215 // Private helpers for mangleName()
226 typedef llvm::SmallVector<char, 32> ManglerVector; 216 typedef llvm::SmallVector<char, 32> ManglerVector;
227 void incrementSubstitutions(ManglerVector &OldName) const; 217 void incrementSubstitutions(ManglerVector &OldName) const;
(...skipping 24 matching lines...) Expand all
252 242
253 private: 243 private:
254 TimerIdT ID; 244 TimerIdT ID;
255 GlobalContext *const Ctx; 245 GlobalContext *const Ctx;
256 bool Active; 246 bool Active;
257 }; 247 };
258 248
259 } // end of namespace Ice 249 } // end of namespace Ice
260 250
261 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H 251 #endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
OLDNEW
« no previous file with comments | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698