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

Side by Side Diff: src/IceCfg.cpp

Issue 650613003: Subzero: Speed up VariablesMetadata initialization. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Split Definitions[] into first plus the rest Created 6 years, 2 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 | « no previous file | src/IceOperand.h » ('j') | src/IceRegAlloc.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===//
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 implements the Cfg class, including constant pool 10 // This file implements the Cfg class, including constant pool
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (Node->getHasReturn()) 161 if (Node->getHasReturn())
162 getTarget()->addEpilog(Node); 162 getTarget()->addEpilog(Node);
163 } 163 }
164 164
165 // This is a lightweight version of live-range-end calculation. Marks 165 // This is a lightweight version of live-range-end calculation. Marks
166 // the last use of only those variables whose definition and uses are 166 // the last use of only those variables whose definition and uses are
167 // completely with a single block. It is a quick single pass and 167 // completely with a single block. It is a quick single pass and
168 // doesn't need to iterate until convergence. 168 // doesn't need to iterate until convergence.
169 void Cfg::livenessLightweight() { 169 void Cfg::livenessLightweight() {
170 TimerMarker T(TimerStack::TT_livenessLightweight, this); 170 TimerMarker T(TimerStack::TT_livenessLightweight, this);
171 getVMetadata()->init(); 171 getVMetadata()->init(VMK_Uses);
172 for (CfgNode *Node : Nodes) 172 for (CfgNode *Node : Nodes)
173 Node->livenessLightweight(); 173 Node->livenessLightweight();
174 } 174 }
175 175
176 void Cfg::liveness(LivenessMode Mode) { 176 void Cfg::liveness(LivenessMode Mode) {
177 TimerMarker T(TimerStack::TT_liveness, this); 177 TimerMarker T(TimerStack::TT_liveness, this);
178 Live.reset(new Liveness(this, Mode)); 178 Live.reset(new Liveness(this, Mode));
179 getVMetadata()->init(); 179 getVMetadata()->init(VMK_Uses);
180 Live->init(); 180 Live->init();
181 // Initialize with all nodes needing to be processed. 181 // Initialize with all nodes needing to be processed.
182 llvm::BitVector NeedToProcess(Nodes.size(), true); 182 llvm::BitVector NeedToProcess(Nodes.size(), true);
183 while (NeedToProcess.any()) { 183 while (NeedToProcess.any()) {
184 // Iterate in reverse topological order to speed up convergence. 184 // Iterate in reverse topological order to speed up convergence.
185 // TODO(stichnot): Use llvm::make_range with LLVM 3.5. 185 // TODO(stichnot): Use llvm::make_range with LLVM 3.5.
186 for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) { 186 for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) {
187 CfgNode *Node = *I; 187 CfgNode *Node = *I;
188 if (NeedToProcess[Node->getIndex()]) { 188 if (NeedToProcess[Node->getIndex()]) {
189 NeedToProcess[Node->getIndex()] = false; 189 NeedToProcess[Node->getIndex()] = false;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 377 }
378 } 378 }
379 // Print each basic block 379 // Print each basic block
380 for (CfgNode *Node : Nodes) 380 for (CfgNode *Node : Nodes)
381 Node->dump(this); 381 Node->dump(this);
382 if (getContext()->isVerbose(IceV_Instructions)) 382 if (getContext()->isVerbose(IceV_Instructions))
383 Str << "}\n"; 383 Str << "}\n";
384 } 384 }
385 385
386 } // end of namespace Ice 386 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceOperand.h » ('j') | src/IceRegAlloc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698