tpo_enumeration, /**< An enumeration type. */
tpo_pointer, /**< A pointer type. */
tpo_primitive, /**< A primitive type. */
- tpo_id, /**< Special Id tag used for type replacement. */
tpo_code, /**< a piece of code (a basic block) */
tpo_none, /**< Special type for the None type. */
tpo_unknown, /**< Special code for the Unknown type. */
- tpo_max /* not a type opcode */
+ tpo_last = tpo_unknown /* not a type opcode */
} tp_opcode;
/**
* this is only the kind name, an enum for case-switching and some
* internal values.
*
- * @see get_tpop_name(), get_tpop_code(), get_tpop_ident()
+ * @see get_tpop_name(), get_tpop_code()
*/
typedef struct tp_op tp_op;
*/
tp_opcode get_tpop_code(const tp_op *op);
-/**
- * Returns the ident for the type opcode.
- *
- * @param op The type opcode to get the ident from.
- * @return The ident.
- */
-ident *get_tpop_ident(const tp_op *op);
-
/**
* This type opcode marks that the corresponding type is a class type.
*
*/
void types_calc_finalization(void);
+/**
+ * Checks if a type already exists in the program and returns the existing
+ * type.
+ * @param type The type to check
+ * @param free_from_obst free type from type obst (only legal if nothing
+ * else was allocated since the type allocation)
+ */
+ir_type *identify_type(ir_type *type, int free_from_obst);
+
#endif
const tp_op *type_enumeration; const tp_op *get_tpop_enumeration(void) { return type_enumeration; }
const tp_op *type_pointer; const tp_op *get_tpop_pointer (void) { return type_pointer; }
const tp_op *type_primitive; const tp_op *get_tpop_primitive (void) { return type_primitive; }
-const tp_op *type_id; const tp_op *get_tpop_id (void) { return type_id; }
const tp_op *tpop_code; const tp_op *get_tpop_code_type (void) { return tpop_code; }
const tp_op *tpop_none; const tp_op *get_tpop_none (void) { return tpop_none; }
const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; }
type_pointer = new_tpop(tpo_pointer , ID("pointer"), 0, sizeof (ptr_attr), &pointer_ops);
type_primitive = new_tpop(tpo_primitive , ID("primitive"), 0, sizeof (pri_attr), &null_ops);
tpop_code = new_tpop(tpo_code , ID("code"), 0, /* sizeof (non_attr) */ 0, &null_ops);
- type_id = new_tpop(tpo_id , ID("type_id"), 0, /* sizeof (id_attr) */ 0, &null_ops);
tpop_none = new_tpop(tpo_none , ID("None"), 0, /* sizeof (non_attr) */ 0, &pseudo_ops);
tpop_unknown = new_tpop(tpo_unknown , ID("Unknown"), 0, /* sizeof (ukn_attr) */ 0, &pseudo_ops);
}
free_tpop(type_pointer ); type_pointer = NULL;
free_tpop(type_primitive ); type_primitive = NULL;
free_tpop(tpop_code ); tpop_code = NULL;
- free_tpop(type_id ); type_id = NULL;
free_tpop(tpop_none ); tpop_none = NULL;
free_tpop(tpop_unknown ); tpop_unknown = NULL;
}
return _get_tpop_code(op);
}
-ident *(get_tpop_ident)(const tp_op *op) {
- return _get_tpop_ident(op);
-}
-
/* returns the attribute size of the operator. */
int (get_tpop_attr_size)(const tp_op *op) {
return _get_tpop_attr_size(op);