Remove the unused ir_lnk_nodemap.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 20 Jul 2012 07:52:19 +0000 (09:52 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 20 Jul 2012 08:25:50 +0000 (10:25 +0200)
ir/Makefile.am
ir/ir/irlinkednodemap.c [deleted file]
ir/ir/irlinkednodemap.h [deleted file]
win32/vc2010/firm.vcxproj
win32/vc2010/firm.vcxproj.filters

index 28ff384..8812427 100644 (file)
@@ -147,7 +147,6 @@ libfirm_la_SOURCES = \
        ir/irgwalk.c \
        ir/irhooks.c \
        ir/irio.c \
-       ir/irlinkednodemap.c \
        ir/irlinkednodeset.c \
        ir/irmode.c \
        ir/irnode.c \
@@ -349,7 +348,6 @@ EXTRA_DIST = \
        ir/iropt_t.h \
        ir/irprintf_t.h \
        ir/irprog_t.h \
-       ir/irlinkednodemap.h \
        ir/irlinkednodeset.h \
        ir/irnodehashmap.h \
        ir/irnodemap.h \
diff --git a/ir/ir/irlinkednodemap.c b/ir/ir/irlinkednodemap.c
deleted file mode 100644 (file)
index 9949346..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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 nodemap.
- */
-#include "config.h"
-
-#include "irlinkednodemap.h"
-#include "irnode_t.h"
-#include "hashptr.h"
-
-static ir_lnk_nodemap_entry_t null_nodemap_entry;
-
-#define DO_REHASH
-#define HashSet                   ir_lnk_nodemap_t
-#define HashSetIterator           ir_lnk_nodemap_iterator_t
-#define ValueType                 ir_lnk_nodemap_entry_t
-#define NullValue                 null_nodemap_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_nodemap_init
-#define hashset_init_size       ir_lnk_nodemap_init_size
-#define hashset_destroy         ir_lnk_nodemap_destroy
-ir_lnk_nodemap_entry_t *ir_lnk_nodemap_insert_(ir_lnk_nodemap_t *self, ir_node *node);
-#define hashset_insert          ir_lnk_nodemap_insert_
-#define hashset_remove          ir_lnk_nodemap_remove
-ir_lnk_nodemap_entry_t *ir_lnk_nodemap_find_(const ir_lnk_nodemap_t *self,
-                                             const ir_node *node);
-#define hashset_find            ir_lnk_nodemap_find_
-#define hashset_size            ir_lnk_nodemap_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_nodemap_put(self, EntryGetValue(*entry).node, EntryGetValue(*entry).data);
-       }
-       /* 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_nodemap_put(ir_lnk_nodemap_t *nodemap, ir_node *node, void *data)
-{
-       ir_lnk_nodemap_entry_t *entry = ir_lnk_nodemap_insert_(nodemap, node);
-
-       entry->data = data;
-       if (entry->list.next == NULL) {
-               /* we have added a new element */
-               list_add_tail(&entry->list, &nodemap->elem_list);
-               return 1;
-       }
-       return 0;
-}
-
-void *ir_lnk_nodemap_get(const ir_lnk_nodemap_t *nodemap, const ir_node *node)
-{
-       ir_lnk_nodemap_entry_t *entry = ir_lnk_nodemap_find_(nodemap, node);
-       return entry->data;
-}
-
-void ir_lnk_nodemap_iterator_init(ir_lnk_nodemap_iterator_t *iterator,
-                                  const ir_lnk_nodemap_t *nodemap)
-{
-       iterator->iter    = nodemap->elem_list.next;
-       iterator->nodemap = nodemap;
-}
-
-ir_node *ir_lnk_nodemap_iterator_next(ir_lnk_nodemap_iterator_t *iterator)
-{
-       ir_node *res;
-       if (iterator->iter == &iterator->nodemap->elem_list)
-               return NULL;
-
-       res = list_entry(iterator->iter, ir_lnk_nodemap_entry_t, list)->node;
-       iterator->iter = iterator->iter->next;
-
-       return res;
-}
-
-void ir_lnk_nodemap_remove_iterator(ir_lnk_nodemap_t *nodemap,
-                                    ir_lnk_nodemap_iterator_t *iterator)
-{
-       ir_lnk_nodemap_entry_t *rem = list_entry(iterator->iter->prev, ir_lnk_nodemap_entry_t, list);
-
-       ir_lnk_nodemap_remove(nodemap, rem->node);
-}
diff --git a/ir/ir/irlinkednodemap.h b/ir/ir/irlinkednodemap.h
deleted file mode 100644 (file)
index f58c7f1..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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 nodemap.
- */
-#ifndef _FIRM_IRLINKEDNODEMAP_H_
-#define _FIRM_IRLINKEDNODEMAP_H_
-
-#include "firm_types.h"
-#include "xmalloc.h"
-#include "list.h"
-
-/*
- * sebastian experimental:
- * use ordered arrays as node sets.
- * the guys here have made good experiences with that.
- * Internally we use normal Firm arrays and binary
- * search for locating the elements. Using arrays should
- * give the sets a small footprint.
- */
-#undef IR_nodemap_USE_ORDERED_SETS
-
-typedef struct ir_lnk_nodemap_entry_t {
-       ir_node     *node;  /**< the node itself */
-       void        *data;  /**< associated data */
-       list_head   list;   /**< link field for the list iterator */
-} ir_lnk_nodemap_entry_t;
-
-#define HashSet          ir_lnk_nodemap_t
-#define ValueType        ir_lnk_nodemap_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_nodemap_t ir_lnk_nodemap_t;
-typedef struct ir_lnk_nodemap_iterator_t {
-       list_head              *iter;       /**< points to the list head of the last element */
-       const ir_lnk_nodemap_t *nodemap;    /**< lithe nodemap of this iterator. */
-} ir_lnk_nodemap_iterator_t;
-
-/**
- * Initializes a linked nodemap with default size.
- *
- * @param nodemap      Pointer to allocated space for the nodemap
- */
-void ir_lnk_nodemap_init(ir_lnk_nodemap_t *nodemap);
-
-/**
- * Initializes a linked nodemap.
- *
- * @param nodemap             Pointer to allocated space for the nodemap
- * @param expected_elements   Number of elements expected in the nodemap (roughly)
- */
-void ir_lnk_nodemap_init_size(ir_lnk_nodemap_t *nodemap, size_t expected_elements);
-
-/**
- * Destroys a nodemap and frees the memory allocated for hashtable. The memory of
- * the nodemap itself is not freed.
- *
- * @param nodemap   Pointer to the nodemap
- */
-void ir_lnk_nodemap_destroy(ir_lnk_nodemap_t *nodemap);
-
-/**
- * Allocates memory for a linked nodemap and initializes the set.
- *
- * @param expected_elements   Number of elements expected in the nodemap (roughly)
- * @return The initialized nodemap
- */
-static inline ir_lnk_nodemap_t *ir_lnk_nodemap_new(size_t expected_elements) {
-       ir_lnk_nodemap_t *res = XMALLOC(ir_lnk_nodemap_t);
-       ir_lnk_nodemap_init_size(res, expected_elements);
-       return res;
-}
-
-/**
- * Destroys a linked nodemap and frees the memory of the nodemap itself.
- */
-static inline void ir_lnk_nodemap_del(ir_lnk_nodemap_t *nodemap) {
-       ir_lnk_nodemap_destroy(nodemap);
-       xfree(nodemap);
-}
-
-/**
- * Inserts a node into a linked nodemap.
- *
- * @param nodemap   Pointer to the nodemap
- * @param node      node to insert into the nodemap
- * @param data      data to associate with the node
- * @returns         1 if the element has been inserted,
- *                  0 if it was already there
- */
-int ir_lnk_nodemap_put(ir_lnk_nodemap_t *nodemap, ir_node *node, void *data);
-
-/**
- * Get the associated value of a specific node
- *
- * @param nodemap   Pointer to the nodemap
- * @param node      The pointer to find
- * @returns         the associated data of the node or NULL
- */
-void *ir_lnk_nodemap_get(const ir_lnk_nodemap_t *nodemap, const ir_node *node);
-
-/**
- * Removes a node from a linked nodemap. Does nothing if the nodemap doesn't contain
- * the node.
- *
- * @param nodemap  Pointer to the nodemap
- * @param node     Node to remove from the nodemap
- */
-void ir_lnk_nodemap_remove(ir_lnk_nodemap_t *nodemap, const ir_node *node);
-
-/**
- * Returns the number of nodes contained in the linked nodemap.
- *
- * @param nodemap   Pointer to the nodemap
- * @returns         Number of nodes contained in the linked nodemap
- */
-size_t ir_lnk_nodemap_size(const ir_lnk_nodemap_t *nodemap);
-
-/**
- * Initializes a nodemap iterator. Sets the iterator before the first element in
- * the linked nodemap.
- *
- * @param iterator   Pointer to already allocated iterator memory
- * @param nodemap       Pointer to the nodemap
- */
-void ir_lnk_nodemap_iterator_init(ir_lnk_nodemap_iterator_t *iterator,
-                                  const ir_lnk_nodemap_t *nodemap);
-
-/**
- * Advances the iterator and returns the current element or NULL if all elements
- * in the linked nodemap have been processed.
- * @attention It is not allowed to use ir_lnk_nodemap_insert or ir_lnk_nodemap_remove while
- *            iterating over a nodemap.
- *
- * @param iterator  Pointer to the nodemap iterator.
- * @returns         Next element in the nodemap or NULL
- */
-ir_node *ir_lnk_nodemap_iterator_next(ir_lnk_nodemap_iterator_t *iterator);
-
-/**
- * Removes the element the iterator currently points to.
- *
- * @param nodemap   Pointer to the linked nodemap
- * @param iterator  Pointer to the linked nodemap iterator.
- */
-void ir_lnk_nodemap_remove_iterator(ir_lnk_nodemap_t *nodemap,
-                                    ir_lnk_nodemap_iterator_t *iterator);
-
-#define foreach_ir_lnk_nodemap(nodemap, irn, iter) \
-       for (ir_lnk_nodemap_iterator_init(&iter, nodemap), \
-        irn = ir_lnk_nodemap_iterator_next(&iter);    \
-               irn != NULL; irn = ir_lnk_nodemap_iterator_next(&iter))
-
-#endif
index fc4e97a..9f35231 100644 (file)
     <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\irlinkednodemap.c"/>
     <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c"/>
     <ClCompile Include="$(FirmRoot)\ir\ir\irmode.c"/>
     <ClCompile Include="$(FirmRoot)\ir\ir\irnode.c"/>
     <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\irlinkednodemap.h"/>
     <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h"/>
     <ClInclude Include="$(FirmRoot)\ir\ir\irmode_t.h"/>
     <ClInclude Include="$(FirmRoot)\ir\ir\irnode_t.h"/>
index 598d8c2..2375174 100644 (file)
     <ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
-    <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodemap.c">
-      <Filter>ir\ir</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodemap.h">
-      <Filter>ir\ir</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
     <ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
-    <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodemap.c">
-      <Filter>ir\ir</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodemap.h">
-      <Filter>ir\ir</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
     <ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
-    <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodemap.c">
-      <Filter>ir\ir</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodemap.h">
-      <Filter>ir\ir</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
     <ClCompile Include="$(FirmRoot)\ir\ir\irio.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
-    <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodemap.c">
-      <Filter>ir\ir</Filter>
-    </ClCompile>
     <ClCompile Include="$(FirmRoot)\ir\ir\irlinkednodeset.c">
       <Filter>ir\ir</Filter>
     </ClCompile>
     <ClInclude Include="$(FirmRoot)\ir\ir\irgraph_t.h">
       <Filter>ir\ir</Filter>
     </ClInclude>
-    <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodemap.h">
-      <Filter>ir\ir</Filter>
-    </ClInclude>
     <ClInclude Include="$(FirmRoot)\ir\ir\irlinkednodeset.h">
       <Filter>ir\ir</Filter>
     </ClInclude>