[llvm] r213464 - Sure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather than lvalue reference.
David Blaikie
dblaikie at gmail.com
Sat Jul 19 14:19:45 PDT 2014
Author: dblaikie
Date: Sat Jul 19 16:19:45 2014
New Revision: 213464
URL: http://llvm.org/viewvc/llvm-project?rev=213464&view=rev
Log:
Sure up ownership passing of the PBQPBuilder by passing unique_ptrs by value rather than lvalue reference.
Also removes an unnecessary '.release()' that should've been a std::move
anyway. (I'm on a hunt for '.release()' calls)
Modified:
llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h
llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
Modified: llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=213464&r1=213463&r2=213464&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h (original)
+++ llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h Sat Jul 19 16:19:45 2014
@@ -158,7 +158,7 @@ namespace llvm {
};
FunctionPass *
- createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder,
+ createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> builder,
char *customPassID = nullptr);
}
Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=213464&r1=213463&r2=213464&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Sat Jul 19 16:19:45 2014
@@ -88,8 +88,8 @@ public:
static char ID;
/// Construct a PBQP register allocator.
- RegAllocPBQP(std::unique_ptr<PBQPBuilder> &b, char *cPassID=nullptr)
- : MachineFunctionPass(ID), builder(b.release()), customPassID(cPassID) {
+ RegAllocPBQP(std::unique_ptr<PBQPBuilder> b, char *cPassID = nullptr)
+ : MachineFunctionPass(ID), builder(std::move(b)), customPassID(cPassID) {
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
@@ -614,18 +614,18 @@ bool RegAllocPBQP::runOnMachineFunction(
}
FunctionPass *
-llvm::createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder,
+llvm::createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> builder,
char *customPassID) {
- return new RegAllocPBQP(builder, customPassID);
+ return new RegAllocPBQP(std::move(builder), customPassID);
}
FunctionPass* llvm::createDefaultPBQPRegisterAllocator() {
std::unique_ptr<PBQPBuilder> Builder;
if (pbqpCoalescing)
- Builder.reset(new PBQPBuilderWithCoalescing());
+ Builder = llvm::make_unique<PBQPBuilderWithCoalescing>();
else
- Builder.reset(new PBQPBuilder());
- return createPBQPRegisterAllocator(Builder);
+ Builder = llvm::make_unique<PBQPBuilder>();
+ return createPBQPRegisterAllocator(std::move(Builder));
}
#undef DEBUG_TYPE
More information about the llvm-commits
mailing list