From aee537d3a7765763d1d5040c9a16faf3396133b9 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 2 Jan 2010 11:32:35 +0000 Subject: [PATCH] remove the unused 'ident' type, remove tpo_max add tpo_last [r26873] --- include/libfirm/adt/hashptr.h | 5 +++++ include/libfirm/typerep.h | 22 +++++++++++----------- ir/ir/irdumptxt.c | 1 - ir/tr/tpop.c | 7 ------- ir/tr/type_t.h | 6 ------ ir/tr/typewalk.c | 5 ----- 6 files changed, 16 insertions(+), 30 deletions(-) diff --git a/include/libfirm/adt/hashptr.h b/include/libfirm/adt/hashptr.h index 7a369c5fe..6826041cb 100644 --- a/include/libfirm/adt/hashptr.h +++ b/include/libfirm/adt/hashptr.h @@ -64,6 +64,11 @@ static inline unsigned firm_fnv_hash_str(const char *data) */ #define HASH_PTR(ptr) ((unsigned)(((char *) (ptr) - (char *)0) >> 3)) +static inline unsigned hash_ptr(const void *ptr) +{ + return HASH_PTR(ptr); +} + /** * Hash a string. * @param str The string (can be const). diff --git a/include/libfirm/typerep.h b/include/libfirm/typerep.h index 7160e27b7..23d1c7d18 100644 --- a/include/libfirm/typerep.h +++ b/include/libfirm/typerep.h @@ -673,11 +673,10 @@ typedef enum { 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; /** @@ -686,7 +685,7 @@ typedef enum { * 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; @@ -707,14 +706,6 @@ const char *get_tpop_name(const tp_op *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. * @@ -2563,4 +2554,13 @@ void walk_types_entities(ir_type *tp, entity_walk_func *doit, void *env); */ 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 diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 67234704f..7f2267e44 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -1286,7 +1286,6 @@ void dump_type_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity) { } break; - case tpo_id: case tpo_none: case tpo_unknown: fprintf(F, "\n"); diff --git a/ir/tr/tpop.c b/ir/tr/tpop.c index aecddcdaf..0184bbf08 100644 --- a/ir/tr/tpop.c +++ b/ir/tr/tpop.c @@ -38,7 +38,6 @@ const tp_op *type_array; const tp_op *get_tpop_array (void) { retur 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; } @@ -179,7 +178,6 @@ void init_tpop(void) { 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); } @@ -198,7 +196,6 @@ void finish_tpop(void) { 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; } @@ -212,10 +209,6 @@ tp_opcode (get_tpop_code)(const tp_op *op) { 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); diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index 486b4494f..7088a92be 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -119,12 +119,6 @@ typedef struct { ir_type *base_type; /**< For bitfield types: The base primitive type, NULL else. */ } pri_attr; - -/* -typedef struct { * No private attr, must be smaller than others! * -} id_attr; -*/ - /** General type attributes. */ typedef union { cls_attr ca; /**< Attributes of a class type */ diff --git a/ir/tr/typewalk.c b/ir/tr/typewalk.c index 9fcfbcff0..f20857d3b 100644 --- a/ir/tr/typewalk.c +++ b/ir/tr/typewalk.c @@ -209,13 +209,11 @@ static void do_type_walk(type_or_ent tore, case tpo_code: case tpo_primitive: - case tpo_id: case tpo_none: case tpo_unknown: /* a leave. */ break; case tpo_uninitialized: - case tpo_max: assert(0 && "Faulty type"); break; } @@ -400,7 +398,6 @@ static void type_walk_s2s_2(type_or_ent tore, case tpo_enumeration: case tpo_pointer: case tpo_primitive: - case tpo_id: /* dont care */ break; default: @@ -494,7 +491,6 @@ type_walk_super_2(type_or_ent tore, case tpo_enumeration: case tpo_pointer: case tpo_primitive: - case tpo_id: /* don't care */ break; default: @@ -615,7 +611,6 @@ void walk_types_entities(ir_type *tp, case tpo_enumeration: case tpo_pointer: case tpo_primitive: - case tpo_id: default: break; } -- 2.20.1