avoid unnecessary macros in public headers
[libfirm] / ir / ir / irnodeset.h
index afbfac8..330caa6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
 #ifndef _FIRM_IRNODESET_H_
 #define _FIRM_IRNODESET_H_
 
-#include "irnode.h"
+#include "firm_types.h"
 #include "xmalloc.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_NODESET_USE_ORDERED_SETS
+
 #define HashSet          ir_nodeset_t
 #define HashSetIterator  ir_nodeset_iterator_t
 #define ValueType        ir_node*
 #define DO_REHASH
+
 #include "hashset.h"
+
 #undef DO_REHASH
 #undef ValueType
 #undef HashSetIterator
 #undef HashSet
 
+typedef struct ir_nodeset_t          ir_nodeset_t;
+typedef struct ir_nodeset_iterator_t ir_nodeset_iterator_t;
+
 /**
  * Initializes a nodeset with default size.
  *
@@ -72,8 +87,8 @@ void ir_nodeset_destroy(ir_nodeset_t *nodeset);
  * @param expected_elements   Number of elements expected in the nodeset (roughly)
  * @return The initialized nodeset
  */
-static INLINE ir_nodeset_t *ir_nodeset_new(size_t expected_elements) {
-       ir_nodeset_t *res = xmalloc(sizeof(*res));
+static inline ir_nodeset_t *ir_nodeset_new(size_t expected_elements) {
+       ir_nodeset_t *res = XMALLOC(ir_nodeset_t);
        ir_nodeset_init_size(res, expected_elements);
        return res;
 }
@@ -81,7 +96,7 @@ static INLINE ir_nodeset_t *ir_nodeset_new(size_t expected_elements) {
 /**
  * Destroys a nodeset and frees the memory of the nodeset itself.
  */
-static INLINE void ir_nodeset_del(ir_nodeset_t *nodeset) {
+static inline void ir_nodeset_del(ir_nodeset_t *nodeset) {
        ir_nodeset_destroy(nodeset);
        xfree(nodeset);
 }
@@ -96,6 +111,7 @@ static INLINE void ir_nodeset_del(ir_nodeset_t *nodeset) {
  */
 int ir_nodeset_insert(ir_nodeset_t *nodeset, ir_node *node);
 
+
 /**
  * Removes a node from a nodeset. Does nothing if the nodeset doesn't contain
  * the node.