From 91ba1eff56d080774e7e40c31c6570344d23b3d2 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 7 Jan 2007 16:39:21 +0000 Subject: [PATCH] is_SubClass_of() check only once for transitive closure state [r8494] --- ir/tr/tr_inheritance.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ir/tr/tr_inheritance.c b/ir/tr/tr_inheritance.c index b8656dd16..9abc5f969 100644 --- a/ir/tr/tr_inheritance.c +++ b/ir/tr/tr_inheritance.c @@ -471,17 +471,9 @@ ir_entity *get_entity_trans_overwrites_next (ir_entity *ent) { /* Classify pairs of types/entities in the inheritance relations. */ /* ----------------------------------------------------------------------- */ -/* Returns true if low is subclass of high. */ -int is_SubClass_of(ir_type *low, ir_type *high) { +/** Returns true if low is subclass of high. */ +static int check_is_SubClass_of(ir_type *low, ir_type *high) { int i, n_subtypes; - assert(is_Class_type(low) && is_Class_type(high)); - - if (low == high) return 1; - - if (get_irp_inh_transitive_closure_state() == inh_transitive_closure_valid) { - pset *m = get_type_map(high, d_down); - return pset_find_ptr(m, low) ? 1 : 0; - } /* depth first search from high downwards. */ n_subtypes = get_class_n_subtypes(high); @@ -494,6 +486,19 @@ int 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)); + + if (low == high) return 1; + + if (get_irp_inh_transitive_closure_state() == inh_transitive_closure_valid) { + pset *m = get_type_map(high, d_down); + return pset_find_ptr(m, low) ? 1 : 0; + } + return check_is_SubClass_of(low, high); +} + /* Subclass check for pointers to classes. * -- 2.20.1