forked from OSchip/llvm-project
Add Operation::moveAfter
This revision introduces an Operation::moveAfter mirroring Operation::moveBefore to move an operation after another existing operation or an iterator in a specified block. Resolves https://bugs.llvm.org/show_bug.cgi?id=45799 Differential Revision: https://reviews.llvm.org/D79640
This commit is contained in:
parent
db7dea2b6f
commit
2280cb880d
|
@ -185,6 +185,15 @@ public:
|
||||||
/// `iterator` in the specified block.
|
/// `iterator` in the specified block.
|
||||||
void moveBefore(Block *block, llvm::iplist<Operation>::iterator iterator);
|
void moveBefore(Block *block, llvm::iplist<Operation>::iterator iterator);
|
||||||
|
|
||||||
|
/// Unlink this operation from its current block and insert it right after
|
||||||
|
/// `existingOp` which may be in the same or another block in the same
|
||||||
|
/// function.
|
||||||
|
void moveAfter(Operation *existingOp);
|
||||||
|
|
||||||
|
/// Unlink this operation from its current block and insert it right after
|
||||||
|
/// `iterator` in the specified block.
|
||||||
|
void moveAfter(Block *block, llvm::iplist<Operation>::iterator iterator);
|
||||||
|
|
||||||
/// Given an operation 'other' that is within the same parent block, return
|
/// Given an operation 'other' that is within the same parent block, return
|
||||||
/// whether the current operation is before 'other' in the operation list
|
/// whether the current operation is before 'other' in the operation list
|
||||||
/// of the parent block.
|
/// of the parent block.
|
||||||
|
|
|
@ -492,6 +492,20 @@ void Operation::moveBefore(Block *block,
|
||||||
getIterator());
|
getIterator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Unlink this operation from its current block and insert it right after
|
||||||
|
/// `existingOp` which may be in the same or another block in the same function.
|
||||||
|
void Operation::moveAfter(Operation *existingOp) {
|
||||||
|
moveAfter(existingOp->getBlock(), existingOp->getIterator());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlink this operation from its current block and insert it right after
|
||||||
|
/// `iterator` in the specified block.
|
||||||
|
void Operation::moveAfter(Block *block,
|
||||||
|
llvm::iplist<Operation>::iterator iterator) {
|
||||||
|
assert(iterator != block->end() && "cannot move after end of block");
|
||||||
|
moveBefore(&*std::next(iterator));
|
||||||
|
}
|
||||||
|
|
||||||
/// This drops all operand uses from this operation, which is an essential
|
/// This drops all operand uses from this operation, which is an essential
|
||||||
/// step in breaking cyclic dependences between references when they are to
|
/// step in breaking cyclic dependences between references when they are to
|
||||||
/// be deleted.
|
/// be deleted.
|
||||||
|
|
Loading…
Reference in New Issue