diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2015-01-20 10:58:38 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2015-01-20 10:58:38 +0000 |
| commit | e7427f2f86cfbc56ef434ae5ff5d7361c0d8cd71 (patch) | |
| tree | 14a7ca88442552cab44b3bae1509567e652a055c | |
| parent | 22c9d67e34eaac4c5232aa1fe8e8d30a508c8934 (diff) | |
| download | bcm5719-llvm-e7427f2f86cfbc56ef434ae5ff5d7361c0d8cd71.tar.gz bcm5719-llvm-e7427f2f86cfbc56ef434ae5ff5d7361c0d8cd71.zip | |
[PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
be used as results in the new pass manager.
llvm-svn: 226559
| -rw-r--r-- | llvm/include/llvm/Analysis/LoopInfo.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h index 18e572a1904..0b78983380f 100644 --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -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 |

