[llvm-commits] [llvm] r112807 - in /llvm/trunk/lib/CodeGen/PBQP: HeuristicBase.h HeuristicSolver.h Solution.h
Lang Hames
lhames at gmail.com
Wed Sep 1 22:37:52 PDT 2010
Author: lhames
Date: Thu Sep 2 00:37:52 2010
New Revision: 112807
URL: http://llvm.org/viewvc/llvm-project?rev=112807&view=rev
Log:
Added counters for PBQP reduction rules.
Modified:
llvm/trunk/lib/CodeGen/PBQP/HeuristicBase.h
llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h
llvm/trunk/lib/CodeGen/PBQP/Solution.h
Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicBase.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicBase.h?rev=112807&r1=112806&r2=112807&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PBQP/HeuristicBase.h (original)
+++ llvm/trunk/lib/CodeGen/PBQP/HeuristicBase.h Thu Sep 2 00:37:52 2010
@@ -174,8 +174,11 @@
while (!finished) {
if (!optimalReduce())
- if (!impl().heuristicReduce())
+ if (impl().heuristicReduce()) {
+ getSolver().recordRN();
+ } else {
finished = true;
+ }
}
}
Modified: llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h?rev=112807&r1=112806&r2=112807&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h (original)
+++ llvm/trunk/lib/CodeGen/PBQP/HeuristicSolver.h Thu Sep 2 00:37:52 2010
@@ -226,6 +226,8 @@
// Nothing to do. Just push the node onto the reduction stack.
pushToStack(nItr);
+
+ s.recordR0();
}
/// \brief Apply rule R1.
@@ -274,6 +276,7 @@
assert(nd.getSolverDegree() == 0 &&
"Degree 1 with edge removed should be 0.");
pushToStack(xnItr);
+ s.recordR1();
}
/// \brief Apply rule R2.
@@ -378,8 +381,14 @@
removeSolverEdge(zxeItr);
pushToStack(xnItr);
+ s.recordR2();
}
+ /// \brief Record an application of the RN rule.
+ ///
+ /// For use by the HeuristicBase.
+ void recordRN() { s.recordRN(); }
+
private:
NodeData& getSolverNodeData(Graph::NodeItr nItr) {
Modified: llvm/trunk/lib/CodeGen/PBQP/Solution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PBQP/Solution.h?rev=112807&r1=112806&r2=112807&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PBQP/Solution.h (original)
+++ llvm/trunk/lib/CodeGen/PBQP/Solution.h Thu Sep 2 00:37:52 2010
@@ -26,15 +26,46 @@
/// To get the selection for each node in the problem use the getSelection method.
class Solution {
private:
+
typedef std::map<Graph::NodeItr, unsigned, NodeItrComparator> SelectionsMap;
SelectionsMap selections;
+ unsigned r0Reductions, r1Reductions, r2Reductions, rNReductions;
+
public:
/// \brief Number of nodes for which selections have been made.
/// @return Number of nodes for which selections have been made.
unsigned numNodes() const { return selections.size(); }
+ /// \brief Records a reduction via the R0 rule. Should be called from the
+ /// solver only.
+ void recordR0() { ++r0Reductions; }
+
+ /// \brief Returns the number of R0 reductions applied to solve the problem.
+ unsigned numR0Reductions() const { return r0Reductions; }
+
+ /// \brief Records a reduction via the R1 rule. Should be called from the
+ /// solver only.
+ void recordR1() { ++r1Reductions; }
+
+ /// \brief Returns the number of R1 reductions applied to solve the problem.
+ unsigned numR1Reductions() const { return r1Reductions; }
+
+ /// \brief Records a reduction via the R2 rule. Should be called from the
+ /// solver only.
+ void recordR2() { ++r2Reductions; }
+
+ /// \brief Returns the number of R2 reductions applied to solve the problem.
+ unsigned numR2Reductions() const { return r2Reductions; }
+
+ /// \brief Records a reduction via the RN rule. Should be called from the
+ /// solver only.
+ void recordRN() { ++ rNReductions; }
+
+ /// \brief Returns the number of RN reductions applied to solve the problem.
+ unsigned numRNReductions() const { return rNReductions; }
+
/// \brief Set the selection for a given node.
/// @param nItr Node iterator.
/// @param selection Selection for nItr.
More information about the llvm-commits
mailing list