OLD | NEW |
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 /// \file | 10 /// \file |
11 /// This file provides some of the support for the Liveness class. In | 11 /// \brief Provides some of the support for the Liveness class. |
12 /// particular, it handles the sparsity representation of the mapping between | 12 |
13 /// Variables and CfgNodes. The idea is that since most variables are used only | 13 /// In particular, it handles the sparsity representation of the mapping |
14 /// within a single basic block, we can partition the variables into "local" and | 14 /// between Variables and CfgNodes. The idea is that since most variables are |
15 /// "global" sets. Instead of sizing and indexing vectors according to | 15 /// used only within a single basic block, we can partition the variables into |
16 /// Variable::Number, we create a mapping such that global variables are mapped | 16 /// "local" and "global" sets. Instead of sizing and indexing vectors according |
17 /// to low indexes that are common across nodes, and local variables are mapped | 17 /// to Variable::Number, we create a mapping such that global variables are |
18 /// to a higher index space that is shared across nodes. | 18 /// mapped to low indexes that are common across nodes, and local variables are |
| 19 /// mapped to a higher index space that is shared across nodes. |
19 /// | 20 /// |
20 //===----------------------------------------------------------------------===// | 21 //===----------------------------------------------------------------------===// |
21 | 22 |
22 #include "IceLiveness.h" | 23 #include "IceLiveness.h" |
23 | 24 |
24 #include "IceCfg.h" | 25 #include "IceCfg.h" |
25 #include "IceCfgNode.h" | 26 #include "IceCfgNode.h" |
26 #include "IceDefs.h" | 27 #include "IceDefs.h" |
27 #include "IceInst.h" | 28 #include "IceInst.h" |
28 #include "IceOperand.h" | 29 #include "IceOperand.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 130 } |
130 | 131 |
131 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { | 132 Variable *Liveness::getVariable(SizeT LiveIndex, const CfgNode *Node) const { |
132 if (LiveIndex < NumGlobals) | 133 if (LiveIndex < NumGlobals) |
133 return LiveToVarMap[LiveIndex]; | 134 return LiveToVarMap[LiveIndex]; |
134 SizeT NodeIndex = Node->getIndex(); | 135 SizeT NodeIndex = Node->getIndex(); |
135 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; | 136 return Nodes[NodeIndex].LiveToVarMap[LiveIndex - NumGlobals]; |
136 } | 137 } |
137 | 138 |
138 } // end of namespace Ice | 139 } // end of namespace Ice |
OLD | NEW |