mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
implement SSAUpdater::RewriteUseAfterInsertions, a helpful form of RewriteUse.
llvm-svn: 112409
This commit is contained in:
parent
24927beaff
commit
fac07b1dca
@ -94,6 +94,12 @@ public:
|
||||
/// for the use's block will be considered to be below it.
|
||||
void RewriteUse(Use &U);
|
||||
|
||||
/// RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However,
|
||||
/// this version of the method can rewrite uses in the same block as a
|
||||
/// definition, because it assumes that all uses of a value are below any
|
||||
/// inserted values.
|
||||
void RewriteUseAfterInsertions(Use &U);
|
||||
|
||||
private:
|
||||
Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
|
||||
|
||||
|
@ -205,6 +205,22 @@ void SSAUpdater::RewriteUse(Use &U) {
|
||||
U.set(V);
|
||||
}
|
||||
|
||||
/// RewriteUseAfterInsertions - Rewrite a use, just like RewriteUse. However,
|
||||
/// this version of the method can rewrite uses in the same block as a
|
||||
/// definition, because it assumes that all uses of a value are below any
|
||||
/// inserted values.
|
||||
void SSAUpdater::RewriteUseAfterInsertions(Use &U) {
|
||||
Instruction *User = cast<Instruction>(U.getUser());
|
||||
|
||||
Value *V;
|
||||
if (PHINode *UserPN = dyn_cast<PHINode>(User))
|
||||
V = GetValueAtEndOfBlock(UserPN->getIncomingBlock(U));
|
||||
else
|
||||
V = GetValueAtEndOfBlock(User->getParent());
|
||||
|
||||
U.set(V);
|
||||
}
|
||||
|
||||
/// PHIiter - Iterator for PHI operands. This is used for the PHI_iterator
|
||||
/// in the SSAUpdaterImpl template.
|
||||
namespace {
|
||||
|
Loading…
Reference in New Issue
Block a user