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)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-07-19 21:19:45 +00:00
parent ac1b5f177b
commit 60e681a4b5
2 changed files with 8 additions and 8 deletions

View File

@ -158,7 +158,7 @@ namespace llvm {
};
FunctionPass *
createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder,
createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> builder,
char *customPassID = nullptr);
}

View File

@ -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(MachineFunction &MF) {
}
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