X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=bucket.c;h=fdbe753d43c1c1dd052deb7f32f2c68ad968851b;hb=9958ab261229fcf06191c2a93f6604b74c50bd6e;hp=4e1a3ebb0633e684565cff516a1273612fa05cb9;hpb=17155153e812cdd7e73647a20b766f9ad68fb6c2;p=libfirm diff --git a/bucket.c b/bucket.c index 4e1a3ebb0..fdbe753d4 100644 --- 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,10 +173,9 @@ 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) { - node_bucket_insert(dst, pbqp_node_deep_copy(pbqp, src, src[bucket_index])); + node_bucket_insert(dst, pbqp_node_deep_copy(pbqp, *dst, src[bucket_index])); } }