Speed up RN by explicitely reducing the incident edges.
[libfirm] / bucket.c
index 422c422..fdbe753 100644 (file)
--- a/bucket.c
+++ b/bucket.c
@@ -1,3 +1,31 @@
+/*
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief   Buckets for nodes and edges.
+ * @date    30.11.2008
+ * @author  Sebastian Buchwald
+ * @version $Id$
+ */
+#include "config.h"
+
 #include "adt/array.h"
 
 #include "bucket.h"
@@ -52,7 +80,7 @@ pbqp_edge *edge_bucket_pop(pbqp_edge_bucket *bucket)
 
 void node_bucket_shrink(pbqp_node_bucket *bucket, unsigned len)
 {
-       ARR_SHRINKLEN(*bucket, len);
+       ARR_SHRINKLEN(*bucket, (int)len);
 }
 
 int node_bucket_contains(pbqp_node_bucket bucket, pbqp_node *node)
@@ -73,6 +101,16 @@ void node_bucket_copy(pbqp_node_bucket *dst, pbqp_node_bucket src)
        }
 }
 
+void node_bucket_update(pbqp *pbqp, pbqp_node_bucket bucket)
+{
+       unsigned index;
+       unsigned length = node_bucket_get_length(bucket);
+
+       for (index = 0; index < length; ++index) {
+               pbqp->nodes[bucket[index]->index] = bucket[index];
+       }
+}
+
 void node_bucket_free(pbqp_node_bucket *bucket)
 {
        DEL_ARR_F(*bucket);
@@ -135,7 +173,6 @@ void node_bucket_deep_copy(pbqp *pbqp, pbqp_node_bucket *dst, pbqp_node_bucket s
        unsigned          bucket_index;
        unsigned          bucket_length;
 
-       node_bucket_init(dst);
        bucket_length = node_bucket_get_length(src);
 
        for (bucket_index = 0; bucket_index < bucket_length; ++bucket_index) {