summaryrefslogtreecommitdiffhomepage
path: root/ir/kaps
diff options
context:
space:
mode:
authorSebastian Buchwald <Sebastian.Buchwald@kit.edu>2013-04-23 13:59:12 +0200
committerSebastian Buchwald <Sebastian.Buchwald@kit.edu>2013-04-23 13:59:12 +0200
commitd50a29a5254587d4a63d33f0106a4b3d03996a30 (patch)
tree7d53766b02ce93920c3b439d0d1edd8112ae1a1a /ir/kaps
parentec9575be3b0f12ee2c65ea874f998ffec4a283d3 (diff)
Assert if we try to solve an already solved PBQP.
Diffstat (limited to 'ir/kaps')
-rw-r--r--ir/kaps/brute_force.c4
-rw-r--r--ir/kaps/heuristical.c4
-rw-r--r--ir/kaps/heuristical_co.c4
-rw-r--r--ir/kaps/heuristical_co_ld.c4
-rw-r--r--ir/kaps/kaps.c4
5 files changed, 20 insertions, 0 deletions
diff --git a/ir/kaps/brute_force.c b/ir/kaps/brute_force.c
index 1b8bce8..6392582 100644
--- a/ir/kaps/brute_force.c
+++ b/ir/kaps/brute_force.c
@@ -292,7 +292,11 @@ static void back_propagate_brute_force(pbqp_t *pbqp)
void solve_pbqp_brute_force(pbqp_t *pbqp)
{
+#ifndef NDEBUG
assert(pbqp);
+ assert(pbqp->solution == INF_COSTS && "PBQP already solved");
+ pbqp->solution = 0;
+#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
diff --git a/ir/kaps/heuristical.c b/ir/kaps/heuristical.c
index f17fbb6..5e8375a 100644
--- a/ir/kaps/heuristical.c
+++ b/ir/kaps/heuristical.c
@@ -84,7 +84,11 @@ static void apply_heuristic_reductions(pbqp_t *pbqp)
void solve_pbqp_heuristical(pbqp_t *pbqp)
{
+#ifndef NDEBUG
assert(pbqp);
+ assert(pbqp->solution == INF_COSTS && "PBQP already solved");
+ pbqp->solution = 0;
+#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
diff --git a/ir/kaps/heuristical_co.c b/ir/kaps/heuristical_co.c
index a967dad..c91e7d5 100644
--- a/ir/kaps/heuristical_co.c
+++ b/ir/kaps/heuristical_co.c
@@ -164,8 +164,12 @@ static void apply_heuristic_reductions_co(pbqp_t *pbqp, plist_t *rpeo)
void solve_pbqp_heuristical_co(pbqp_t *pbqp, plist_t *rpeo)
{
+#ifndef NDEBUG
assert(pbqp);
assert(rpeo);
+ assert(pbqp->solution == INF_COSTS && "PBQP already solved");
+ pbqp->solution = 0;
+#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
diff --git a/ir/kaps/heuristical_co_ld.c b/ir/kaps/heuristical_co_ld.c
index 48e9607..6627162 100644
--- a/ir/kaps/heuristical_co_ld.c
+++ b/ir/kaps/heuristical_co_ld.c
@@ -313,8 +313,12 @@ static void apply_heuristic_reductions_co(pbqp_t *pbqp, plist_t *rpeo)
void solve_pbqp_heuristical_co_ld(pbqp_t *pbqp, plist_t *rpeo)
{
+#ifndef NDEBUG
assert(pbqp);
assert(rpeo);
+ assert(pbqp->solution == INF_COSTS && "PBQP already solved");
+ pbqp->solution = 0;
+#endif
/* Reduce nodes degree ... */
initial_simplify_edges(pbqp);
diff --git a/ir/kaps/kaps.c b/ir/kaps/kaps.c
index d174c74..8061a55 100644
--- a/ir/kaps/kaps.c
+++ b/ir/kaps/kaps.c
@@ -58,7 +58,11 @@ pbqp_t *alloc_pbqp(unsigned number_nodes)
obstack_init(&pbqp->obstack);
+#ifdef NDEBUG
pbqp->solution = 0;
+#else
+ pbqp->solution = INF_COSTS;
+#endif
pbqp->num_nodes = number_nodes;
#if KAPS_DUMP
pbqp->dump_file = NULL;