[llvm] r226559 - [PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
Chandler Carruth
chandlerc at gmail.com
Tue Jan 20 02:58:38 PST 2015
Author: chandlerc
Date: Tue Jan 20 04:58:38 2015
New Revision: 226559
URL: http://llvm.org/viewvc/llvm-project?rev=226559&view=rev
Log:
[PM] Make the LoopInfoBase and LoopInfo objects movable so that they can
be used as results in the new pass manager.
Modified:
llvm/trunk/include/llvm/Analysis/LoopInfo.h
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=226559&r1=226558&r2=226559&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Tue Jan 20 04:58:38 2015
@@ -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<Bas
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
More information about the llvm-commits
mailing list