llvm.org GIT mirror llvm / ffd9bee
implement SSAUpdater::RewriteUseAfterInsertions, a helpful form of RewriteUse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112409 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
2 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
9393 /// for the use's block will be considered to be below it.
9494 void RewriteUse(Use &U);
9595
96 /// RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However,
97 /// this version of the method can rewrite uses in the same block as a
98 /// definition, because it assumes that all uses of a value are below any
99 /// inserted values.
100 void RewriteUseAfterInsertions(Use &U);
101
96102 private:
97103 Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
98104
204204 U.set(V);
205205 }
206206
207 /// RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However,
208 /// this version of the method can rewrite uses in the same block as a
209 /// definition, because it assumes that all uses of a value are below any
210 /// inserted values.
211 void SSAUpdater::RewriteUseAfterInsertions(Use &U) {
212 Instruction *User = cast(U.getUser());
213
214 Value *V;
215 if (PHINode *UserPN = dyn_cast(User))
216 V = GetValueAtEndOfBlock(UserPN->getIncomingBlock(U));
217 else
218 V = GetValueAtEndOfBlock(User->getParent());
219
220 U.set(V);
221 }
222
207223 /// PHIiter - Iterator for PHI operands. This is used for the PHI_iterator
208224 /// in the SSAUpdaterImpl template.
209225 namespace {