X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftrvrfy.c;h=2aae2b2690a81e00b5eb4dd56df35e8a4ee8be0b;hb=20c028dc2eefd23898ecff42a8fdf9e1eef7c90b;hp=1ab66fe317ba54e79935b6c2890da7484c83a58f;hpb=4790b5e332567913525807500e308c3fb32e7e53;p=libfirm diff --git a/ir/tr/trvrfy.c b/ir/tr/trvrfy.c index 1ab66fe31..2aae2b269 100644 --- a/ir/tr/trvrfy.c +++ b/ir/tr/trvrfy.c @@ -122,7 +122,7 @@ static void on_irg_storage(ir_node *n, void *env) { } /** - * checks wheater a given constant IR node is NOT on the + * checks whether a given constant IR node is NOT on the * constant IR graph. */ static int constant_on_wrong_irg(ir_node *n) { @@ -145,7 +145,7 @@ static int constants_on_wrong_irg(entity *ent) { int i; for (i = 0; i < get_compound_ent_n_values(ent); i++) { if (constant_on_wrong_irg(get_compound_ent_value(ent, i))) - return 1; + return 1; } } else { /* Might not be set if entity belongs to a description or is external allocated. */ @@ -169,6 +169,8 @@ static int constants_on_wrong_irg(entity *ent) { */ 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)) { @@ -187,10 +189,30 @@ static int check_entity(entity *ent) { } 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."); + } + } + + /* 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;