* @file
* @author Michael Beck
* @brief A value set, containing expression for values.
- * @version $Id$
*/
#ifndef _FIRM_VALUESET_H_
#define _FIRM_VALUESET_H_
-#include "firm_config.h"
-
#include "firm_types.h"
#include "xmalloc.h"
#include "list.h"
typedef struct ir_valueset_entry_t {
ir_node *value; /**< the represented value */
ir_node *expr; /**< the leader expression for the value in the current set */
+ void *link; /**< additional attached information */
list_head list; /**< link field for the list iterator */
} ir_valueset_entry_t;
#define HashSet ir_valueset_t
-#define HashSetIterator ir_valueset_iterator_t
#define ValueType ir_valueset_entry_t
#define ADDITIONAL_DATA list_head elem_list; list_head all_iters;
#undef DO_REHASH
-#define NO_ITERATOR
#include "hashset.h"
-#undef NO_ITERATOR
#undef ADDITIONAL_DATA
#undef ValueType
-#undef HashSetIterator
#undef HashSet
typedef struct ir_valueset_t ir_valueset_t;
* @param expected_elements Number of elements expected in the value set (roughly)
* @return The initialized value set
*/
-static INLINE ir_valueset_t *ir_valueset_new(size_t expected_elements) {
+static inline ir_valueset_t *ir_valueset_new(size_t expected_elements) {
ir_valueset_t *res = XMALLOC(ir_valueset_t);
ir_valueset_init_size(res, expected_elements);
return res;
/**
* Destroys a value set and frees the memory of the set itself.
*/
-static INLINE void ir_valueset_del(ir_valueset_t *valueset) {
+static inline void ir_valueset_del(ir_valueset_t *valueset) {
ir_valueset_destroy(valueset);
xfree(valueset);
}
*/
int ir_valueset_insert(ir_valueset_t *valueset, ir_node *value, ir_node *expr);
+/**
+ * Sets link of the element associated with specified value.
+ *
+ * @param valueset Pointer to the value set.
+ * @param value Value of the element.
+ * @param link Link to be set in element.
+ */
+void ir_valueset_set_link(const ir_valueset_t *valueset, const ir_node *value, void *link);
+
+/**
+ * Get the link of the element associated with specified value.
+ *
+ * @param valueset Pointer to the value set.
+ * @param value Value of the element.
+ * @returns Link of the element associated to the value.
+ */
+void *ir_valueset_get_link(const ir_valueset_t *valueset, const ir_node *value);
+
/**
* Inserts a (value, expression) pair into a valueset if the value is not already
* known, else replace the expression for the given value.
* the value.
*
* @param valueset Pointer to the value set
- * @param value value to remove from the values et
+ * @param value value to remove from the values set
*/
void ir_valueset_remove(ir_valueset_t *valueset, const ir_node *value);