mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-29 13:32:33 +00:00
[PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
be used as results in the new pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
934e884ae7
commit
1540633fdb
@ -502,6 +502,24 @@ public:
|
||||
LoopInfoBase() { }
|
||||
~LoopInfoBase() { releaseMemory(); }
|
||||
|
||||
LoopInfoBase(LoopInfoBase &&Arg)
|
||||
: BBMap(std::move(Arg.BBMap)),
|
||||
TopLevelLoops(std::move(Arg.TopLevelLoops)) {
|
||||
// We have to clear the arguments top level loops as we've taken ownership.
|
||||
Arg.TopLevelLoops.clear();
|
||||
}
|
||||
LoopInfoBase &operator=(LoopInfoBase &&RHS) {
|
||||
if (&RHS != this) {
|
||||
BBMap = std::move(RHS.BBMap);
|
||||
|
||||
for (auto *L : TopLevelLoops)
|
||||
delete L;
|
||||
TopLevelLoops = std::move(RHS.TopLevelLoops);
|
||||
RHS.TopLevelLoops.clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void releaseMemory() {
|
||||
BBMap.clear();
|
||||
|
||||
@ -635,6 +653,12 @@ class LoopInfo : public LoopInfoBase<BasicBlock, Loop> {
|
||||
public:
|
||||
LoopInfo() {}
|
||||
|
||||
LoopInfo(LoopInfo &&Arg) : BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
||||
LoopInfo &operator=(LoopInfo &&RHS) {
|
||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Most of the public interface is provided via LoopInfoBase.
|
||||
|
||||
/// updateUnloop - Update LoopInfo after removing the last backedge from a
|
||||
|
Loading…
x
Reference in New Issue
Block a user