X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Ftrouts.c;h=42c07b08f128ca24df99884afc3a03599086cc01;hb=ff0e8d7fcb34481652f0bf521ba04b1eca5e2106;hp=229333c0e7d2a61edb770e00be43e400e9d483ee;hpb=9ab9464c184c44e526fe3ec43012070bd0fccfe5;p=libfirm diff --git a/ir/ana/trouts.c b/ir/ana/trouts.c index 229333c0e..42c07b08f 100644 --- a/ir/ana/trouts.c +++ b/ir/ana/trouts.c @@ -30,6 +30,10 @@ static pmap *type_cast_map = NULL; static pmap *type_pointertype_map = NULL; static pmap *type_arraytype_map = NULL; +/** + * Return a flexible array containing all IR-nodes + * that access a given entity. + */ static ir_node **get_entity_access_array(entity *ent) { ir_node **res; if (!entity_access_map) entity_access_map = pmap_create(); @@ -49,6 +53,10 @@ void set_entity_access_array(entity *ent, ir_node **accs) { pmap_insert(entity_access_map, (void *)ent, (void *)accs); } +/** + * Return a flexible array containing all IR-nodes + * that reference a given entity. + */ static ir_node **get_entity_reference_array(entity *ent) { ir_node **res; if (!entity_reference_map) entity_reference_map = pmap_create(); @@ -68,6 +76,10 @@ void set_entity_reference_array(entity *ent, ir_node **refs) { pmap_insert(entity_reference_map, (void *)ent, (void *)refs); } +/** + * Return a flexible array containing all IR-nodes + * that allocate a given type. + */ static ir_node **get_type_alloc_array(ir_type *tp) { ir_node **res; if (!type_alloc_map) type_alloc_map = pmap_create(); @@ -87,6 +99,10 @@ void set_type_alloc_array(ir_type *tp, ir_node **alls) { pmap_insert(type_alloc_map, (void *)tp, (void *)alls); } +/** + * Return a flexible array containing all Cast-nodes + * that "create" a given type. + */ static ir_node **get_type_cast_array(ir_type *tp) { ir_node **res; if (!type_cast_map) type_cast_map = pmap_create(); @@ -97,15 +113,19 @@ static ir_node **get_type_cast_array(ir_type *tp) { res = NEW_ARR_F(ir_node *, 0); pmap_insert(type_cast_map, (void *)tp, (void *)res); } - return res; } + void set_type_cast_array(ir_type *tp, ir_node **alls) { ir_node **old = pmap_get(type_cast_map, (void *)tp); if (old != alls) pmap_insert(type_cast_map, (void *)tp, (void *)alls); } +/** + * Return a flexible array containing all pointer + * types that points-to a given type. + */ static ir_type **get_type_pointertype_array(ir_type *tp) { ir_type **res; if (!type_pointertype_map) type_pointertype_map = pmap_create(); @@ -125,6 +145,10 @@ void set_type_pointertype_array(ir_type *tp, ir_type **pts) { pmap_insert(type_pointertype_map, (void *)tp, (void *)pts); } +/** + * Return a flexible array containing all array + * types that have a given type as element type. + */ static ir_type **get_type_arraytype_array(ir_type *tp) { ir_type **res; if (!type_arraytype_map) type_arraytype_map = pmap_create(); @@ -433,16 +457,17 @@ static void init_trouts(void) { } -/* The entities that can be accessed by this Sel node. */ +/** The number of entities that can be accessed by this Sel node. */ static int get_Sel_n_accessed_entities(ir_node *sel) { return 1; } +/** The entity that cat be accessed by this Sel node. */ static entity *get_Sel_accessed_entity(ir_node *sel) { return get_Sel_entity(sel); } -/* An addr node is a SymConst or a Sel. */ +/** An addr node is a SymConst or a Sel. */ static int get_addr_n_entities(ir_node *addr) { int n_ents; @@ -464,15 +489,15 @@ static int get_addr_n_entities(ir_node *addr) { return n_ents; } -/* An addr node is a SymConst or a Sel. - If Sel follow to outermost of compound. */ +/** An addr node is a SymConst or a Sel. + If Sel follow to outermost of compound. */ static entity *get_addr_entity(ir_node *addr, int pos) { entity *ent; switch (get_irn_opcode(addr)) { case iro_Sel: /* Treat jack array sels? They are compounds! Follow to outermost entity. */ - while (get_irn_op(get_Sel_ptr(addr)) == op_Sel) { + while (is_Sel(get_Sel_ptr(addr))) { addr = get_Sel_ptr(addr); } assert (0 <= pos && pos < get_Sel_n_accessed_entities(addr)); @@ -517,7 +542,7 @@ static void chain_accesses(ir_node *n, void *env) { addr = get_memop_ptr(n); } else if (get_irn_op(n) == op_Call) { addr = get_Call_ptr(n); - if (get_irn_op(addr) != op_Sel) return; /* Sels before Calls mean a Load / polymorphic Call. */ + if (! is_Sel(addr)) return; /* Sels before Calls mean a Load / polymorphic Call. */ } else { return; } @@ -559,9 +584,8 @@ void compute_trouts(void) { init_trouts(); /* Compute outs for irnodes. */ - for (i=0; i < n_irgs; i++) { - current_ir_graph = get_irp_irg(i); - irg_walk_graph(current_ir_graph, NULL, chain_accesses, NULL); + for (i = 0; i < n_irgs; i++) { + irg_walk_graph(get_irp_irg(i), NULL, chain_accesses, NULL); } walk_const_code(NULL, chain_accesses, NULL);