[llvm] r216918 - unique_ptrify PBQPBuilder::build

Arnaud A. de Grandmaison arnaud.degrandmaison at arm.com
Tue Sep 2 14:41:31 PDT 2014


I also confirm this is not dead. It is used in out-of-tree targets, and we have some experiments going on with it right now.

 

Cheers,

Arnaud

 

From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of David Blaikie
Sent: 02 September 2014 23:22
To: Sean Silva
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm] r216918 - unique_ptrify PBQPBuilder::build

 

 

 

On Tue, Sep 2, 2014 at 2:17 PM, Sean Silva <chisophugis at gmail.com> wrote:

This PBQP stuff seems to be all dead?

 

All untested, not strictly dead. *throws the other shoe at Lang* (I think I threw one a while back about this)

 

http://llvm.org/reports/coverage/include/llvm/CodeGen/PBQP/index.html

 

http://llvm.org/reports/coverage/index-sort-f.html

 

-- Sean Silva

 

 

 

On Tue, Sep 2, 2014 at 10:42 AM, David Blaikie <dblaikie at gmail.com> wrote:

Author: dblaikie
Date: Tue Sep  2 12:42:01 2014
New Revision: 216918

URL: http://llvm.org/viewvc/llvm-project?rev=216918 <http://llvm.org/viewvc/llvm-project?rev=216918&view=rev> &view=rev
Log:
unique_ptrify PBQPBuilder::build

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=216918 <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h?rev=216918&r1=216917&r2=216918&view=diff> &r1=216917&r2=216918&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h (original)
+++ llvm/trunk/include/llvm/CodeGen/RegAllocPBQP.h Tue Sep  2 12:42:01 2014
@@ -123,9 +123,10 @@ namespace llvm {

     /// Build a PBQP instance to represent the register allocation problem for
     /// the given MachineFunction.
-    virtual PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,
-                                 const MachineBlockFrequencyInfo *mbfi,
-                                 const RegSet &vregs);
+    virtual std::unique_ptr<PBQPRAProblem>
+    build(MachineFunction *mf, const LiveIntervals *lis,
+          const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs);
+
   private:

     void addSpillCosts(PBQP::Vector &costVec, PBQP::PBQPNum spillCost);
@@ -142,9 +143,10 @@ namespace llvm {

     /// Build a PBQP instance to represent the register allocation problem for
     /// the given MachineFunction.
-    PBQPRAProblem *build(MachineFunction *mf, const LiveIntervals *lis,
-                         const MachineBlockFrequencyInfo *mbfi,
-                         const RegSet &vregs) override;
+    std::unique_ptr<PBQPRAProblem> build(MachineFunction *mf,
+                                         const LiveIntervals *lis,
+                                         const MachineBlockFrequencyInfo *mbfi,
+                                         const RegSet &vregs) override;

   private:


Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=216918 <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=216918&r1=216917&r2=216918&view=diff> &r1=216917&r2=216918&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Tue Sep  2 12:42:01 2014
@@ -183,15 +183,15 @@ unsigned PBQPRAProblem::getPRegForOption
   return allowedSet[option - 1];
 }

-PBQPRAProblem *PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis,
-                                  const MachineBlockFrequencyInfo *mbfi,
-                                  const RegSet &vregs) {
+std::unique_ptr<PBQPRAProblem>
+PBQPBuilder::build(MachineFunction *mf, const LiveIntervals *lis,
+                   const MachineBlockFrequencyInfo *mbfi, const RegSet &vregs) {

   LiveIntervals *LIS = const_cast<LiveIntervals*>(lis);
   MachineRegisterInfo *mri = &mf->getRegInfo();
   const TargetRegisterInfo *tri = mf->getSubtarget().getRegisterInfo();

-  std::unique_ptr<PBQPRAProblem> p(new PBQPRAProblem());
+  auto p = llvm::make_unique<PBQPRAProblem>();
   PBQPRAGraph &g = p->getGraph();
   RegSet pregs;

@@ -280,7 +280,7 @@ PBQPRAProblem *PBQPBuilder::build(Machin
     }
   }

-  return p.release();
+  return p;
 }

 void PBQPBuilder::addSpillCosts(PBQP::Vector &costVec,
@@ -309,12 +309,12 @@ void PBQPBuilder::addInterferenceCosts(
   }
 }

-PBQPRAProblem *PBQPBuilderWithCoalescing::build(MachineFunction *mf,
-                                                const LiveIntervals *lis,
-                                                const MachineBlockFrequencyInfo *mbfi,
-                                                const RegSet &vregs) {
+std::unique_ptr<PBQPRAProblem>
+PBQPBuilderWithCoalescing::build(MachineFunction *mf, const LiveIntervals *lis,
+                                 const MachineBlockFrequencyInfo *mbfi,
+                                 const RegSet &vregs) {

-  std::unique_ptr<PBQPRAProblem> p(PBQPBuilder::build(mf, lis, mbfi, vregs));
+  std::unique_ptr<PBQPRAProblem> p = PBQPBuilder::build(mf, lis, mbfi, vregs);
   PBQPRAGraph &g = p->getGraph();

   const TargetMachine &tm = mf->getTarget();
@@ -383,7 +383,7 @@ PBQPRAProblem *PBQPBuilderWithCoalescing
     }
   }

-  return p.release();
+  return p;
 }

 void PBQPBuilderWithCoalescing::addPhysRegCoalesce(PBQP::Vector &costVec,
@@ -579,8 +579,8 @@ bool RegAllocPBQP::runOnMachineFunction(
     while (!pbqpAllocComplete) {
       DEBUG(dbgs() << "  PBQP Regalloc round " << round << ":\n");

-      std::unique_ptr<PBQPRAProblem> problem(
-          builder->build(mf, lis, mbfi, vregsToAlloc));
+      std::unique_ptr<PBQPRAProblem> problem =
+          builder->build(mf, lis, mbfi, vregsToAlloc);

 #ifndef NDEBUG
       if (pbqpDumpGraphs) {


_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140902/f2906946/attachment.html>


More information about the llvm-commits mailing list