move set_entity_irg to private API
[libfirm] / ir / tr / tr_inheritance.c
index f1c7d9c..04e7452 100644 (file)
@@ -21,7 +21,6 @@
  * @file    tr_inheritance.c
  * @brief   Utility routines for inheritance representation
  * @author  Goetz Lindenmaier
- * @version $Id$
  */
 #include "config.h"
 
@@ -35,7 +34,7 @@
 #include "irgwalk.h"
 #include "irflag.h"
 
-DEBUG_ONLY(static firm_dbg_module_t *dbg);
+DEBUG_ONLY(static firm_dbg_module_t *dbg;)
 
 /* ----------------------------------------------------------------------- */
 /* Resolve implicit inheritance.                                           */
@@ -55,7 +54,7 @@ static void copy_entities_from_superclass(ir_type *clss, void *env)
        size_t k;
        size_t l;
        int overwritten;
-       ir_type *super, *inhenttype;
+       ir_type *super;
        ir_entity *inhent, *thisent;
        mangle_inherited_name_func *mfunc = *(mangle_inherited_name_func **)env;
 
@@ -64,7 +63,6 @@ static void copy_entities_from_superclass(ir_type *clss, void *env)
                assert(is_Class_type(super) && "not a class");
                for (j = 0; j < get_class_n_members(super); j++) {
                        inhent = get_class_member(super, j);
-                       inhenttype = get_entity_type(inhent);
                        /* check whether inhent is already overwritten */
                        overwritten = 0;
                        for (k = 0; (k < get_class_n_members(clss)) && (overwritten == 0); k++) {
@@ -95,10 +93,6 @@ static void copy_entities_from_superclass(ir_type *clss, void *env)
        }
 }
 
-/* Resolve implicit inheritance.
- *
- *  Resolves the implicit inheritance supplied by firm.
- */
 void resolve_inheritance(mangle_inherited_name_func *mfunc)
 {
        if (!mfunc)
@@ -178,7 +172,7 @@ static int tr_inh_trans_cmp(const void *e1, const void *e2, size_t size)
  */
 static inline unsigned int tr_inh_trans_hash(const tr_inh_trans_tp *v)
 {
-       return HASH_PTR(v->kind);
+       return hash_ptr(v->kind);
 }
 
 /* This always completes successfully. */
@@ -343,18 +337,13 @@ static void compute_up_closure(ir_type *tp)
        }
 }
 
-/** Compute the transitive closure of the subclass/superclass and
- *  overwrites/overwrittenby relation.
- *
- *  This function walks over the ir (O(#types+#entities)) to compute the
- *  transitive closure.    */
 void compute_inh_transitive_closure(void)
 {
        size_t i, n_types = get_irp_n_types();
        free_inh_transitive_closure();
 
        /* The 'down' relation */
-       irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED);
+       irp_reserve_resources(irp, IRP_RESOURCE_TYPE_VISITED);
        inc_master_type_visited();  /* Inc twice: one if on stack, second if values computed. */
        inc_master_type_visited();
        for (i = 0; i < n_types; ++i) {
@@ -403,10 +392,9 @@ void compute_inh_transitive_closure(void)
        }
 
        irp->inh_trans_closure_state = inh_transitive_closure_valid;
-       irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED);
+       irp_free_resources(irp, IRP_RESOURCE_TYPE_VISITED);
 }
 
-/** Free memory occupied by the transitive closure information. */
 void free_inh_transitive_closure(void)
 {
        if (tr_inh_trans_set) {
@@ -473,7 +461,6 @@ ir_entity *get_entity_trans_overwrittenby_next(const ir_entity *ent)
 /* - overwrites ---------------------------------------------------------- */
 
 
-/** Iterate over all transitive overwritten entities. */
 ir_entity *get_entity_trans_overwrites_first(const ir_entity *ent)
 {
        assert_valid_state();
@@ -507,7 +494,6 @@ static int check_is_SubClass_of(ir_type *low, ir_type *high)
        return 0;
 }
 
-/* Returns true if low is subclass of high. */
 int is_SubClass_of(ir_type *low, ir_type *high)
 {
        assert(is_Class_type(low) && is_Class_type(high));
@@ -521,13 +507,6 @@ int is_SubClass_of(ir_type *low, ir_type *high)
        return check_is_SubClass_of(low, high);
 }
 
-
-/* Subclass check for pointers to classes.
- *
- *  Dereferences at both types the same amount of pointer types (as
- *  many as possible).  If the remaining types are both class types
- *  and subclasses, returns true, else false.  Can also be called with
- *  two class types.  */
 int is_SubClass_ptr_of(ir_type *low, ir_type *high)
 {
        while (is_Pointer_type(low) && is_Pointer_type(high)) {
@@ -591,12 +570,6 @@ static ir_entity *do_resolve_ent_polymorphy(ir_type *dynamic_class, ir_entity *s
        return static_ent;
 }
 
-/* Resolve polymorphy in the inheritance relation.
- *
- * Returns the dynamically referenced entity if the static entity and the
- * dynamic type are given.
- * Search downwards in overwritten tree.
- */
 ir_entity *resolve_ent_polymorphy(ir_type *dynamic_class, ir_entity *static_ent)
 {
        ir_entity *res;
@@ -671,7 +644,6 @@ static void verify_irn_class_cast_state(ir_node *n, void *env)
        ccs_env             *ccs = (ccs_env *)env;
        ir_class_cast_state this_state = ir_class_casts_any;
        ir_type             *fromtype, *totype;
-       int                 ref_depth = 0;
 
        if (!is_Cast(n)) return;
 
@@ -681,7 +653,6 @@ static void verify_irn_class_cast_state(ir_node *n, void *env)
        while (is_Pointer_type(totype) && is_Pointer_type(fromtype)) {
                totype   = get_pointer_points_to_type(totype);
                fromtype = get_pointer_points_to_type(fromtype);
-               ref_depth++;
        }
 
        if (!is_Class_type(totype)) return;
@@ -711,7 +682,6 @@ static void verify_irn_class_cast_state(ir_node *n, void *env)
                ccs->worst_situation = this_state;
 }
 
-/** Verify that the graph meets requirements of state set. */
 void verify_irg_class_cast_state(ir_graph *irg)
 {
        ccs_env env;