Commit a147197e authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Remove the unused ir_lnk_nodeset.

parent fe057673
......@@ -147,7 +147,6 @@ libfirm_la_SOURCES = \
ir/irgwalk.c \
ir/irhooks.c \
ir/irio.c \
ir/irlinkednodeset.c \
ir/irmode.c \
ir/irnode.c \
ir/irnodehashmap.c \
......@@ -348,7 +347,6 @@ EXTRA_DIST = \
ir/iropt_t.h \
ir/irprintf_t.h \
ir/irprog_t.h \
ir/irlinkednodeset.h \
ir/irnodehashmap.h \
ir/irnodemap.h \
ir/irtypes.h \
......
/*
* 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
* @author Michael Beck
* @brief A linked nodeset.
*/
#include "config.h"
#include "irlinkednodeset.h"
#include "irnode_t.h"
#include "hashptr.h"
static ir_lnk_nodeset_entry_t null_nodeset_entry;
#define DO_REHASH
#define HashSet ir_lnk_nodeset_t
#define HashSetIterator ir_lnk_nodeset_iterator_t
#define ValueType ir_lnk_nodeset_entry_t
#define NullValue null_nodeset_entry
#define KeyType ir_node*
#define ConstKeyType const ir_node*
#define GetKey(value) (value).node
#define InitData(self,value,key) do { (value).node = (key); (value).list.next = NULL; (value).list.prev = NULL; } while (0)
#define Hash(self,key) ((unsigned)((key)->node_nr))
#define KeysEqual(self,key1,key2) (key1) == (key2)
#define SetRangeEmpty(ptr,size) memset(ptr, 0, (size) * sizeof((ptr)[0]))
#define EntrySetEmpty(value) (value).node = NULL
#define EntrySetDeleted(value) do { (value).node = (ir_node*) -1; list_del(&(value).list); } while (0)
#define EntryIsEmpty(value) ((value).node == NULL)
#define EntryIsDeleted(value) ((value).node == (ir_node*)-1)
#define hashset_init ir_lnk_nodeset_init
#define hashset_init_size ir_lnk_nodeset_init_size
#define hashset_destroy ir_lnk_nodeset_destroy
ir_lnk_nodeset_entry_t *ir_lnk_nodeset_insert_(ir_lnk_nodeset_t *nodeset, ir_node *node);
#define hashset_insert ir_lnk_nodeset_insert_
#define hashset_remove ir_lnk_nodeset_remove
ir_lnk_nodeset_entry_t *ir_lnk_nodeset_find_(const ir_lnk_nodeset_t *nodeset, const ir_node *node);
#define hashset_find ir_lnk_nodeset_find_
#define hashset_size ir_lnk_nodeset_size
#define ADDITIONAL_INIT INIT_LIST_HEAD(&self->elem_list); INIT_LIST_HEAD(&self->all_iters);
#define ADDITIONAL_TERM INIT_LIST_HEAD(&self->elem_list); INIT_LIST_HEAD(&self->all_iters);
#define HAVE_OWN_RESIZE
#include "hashset.c.inl"
/**
* Resize the hashset
* @internal
*/
static void resize(HashSet *self, size_t new_size)
{
HashSetEntry *old_entries = self->entries;
HashSetEntry *new_entries;
list_head list = self->elem_list;
HashSetEntry *entry;
int res = 1;
/* allocate a new array with double size */
new_entries = Alloc(new_size);
SetRangeEmpty(new_entries, new_size);
/* use the new array */
self->entries = new_entries;
self->num_buckets = new_size;
self->num_elements = 0;
self->num_deleted = 0;
#ifndef NDEBUG
self->entries_version++;
#endif
reset_thresholds(self);
assert(!list_empty(&self->elem_list));
list.next->prev = &list;
list.prev->next = &list;
/* reinsert all elements */
INIT_LIST_HEAD(&self->elem_list);
list_for_each_entry(ValueType, entry, &list, list) {
res &= ir_lnk_nodeset_insert(self, EntryGetValue(*entry).node);
}
/* all re-inserted data must be new, if not, we found a node twice ... */
assert(res == 1);
/* now we can free the old array */
Free(old_entries);
}
int ir_lnk_nodeset_insert(ir_lnk_nodeset_t *nodeset, ir_node *node)
{
ir_lnk_nodeset_entry_t *entry = ir_lnk_nodeset_insert_(nodeset, node);
if (entry->list.next == NULL) {
/* we have added a new element */
list_add_tail(&entry->list, &nodeset->elem_list);
return 1;
}
return 0;
}
int ir_lnk_nodeset_contains(const ir_lnk_nodeset_t *nodeset, const ir_node *node)
{
return ir_lnk_nodeset_find_(nodeset, node) != NULL;
}
void ir_lnk_nodeset_iterator_init(ir_lnk_nodeset_iterator_t *iterator,
const ir_lnk_nodeset_t *nodeset)
{
iterator->iter = nodeset->elem_list.next;
iterator->nodeset = nodeset;
}
ir_node *ir_lnk_nodeset_iterator_next(ir_lnk_nodeset_iterator_t *iterator)
{
ir_node *res;
if (iterator->iter == &iterator->nodeset->elem_list)
return NULL;
res = list_entry(iterator->iter, ir_lnk_nodeset_entry_t, list)->node;
iterator->iter = iterator->iter->next;
return res;
}
void ir_lnk_nodeset_remove_iterator(ir_lnk_nodeset_t *nodeset,
ir_lnk_nodeset_iterator_t *iterator)
{
ir_lnk_nodeset_entry_t *rem = list_entry(iterator->iter->prev, ir_lnk_nodeset_entry_t, list);
ir_lnk_nodeset_remove(nodeset, rem->node);
}
/*
* 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
* @author Michael Beck
* @brief A linked nodeset.
*/
#ifndef _FIRM_IRLINKEDNODESET_H_
#define _FIRM_IRLINKEDNODESET_H_
#include "firm_types.h"
#include "xmalloc.h"
#include "list.h"
typedef struct ir_lnk_nodeset_entry_t {
ir_node *node; /**< the node itself */
list_head list; /**< link field for the list iterator */
} ir_lnk_nodeset_entry_t;
#define HashSet ir_lnk_nodeset_t
#define ValueType ir_lnk_nodeset_entry_t
#define ADDITIONAL_DATA list_head elem_list; list_head all_iters;
#define DO_REHASH
#include "hashset.h"
#undef DO_REHASH
#undef ADDITIONAL_DATA
#undef ValueType
#undef HashSet
typedef struct ir_lnk_nodeset_t ir_lnk_nodeset_t;
typedef struct ir_lnk_nodeset_iterator_t {
list_head *iter; /**< points to the list head of the last element */
const ir_lnk_nodeset_t *nodeset; /**< lithe nodeset of this iterator. */
} ir_lnk_nodeset_iterator_t;
/**
* Initializes a linked nodeset with default size.
*
* @param nodeset Pointer to allocated space for the nodeset
*/
void ir_lnk_nodeset_init(ir_lnk_nodeset_t *nodeset);
/**
* Initializes a linked nodeset.
*
* @param nodeset Pointer to allocated space for the nodeset
* @param expected_elements Number of elements expected in the nodeset (roughly)
*/
void ir_lnk_nodeset_init_size(ir_lnk_nodeset_t *nodeset, size_t expected_elements);
/**
* Destroys a nodeset and frees the memory allocated for hashtable. The memory of
* the nodeset itself is not freed.
*
* @param nodeset Pointer to the nodeset
*/
void ir_lnk_nodeset_destroy(ir_lnk_nodeset_t *nodeset);
/**
* Allocates memory for a linked nodeset and initializes the set.
*
* @param expected_elements Number of elements expected in the nodeset (roughly)
* @return The initialized nodeset
*/
static inline ir_lnk_nodeset_t *ir_lnk_nodeset_new(size_t expected_elements) {
ir_lnk_nodeset_t *res = XMALLOC(ir_lnk_nodeset_t);
ir_lnk_nodeset_init_size(res, expected_elements);
return res;
}
/**
* Destroys a linked nodeset and frees the memory of the nodeset itself.
*/
static inline void ir_lnk_nodeset_del(ir_lnk_nodeset_t *nodeset) {
ir_lnk_nodeset_destroy(nodeset);
xfree(nodeset);
}
/**
* Inserts a node into a linked nodeset.
*
* @param nodeset Pointer to the nodeset
* @param node node to insert into the nodeset
* @returns 1 if the element has been inserted,
* 0 if it was already there
*/
int ir_lnk_nodeset_insert(ir_lnk_nodeset_t *nodeset, ir_node *node);
/**
* Removes a node from a linked nodeset. Does nothing if the nodeset doesn't contain
* the node.
*
* @param nodeset Pointer to the nodeset
* @param node Node to remove from the nodeset
*/
void ir_lnk_nodeset_remove(ir_lnk_nodeset_t *nodeset, const ir_node *node);
/**
* Tests whether a linked nodeset contains a specific node.
*
* @param nodeset Pointer to the nodeset
* @param node The pointer to find
* @returns 1 if nodeset contains the node, 0 else
*/
int ir_lnk_nodeset_contains(const ir_lnk_nodeset_t *nodeset, const ir_node *node);
/**
* Returns the number of nodes contained in the linked nodeset.
*
* @param nodeset Pointer to the nodeset
* @returns Number of nodes contained in the linked nodeset
*/
size_t ir_lnk_nodeset_size(const ir_lnk_nodeset_t *nodeset);
/**
* Initializes a nodeset iterator. Sets the iterator before the first element in
* the linked nodeset.
*
* @param iterator Pointer to already allocated iterator memory
* @param nodeset Pointer to the nodeset
*/
void ir_lnk_nodeset_iterator_init(ir_lnk_nodeset_iterator_t *iterator,
const ir_lnk_nodeset_t *nodeset);
/**
* Advances the iterator and returns the current element or NULL if all elements
* in the linked nodeset have been processed.
* @attention It is not allowed to use ir_lnk_nodeset_insert or ir_lnk_nodeset_remove while
* iterating over a nodeset.
*
* @param iterator Pointer to the nodeset iterator.
* @returns Next element in the nodeset or NULL
*/
ir_node *ir_lnk_nodeset_iterator_next(ir_lnk_nodeset_iterator_t *iterator);
/**
* Removes the element the iterator currently points to.
*
* @param nodeset Pointer to the linked nodeset
* @param iterator Pointer to the linked nodeset iterator.
*/
void ir_lnk_nodeset_remove_iterator(ir_lnk_nodeset_t *nodeset,
ir_lnk_nodeset_iterator_t *iterator);
#define foreach_ir_lnk_nodeset(nodeset, irn, iter) \
for (ir_lnk_nodeset_iterator_init(&iter, nodeset), \
irn = ir_lnk_nodeset_iterator_next(&iter); \
irn != NULL; irn = ir_lnk_nodeset_iterator_next(&iter))
#endif
......@@ -321,7 +321,6 @@
<ClCompile Include="$(FirmRoot)\ir\ir\irgwalk_blk.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irhooks.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irio.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irmode.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irnode.c"/>
<ClCompile Include="$(FirmRoot)\ir\ir\irnodemap.c"/>
......@@ -346,7 +345,6 @@
<ClInclude Include="$(FirmRoot)\ir\ir\iredgeset.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irflag_t.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irnode_t.h"/>
<ClInclude Include="$(FirmRoot)\ir\ir\irnodemap.h"/>
......
......@@ -738,9 +738,6 @@
<ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irmode.c">
<Filter>ir\ir</Filter>
</ClCompile>
......@@ -813,9 +810,6 @@
<ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
......@@ -2538,9 +2532,6 @@
<ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irmode.c">
<Filter>ir\ir</Filter>
</ClCompile>
......@@ -2613,9 +2604,6 @@
<ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
......@@ -4221,9 +4209,6 @@
<ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irmode.c">
<Filter>ir\ir</Filter>
</ClCompile>
......@@ -4296,9 +4281,6 @@
<ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
......@@ -5898,9 +5880,6 @@
<ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
<Filter>ir\ir</Filter>
</ClCompile>
<ClCompile Include="$(FirmRoot)\ir\ir\irmode.c">
<Filter>ir\ir</Filter>
</ClCompile>
......@@ -5973,9 +5952,6 @@
<ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
<Filter>ir\ir</Filter>
</ClInclude>
<ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h">
<Filter>ir\ir</Filter>
</ClInclude>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment