Added add_saturated
[libfirm] / ir / tr / type_identify.h
index c4a4be3..85bc34f 100644 (file)
 # ifndef _TYPE_IDENTIFY_H_
 # define _TYPE_IDENTIFY_H_
 
-#ifndef _TYPE_TYPEDEF_
-#define _TYPE_TYPEDEF_
-typedef struct type type;
-#endif
+#include "firm_types.h"
 
 /* ------------------------------------------------------------------------ */
 
@@ -50,13 +47,13 @@ int compare_strict (const void *tp1, const void *tp2);
  *
  *   @param tp The type to compute a hash for.
  */
-typedef int (hash_types_func_t)(type *tp);
+typedef int (hash_types_func_t)(ir_type *tp);
 
 /** Computes a hash value by the type name.
  *
  * Uses the name of the type and the type opcode to compute the hash.
  */
-int hash_name (type *tp);
+int firm_hash_name (ir_type *tp);
 
 /* ------------------------------------------------------------------------ */
 
@@ -78,7 +75,7 @@ int hash_name (type *tp);
  *
  * @param tp     The type to mature.
  */
-type *       mature_type(type *tp);
+ir_type *    mature_type(ir_type *tp);
 
 /** Finalize type construction.
  *
@@ -92,7 +89,7 @@ type *       mature_type(type *tp);
  *
  * @param tp     The type to mature.
  */
-type *       mature_type_free(type *tp);
+ir_type *    mature_type_free(ir_type *tp);
 
 /** Finalize type construction.
  *
@@ -109,16 +106,26 @@ type *       mature_type_free(type *tp);
  *
  * @param tp     The type to mature.
  */
-type *       mature_type_free_entities(type *tp);
+ir_type *    mature_type_free_entities(ir_type *tp);
+
+/**
+ * The interface type for the type identify module;
+ */
+typedef struct _type_identify_if_t {
+  compare_types_func_t *cmp;    /**< The function that should be used to compare two types.
+                                     If NULL, compare_strict() will be used. */
+  hash_types_func_t *hash;      /**< The function that should be used to calculate a hash
+                                     value of a type. If NULL, hash_name() will be used. */
+} type_identify_if_t;
 
 /**
  * Initialise the type identifier module.
  *
- * @param cmp   The function that should be used to compare two types.
- *              If NULL, compare_strict() will be used.
- * @param hash  The function that should be used to calculate a hash
- *              value of a type. If NULL, hash_name() will be used.
+ * @param ti_if    The interface functions for this module.
+ *
+ * If the parameter ti_if is NULL, the default functions compare_strict() and
+ * firm_hash_name() will be used.
  */
-void init_type_identify(compare_types_func_t *cmp, hash_types_func_t *hash);
+void init_type_identify(type_identify_if_t *ti_if);
 
 # endif /* _TYPE_IDENTIFY_H_ */