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

Side by Side Diff: src/IceGlobalContext.cpp

Issue 795063003: Subzero: Add memory usage to "-szstats" output. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years 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.h ('k') | no next file » | 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.cpp - Global context defs -------------===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
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 defines aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
11 // multiple functions. 11 // multiple functions.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include <ctype.h> // isdigit(), isupper() 15 #include <ctype.h> // isdigit(), isupper()
16 #include <locale> // locale 16 #include <locale> // locale
17 #include <unordered_map> 17 #include <unordered_map>
18 18
19 #include "llvm/Support/Timer.h"
20
19 #include "IceCfg.h" 21 #include "IceCfg.h"
20 #include "IceClFlags.h" 22 #include "IceClFlags.h"
21 #include "IceDefs.h" 23 #include "IceDefs.h"
22 #include "IceGlobalContext.h" 24 #include "IceGlobalContext.h"
23 #include "IceGlobalInits.h" 25 #include "IceGlobalInits.h"
24 #include "IceOperand.h" 26 #include "IceOperand.h"
25 #include "IceTargetLowering.h" 27 #include "IceTargetLowering.h"
26 #include "IceTimerTree.h" 28 #include "IceTimerTree.h"
27 #include "IceTypes.h" 29 #include "IceTypes.h"
28 30
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 TypePool<IceType_f64, double, ConstantDouble> Doubles; 100 TypePool<IceType_f64, double, ConstantDouble> Doubles;
99 TypePool<IceType_i1, int8_t, ConstantInteger32> Integers1; 101 TypePool<IceType_i1, int8_t, ConstantInteger32> Integers1;
100 TypePool<IceType_i8, int8_t, ConstantInteger32> Integers8; 102 TypePool<IceType_i8, int8_t, ConstantInteger32> Integers8;
101 TypePool<IceType_i16, int16_t, ConstantInteger32> Integers16; 103 TypePool<IceType_i16, int16_t, ConstantInteger32> Integers16;
102 TypePool<IceType_i32, int32_t, ConstantInteger32> Integers32; 104 TypePool<IceType_i32, int32_t, ConstantInteger32> Integers32;
103 TypePool<IceType_i64, int64_t, ConstantInteger64> Integers64; 105 TypePool<IceType_i64, int64_t, ConstantInteger64> Integers64;
104 TypePool<IceType_i32, RelocatableTuple, ConstantRelocatable> Relocatables; 106 TypePool<IceType_i32, RelocatableTuple, ConstantRelocatable> Relocatables;
105 UndefPool Undefs; 107 UndefPool Undefs;
106 }; 108 };
107 109
110 void CodeStats::dump(const IceString &Name, Ostream &Str) {
111 if (!ALLOW_DUMP)
112 return;
113 Str << "|" << Name << "|Inst Count |" << InstructionsEmitted << "\n";
114 Str << "|" << Name << "|Regs Saved |" << RegistersSaved << "\n";
115 Str << "|" << Name << "|Frame Bytes |" << FrameBytes << "\n";
116 Str << "|" << Name << "|Spills |" << Spills << "\n";
117 Str << "|" << Name << "|Fills |" << Fills << "\n";
118 Str << "|" << Name << "|Spills+Fills|" << Spills + Fills << "\n";
119 Str << "|" << Name << "|Memory Usage|";
120 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed())
121 Str << MemUsed;
122 else
123 Str << "(requires '-track-memory')";
124 Str << "\n";
125 }
126
108 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, 127 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
109 ELFStreamer *ELFStr, VerboseMask Mask, 128 ELFStreamer *ELFStr, VerboseMask Mask,
110 TargetArch Arch, OptLevel Opt, 129 TargetArch Arch, OptLevel Opt,
111 IceString TestPrefix, const ClFlags &Flags) 130 IceString TestPrefix, const ClFlags &Flags)
112 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), 131 : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask),
113 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), 132 ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt),
114 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false), 133 TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false),
115 RNG(""), ObjectWriter() { 134 RNG(""), ObjectWriter() {
116 // Pre-register built-in stack names. 135 // Pre-register built-in stack names.
117 if (ALLOW_DUMP) { 136 if (ALLOW_DUMP) {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func) 510 TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func)
492 : ID(ID), Ctx(Func->getContext()), Active(false) { 511 : ID(ID), Ctx(Func->getContext()), Active(false) {
493 if (ALLOW_DUMP) { 512 if (ALLOW_DUMP) {
494 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled; 513 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled;
495 if (Active) 514 if (Active)
496 Ctx->pushTimer(ID); 515 Ctx->pushTimer(ID);
497 } 516 }
498 } 517 }
499 518
500 } // end of namespace Ice 519 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698