X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftrvrfy.c;h=21054ecd20beca642d20b9ecf1e46af478ba41d3;hb=217c4f3a0ffc115825dbebb2270ab1d20c246e97;hp=9a8b8aa2ebf2a752614ce21cdabf5ca4f6e908da;hpb=084d37c1ed884f40b4eb703e87a661f5a520c92a;p=libfirm diff --git a/ir/tr/trvrfy.c b/ir/tr/trvrfy.c index 9a8b8aa2e..21054ecd2 100644 --- a/ir/tr/trvrfy.c +++ b/ir/tr/trvrfy.c @@ -152,7 +152,7 @@ static int constants_on_wrong_irg(entity *ent) { if (get_atomic_ent_value(ent)) return constant_on_wrong_irg(get_atomic_ent_value(ent)); else if (get_entity_visibility(ent) != visibility_external_allocated) - assert((is_class_type(get_entity_owner(ent)) && + assert((is_Class_type(get_entity_owner(ent)) && get_class_peculiarity(get_entity_owner(ent)) == peculiarity_description) && "Value in constant atomic entity not set."); } @@ -168,27 +168,54 @@ static int constants_on_wrong_irg(entity *ent) { * != 0 else */ static int check_entity(entity *ent) { + int rem_vpi; + type *tp = get_entity_type(ent); + type *owner = get_entity_owner(ent); + current_ir_graph = get_const_code_irg(); if (constants_on_wrong_irg(ent)) { assert(0 && "Contants placed on wrong IRG"); return error_const_on_wrong_irg; } + rem_vpi = get_visit_pseudo_irgs(); + set_visit_pseudo_irgs(1); if ((get_entity_peculiarity(ent) == peculiarity_existent) && (get_entity_visibility(ent) != visibility_external_allocated) && - (is_method_type(get_entity_type(ent))) && + (is_Method_type(get_entity_type(ent))) && (!get_entity_irg(ent) || !(is_ir_graph(get_entity_irg(ent))))) { assert(0 && "Method ents with pec_exist must have an irg"); return error_existent_entity_without_irg; } + set_visit_pseudo_irgs(rem_vpi); + /* Originally, this test assumed, that only method entities have + pec_inh. As I changed this, I have to test for method type before + doing the test. */ if (get_entity_peculiarity(ent) == peculiarity_inherited) { - entity *impl = get_SymConst_entity(get_atomic_ent_value(ent)); - assert(get_entity_peculiarity(impl) == peculiarity_existent && - "inherited entities must have constant pointing to existent entity."); + if (is_Method_type(get_entity_type(ent))) { + entity *impl = get_SymConst_entity(get_atomic_ent_value(ent)); + assert(get_entity_peculiarity(impl) == peculiarity_existent && + "inherited method entities must have constant pointing to existent entity."); + } } - return 0; + /* Entities in global type are not dynamic or automatic allocated. */ + if (owner == get_glob_type()) { + assert(get_entity_allocation(ent) != allocation_dynamic && + get_entity_allocation(ent) != allocation_automatic); + } + + if (get_entity_variability(ent) != variability_uninitialized) { + if (is_atomic_type(tp)) { + ir_node *val = get_atomic_ent_value(ent); + if (val) + assert(get_irn_mode(val) == get_type_mode(tp) && + "Mode of constant in entity must match type."); + } + } + + return no_error; } /*