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

Side by Side Diff: src/IceLiveness.cpp

Issue 1202253002: Includes module header first. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changes All Subzero includes to match LLVM style guide. Created 5 years, 6 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/IceLiveness.cpp - Liveness analysis implementation -----===// 1 //===- subzero/src/IceLiveness.cpp - Liveness analysis 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 provides some of the support for the Liveness class. In 10 // This file provides some of the support for the Liveness class. In
11 // particular, it handles the sparsity representation of the mapping 11 // particular, it handles the sparsity representation of the mapping
12 // between Variables and CfgNodes. The idea is that since most 12 // between Variables and CfgNodes. The idea is that since most
13 // variables are used only within a single basic block, we can 13 // variables are used only within a single basic block, we can
14 // partition the variables into "local" and "global" sets. Instead of 14 // partition the variables into "local" and "global" sets. Instead of
15 // sizing and indexing vectors according to Variable::Number, we 15 // sizing and indexing vectors according to Variable::Number, we
16 // create a mapping such that global variables are mapped to low 16 // create a mapping such that global variables are mapped to low
17 // indexes that are common across nodes, and local variables are 17 // indexes that are common across nodes, and local variables are
18 // mapped to a higher index space that is shared across nodes. 18 // mapped to a higher index space that is shared across nodes.
19 // 19 //
20 //===----------------------------------------------------------------------===// 20 //===----------------------------------------------------------------------===//
21 21
22 #include "IceLiveness.h"
23
22 #include "IceCfg.h" 24 #include "IceCfg.h"
23 #include "IceCfgNode.h" 25 #include "IceCfgNode.h"
24 #include "IceDefs.h" 26 #include "IceDefs.h"
25 #include "IceInst.h" 27 #include "IceInst.h"
26 #include "IceLiveness.h"
27 #include "IceOperand.h" 28 #include "IceOperand.h"
28 29
29 namespace Ice { 30 namespace Ice {
30 31
31 void Liveness::init() { 32 void Liveness::init() {
32 // Initialize most of the container sizes. 33 // Initialize most of the container sizes.
33 SizeT NumVars = Func->getVariables().size(); 34 SizeT NumVars = Func->getVariables().size();
34 SizeT NumNodes = Func->getNumNodes(); 35 SizeT NumNodes = Func->getNumNodes();
35 VariablesMetadata *VMetadata = Func->getVMetadata(); 36 VariablesMetadata *VMetadata = Func->getVMetadata();
36 Nodes.resize(NumNodes); 37 Nodes.resize(NumNodes);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 90 }
90 91
91 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { 92 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const {
92 if (LiveIndex < NumGlobals) 93 if (LiveIndex < NumGlobals)
93 return LiveToVarMap[LiveIndex]; 94 return LiveToVarMap[LiveIndex];
94 SizeT NodeIndex = Node->getIndex(); 95 SizeT NodeIndex = Node->getIndex();
95 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; 96 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals];
96 } 97 }
97 98
98 } // end of namespace Ice 99 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698