[llvm] r218848 - [PBQP] Add support for graph-level metadata to the PBQP graph. This will be used

Lang Hames lhames at gmail.com
Wed Oct 1 21:17:36 PDT 2014


Author: lhames
Date: Wed Oct  1 23:17:36 2014
New Revision: 218848

URL: http://llvm.org/viewvc/llvm-project?rev=218848&view=rev
Log:
[PBQP] Add support for graph-level metadata to the PBQP graph. This will be used
in the future to attach useful information about the PBQP graph (e.g. the
associated MachineFunction, pointers to regalloc passes) to the graph itself,
making that information accessible to the solver. This should also allow the
PBQPBuilder interface to be simplified.


Modified:
    llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h
    llvm/trunk/include/llvm/CodeGen/PBQP/RegAllocSolver.h

Modified: llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h?rev=218848&r1=218847&r2=218848&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h (original)
+++ llvm/trunk/include/llvm/CodeGen/PBQP/Graph.h Wed Oct  1 23:17:36 2014
@@ -56,6 +56,7 @@ namespace PBQP {
     typedef typename CostAllocator::MatrixPtr MatrixPtr;
     typedef typename SolverT::NodeMetadata NodeMetadata;
     typedef typename SolverT::EdgeMetadata EdgeMetadata;
+    typedef typename SolverT::GraphMetadata GraphMetadata;
 
   private:
 
@@ -172,6 +173,7 @@ namespace PBQP {
 
     // ----- MEMBERS -----
 
+    GraphMetadata Metadata;
     CostAllocator CostAlloc;
     SolverT *Solver;
 
@@ -331,6 +333,12 @@ namespace PBQP {
     /// \brief Construct an empty PBQP graph.
     Graph() : Solver(nullptr) { }
 
+    /// \brief Get a reference to the graph metadata.
+    GraphMetadata& getMetadata() { return Metadata; }
+
+    /// \brief Get a const-reference to the graph metadata.
+    const GraphMetadata& getMetadata() const { return Metadata; }
+
     /// \brief Lock this graph to the given solver instance in preparation
     /// for running the solver. This method will call solver.handleAddNode for
     /// each node in the graph, and handleAddEdge for each edge, to give the

Modified: llvm/trunk/include/llvm/CodeGen/PBQP/RegAllocSolver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PBQP/RegAllocSolver.h?rev=218848&r1=218847&r2=218848&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/PBQP/RegAllocSolver.h (original)
+++ llvm/trunk/include/llvm/CodeGen/PBQP/RegAllocSolver.h Wed Oct  1 23:17:36 2014
@@ -144,6 +144,7 @@ namespace PBQP {
       typedef RegAlloc::NodeMetadata NodeMetadata;
 
       struct EdgeMetadata { };
+      struct GraphMetadata { };
 
       typedef PBQP::Graph<RegAllocSolverImpl> Graph;
 





More information about the llvm-commits mailing list