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

Side by Side Diff: src/IceTimerTree.cpp

Issue 1221643012: Subzero: Add -Wshadow to the build. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 5 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
OLDNEW
1 //===- subzero/src/IceTimerTree.cpp - Pass timer defs ---------------------===// 1 //===- subzero/src/IceTimerTree.cpp - Pass timer 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 /// \file 10 /// \file
11 /// This file defines the TimerTree class, which tracks flat and 11 /// This file defines the TimerTree class, which tracks flat and
12 /// cumulative execution time collection of call chains. 12 /// cumulative execution time collection of call chains.
13 /// 13 ///
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #include "IceTimerTree.h" 16 #include "IceTimerTree.h"
17 17
18 #include "IceDefs.h" 18 #include "IceDefs.h"
19 19
20 #pragma clang diagnostic push 20 #pragma clang diagnostic push
21 #pragma clang diagnostic ignored "-Wunused-parameter" 21 #pragma clang diagnostic ignored "-Wunused-parameter"
22 #pragma clang diagnostic ignored "-Wshadow"
22 #include "llvm/Support/Timer.h" 23 #include "llvm/Support/Timer.h"
23 #pragma clang diagnostic pop 24 #pragma clang diagnostic pop
24 25
25 namespace Ice { 26 namespace Ice {
26 27
27 TimerStack::TimerStack(const IceString &Name) 28 TimerStack::TimerStack(const IceString &MyName)
28 : Name(Name), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp) { 29 : Name(MyName), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp) {
29 if (!BuildDefs::dump()) 30 if (!BuildDefs::dump())
30 return; 31 return;
31 Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel). 32 Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel).
32 IDs.resize(TT__num); 33 IDs.resize(TT__num);
33 LeafTimes.resize(TT__num); 34 LeafTimes.resize(TT__num);
34 LeafCounts.resize(TT__num); 35 LeafCounts.resize(TT__num);
35 #define STR(s) #s 36 #define STR(s) #s
36 #define X(tag) \ 37 #define X(tag) \
37 IDs[TT_##tag] = STR(tag); \ 38 IDs[TT_##tag] = STR(tag); \
38 IDsIndex[STR(tag)] = TT_##tag; 39 IDsIndex[STR(tag)] = TT_##tag;
39 TIMERTREE_TABLE; 40 TIMERTREE_TABLE;
40 #undef X 41 #undef X
41 #undef STR 42 #undef STR
42 } 43 }
43 44
44 // Returns the unique timer ID for the given Name, creating a new ID 45 // Returns the unique timer ID for the given Name, creating a new ID
45 // if needed. 46 // if needed.
46 TimerIdT TimerStack::getTimerID(const IceString &Name) { 47 TimerIdT TimerStack::getTimerID(const IceString &MyName) {
47 if (!BuildDefs::dump()) 48 if (!BuildDefs::dump())
48 return 0; 49 return 0;
49 if (IDsIndex.find(Name) == IDsIndex.end()) { 50 if (IDsIndex.find(MyName) == IDsIndex.end()) {
50 IDsIndex[Name] = IDs.size(); 51 IDsIndex[MyName] = IDs.size();
51 IDs.push_back(Name); 52 IDs.push_back(MyName);
52 LeafTimes.push_back(decltype(LeafTimes)::value_type()); 53 LeafTimes.push_back(decltype(LeafTimes)::value_type());
53 LeafCounts.push_back(decltype(LeafCounts)::value_type()); 54 LeafCounts.push_back(decltype(LeafCounts)::value_type());
54 } 55 }
55 return IDsIndex[Name]; 56 return IDsIndex[MyName];
56 } 57 }
57 58
58 // Creates a mapping from TimerIdT (leaf) values in the Src timer 59 // Creates a mapping from TimerIdT (leaf) values in the Src timer
59 // stack into TimerIdT values in this timer stack. Creates new 60 // stack into TimerIdT values in this timer stack. Creates new
60 // entries in this timer stack as needed. 61 // entries in this timer stack as needed.
61 TimerStack::TranslationType 62 TimerStack::TranslationType
62 TimerStack::translateIDsFrom(const TimerStack &Src) { 63 TimerStack::translateIDsFrom(const TimerStack &Src) {
63 size_t Size = Src.IDs.size(); 64 size_t Size = Src.IDs.size();
64 TranslationType Mapping(Size); 65 TranslationType Mapping(Size);
65 for (TimerIdT i = 0; i < Size; ++i) { 66 for (TimerIdT i = 0; i < Size; ++i) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 dumpHelper(Str, FlatMap, TotalTime); 304 dumpHelper(Str, FlatMap, TotalTime);
304 Str << "Number of timer updates: " << StateChangeCount << "\n"; 305 Str << "Number of timer updates: " << StateChangeCount << "\n";
305 } 306 }
306 307
307 double TimerStack::timestamp() { 308 double TimerStack::timestamp() {
308 // TODO: Implement in terms of std::chrono for C++11. 309 // TODO: Implement in terms of std::chrono for C++11.
309 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); 310 return llvm::TimeRecord::getCurrentTime(false).getWallTime();
310 } 311 }
311 312
312 } // end of namespace Ice 313 } // end of namespace Ice
OLDNEW
« src/IceInst.h ('K') | « src/IceThreading.h ('k') | src/IceTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698