<div dir="ltr">Thanks Dave!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 2, 2014 at 10:42 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Tue Sep 2 12:42:01 2014<br>
New Revision: 216918<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216918&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216918&view=rev</a><br>
Log:<br>
unique_ptrify PBQPBuilder::build<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h<br>
llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=216918&r1=216917&r2=216918&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=216918&r1=216917&r2=216918&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h (original)<br>
+++ llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h Tue Sep 2 12:42:01 2014<br>
@@ -123,9 +123,10 @@ namespace llvm {<br>
<br>
/// Build a PBQP instance to represent the register allocation problem for<br>
/// the given MachineFunction.<br>
- virtual PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineBlockFrequencyInfo *mbfi,<br>
- const RegSet &vregs);<br>
+ virtual std::unique_ptr<PBQPRAProblem><br>
+ build(MachineFunction *mf, const LiveIntervals *lis,<br>
+ const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs);<br>
+<br>
private:<br>
<br>
void addSpillCosts(PBQP::Vector &costVec, PBQP::PBQPNum spillCost);<br>
@@ -142,9 +143,10 @@ namespace llvm {<br>
<br>
/// Build a PBQP instance to represent the register allocation problem for<br>
/// the given MachineFunction.<br>
- PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineBlockFrequencyInfo *mbfi,<br>
- const RegSet &vregs) override;<br>
+ std::unique_ptr<PBQPRAProblem> build(MachineFunction *mf,<br>
+ const LiveIntervals *lis,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
+ const RegSet &vregs) override;<br>
<br>
private:<br>
<br>
<br>
Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=216918&r1=216917&r2=216918&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=216918&r1=216917&r2=216918&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Tue Sep 2 12:42:01 2014<br>
@@ -183,15 +183,15 @@ unsigned PBQPRAProblem::getPRegForOption<br>
return allowedSet[option - 1];<br>
}<br>
<br>
-PBQPRAProblem *PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis,<br>
- const MachineBlockFrequencyInfo *mbfi,<br>
- const RegSet &vregs) {<br>
+std::unique_ptr<PBQPRAProblem><br>
+PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis,<br>
+ const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs) {<br>
<br>
LiveIntervals *LIS = const_cast<LiveIntervals*>(lis);<br>
MachineRegisterInfo *mri = &mf->getRegInfo();<br>
const TargetRegisterInfo *tri = mf->getSubtarget().getRegisterInfo();<br>
<br>
- std::unique_ptr<PBQPRAProblem> p(new PBQPRAProblem());<br>
+ auto p = llvm::make_unique<PBQPRAProblem>();<br>
PBQPRAGraph &g = p->getGraph();<br>
RegSet pregs;<br>
<br>
@@ -280,7 +280,7 @@ PBQPRAProblem *PBQPBuilder::build(Machin<br>
}<br>
}<br>
<br>
- return p.release();<br>
+ return p;<br>
}<br>
<br>
void PBQPBuilder::addSpillCosts(PBQP::Vector &costVec,<br>
@@ -309,12 +309,12 @@ void PBQPBuilder::addInterferenceCosts(<br>
}<br>
}<br>
<br>
-PBQPRAProblem *PBQPBuilderWithCoalescing::build(MachineFunction *mf,<br>
- const LiveIntervals *lis,<br>
- const MachineBlockFrequencyInfo *mbfi,<br>
- const RegSet &vregs) {<br>
+std::unique_ptr<PBQPRAProblem><br>
+PBQPBuilderWithCoalescing::build(MachineFunction *mf, const LiveIntervals *lis,<br>
+ const MachineBlockFrequencyInfo *mbfi,<br>
+ const RegSet &vregs) {<br>
<br>
- std::unique_ptr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, mbfi, vregs));<br>
+ std::unique_ptr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, mbfi, vregs);<br>
PBQPRAGraph &g = p->getGraph();<br>
<br>
const TargetMachine &tm = mf->getTarget();<br>
@@ -383,7 +383,7 @@ PBQPRAProblem *PBQPBuilderWithCoalescing<br>
}<br>
}<br>
<br>
- return p.release();<br>
+ return p;<br>
}<br>
<br>
void PBQPBuilderWithCoalescing::addPhysRegCoalesce(PBQP::Vector &costVec,<br>
@@ -579,8 +579,8 @@ bool RegAllocPBQP::runOnMachineFunction(<br>
while (!pbqpAllocComplete) {<br>
DEBUG(dbgs() << " PBQP Regalloc round " << round << ":\n");<br>
<br>
- std::unique_ptr<PBQPRAProblem> problem(<br>
- builder->build(mf, lis, mbfi, vregsToAlloc));<br>
+ std::unique_ptr<PBQPRAProblem> problem =<br>
+ builder->build(mf, lis, mbfi, vregsToAlloc);<br>
<br>
#ifndef NDEBUG<br>
if (pbqpDumpGraphs) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>