remove the unused 'ident' type, remove tpo_max add tpo_last
authorMatthias Braun <matze@braunis.de>
Sat, 2 Jan 2010 11:32:35 +0000 (11:32 +0000)
committerMatthias Braun <matze@braunis.de>
Sat, 2 Jan 2010 11:32:35 +0000 (11:32 +0000)
[r26873]

include/libfirm/adt/hashptr.h
include/libfirm/typerep.h
ir/ir/irdumptxt.c
ir/tr/tpop.c
ir/tr/type_t.h
ir/tr/typewalk.c

index 7a369c5..6826041 100644 (file)
@@ -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).
index 7160e27..23d1c7d 100644 (file)
@@ -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
index 6723470..7f2267e 100644 (file)
@@ -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");
index aecddcd..0184bbf 100644 (file)
@@ -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);
index 486b449..7088a92 100644 (file)
@@ -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 */
index 9fcfbcf..f20857d 100644 (file)
@@ -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;
        }