X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firprofile.c;h=f9e8fd1561299188b2c8b56fd4ae68e9e8211e43;hb=b597c7fd473086ca6374b2abbdf129f595c156d0;hp=fbcf08fa0b47c5ff32be24144271ae92c177f694;hpb=9ab3d84833ffff735112b3a08558aa83258121ba;p=libfirm diff --git a/ir/ir/irprofile.c b/ir/ir/irprofile.c index fbcf08fa0..f9e8fd156 100644 --- a/ir/ir/irprofile.c +++ b/ir/ir/irprofile.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -172,6 +172,23 @@ fix_ssa(ir_node * bb, void * data) set_Load_mem(get_irn_link(get_irn_link(bb)), mem); } +static void add_constructor(ir_entity *method) +{ + ir_type *method_type = get_entity_type(method); + ident *id = id_unique("constructor_ptrt.%u"); + ir_type *ptr_type = new_type_pointer(id, method_type, mode_P_code); + + ir_type *constructors = get_segment_type(IR_SEGMENT_CONSTRUCTORS); + ident *ide = id_unique("constructor_ptr.%u"); + ir_entity *ptr = new_entity(constructors, ide, ptr_type); + ir_graph *irg = get_const_code_irg(); + ir_node *val = new_rd_SymConst_addr_ent(NULL, irg, mode_P_code, + method, NULL); + + set_entity_compiler_generated(ptr, 1); + set_entity_variability(ptr, variability_constant); + set_atomic_ent_value(ptr, val); +} /** * Generates a new irg which calls the initializer @@ -239,6 +256,8 @@ gen_initializer_irg(ir_entity * ent_filename, ir_entity * bblock_id, ir_entity * irg_finalize_cons(irg); + add_constructor(ent); + return irg; }