Skip to content

Commit

Permalink
Sure up ownership passing of the PBQPBuilder by passing unique_ptrs b…
Browse files Browse the repository at this point in the history
…y 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
  • Loading branch information
dwblaikie committed Jul 19, 2014
1 parent ac1b5f1 commit 60e681a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/RegAllocPBQP.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace llvm {
};

FunctionPass *
createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> &builder,
createPBQPRegisterAllocator(std::unique_ptr<PBQPBuilder> builder,
char *customPassID = nullptr);
}

Expand Down
14 changes: 7 additions & 7 deletions lib/CodeGen/RegAllocPBQP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class RegAllocPBQP : public MachineFunctionPass {
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());
Expand Down Expand Up @@ -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

0 comments on commit 60e681a

Please sign in to comment.