llvm.org GIT mirror llvm / 5618490
Eliminate MarkVirtRegAliveInBlock recursion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36943 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 13 years ago
2 changed file(s) with 20 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
282282 VarInfo &getVarInfo(unsigned RegIdx);
283283
284284 void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB);
285 void MarkVirtRegAliveInBlock(VarInfo &VRInfo, MachineBasicBlock *BB,
286 std::vector &WorkList);
285287 void HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
286288 MachineInstr *MI);
287289 };
111111 }
112112
113113 void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
114 MachineBasicBlock *MBB) {
114 MachineBasicBlock *MBB,
115 std::vector &WorkList) {
115116 unsigned BBNum = MBB->getNumber();
116117
117118 // Check to see if this basic block is one of the killing blocks. If so,
130131 // Mark the variable known alive in this bb
131132 VRInfo.AliveBlocks[BBNum] = true;
132133
133 for (MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(),
134 E = MBB->pred_end(); PI != E; ++PI)
135 MarkVirtRegAliveInBlock(VRInfo, *PI);
136 }
134 for (MachineBasicBlock::const_pred_reverse_iterator PI = MBB->pred_rbegin(),
135 E = MBB->pred_rend(); PI != E; ++PI)
136 WorkList.push_back(*PI);
137 }
138
139 void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
140 MachineBasicBlock *MBB) {
141 std::vector WorkList;
142 MarkVirtRegAliveInBlock(VRInfo, MBB, WorkList);
143 while (!WorkList.empty()) {
144 MachineBasicBlock *Pred = WorkList.back();
145 WorkList.pop_back();
146 MarkVirtRegAliveInBlock(VRInfo, Pred, WorkList);
147 }
148 }
149
137150
138151 void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB,
139152 MachineInstr *MI) {