3 * File name: ir/ana/trouts.h
4 * Purpose: Reverse edges that reference types/entities.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2004 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * Trouts list all uses of types and entities.
17 * Each type gets a list of all Alloc nodes allocating it.
18 * Each entity gets two lists:
19 * - one containing all accesses (Load, (Call), Store),
20 * - and one containing all uses to get a reference (Sel, SymConst).
23 * To list all uses of entities of a type, we also should list all
24 * static/automatic allocated entities in types. The Alloc nodes
25 * represent only the dynamic allocated entities.
27 * @author Goetz Lindenmaier
39 /*------------------------------------------------------------------*/
40 /* Accessing the trout datastructures. */
41 /* These routines only work properly if firm is in state */
42 /* trouts_consistent or trouts_inconsistent. */
43 /*------------------------------------------------------------------*/
46 /** Number of Load/Store nodes that possibly access this entity. */
47 int get_entity_n_accesses(entity *ent);
48 /** Load/Store node that possibly access this entity. */
49 ir_node *get_entity_access(entity *ent, int pos);
52 /** Number of references to an entity, in form of SymConst/Sel.
53 * Including references from constant entities and the like. */
54 int get_entity_n_references(entity *ent);
55 /** References to an entity, in form of SymConst/Sel
56 * Including references from constants. */
57 ir_node *get_entity_reference(entity *ent, int pos);
60 /** Number of Alloc nodes that create an instance of this type */
61 int get_type_n_allocations(type *tp);
62 /** Alloc node that create an instance of this type */
63 ir_node *get_type_allocation(type *tp, int pos);
67 /*------------------------------------------------------------------*/
68 /* Building and Removing the trout datastructure */
69 /*------------------------------------------------------------------*/
72 /** Compute the outs of types and entities.
74 * Collects all reference from irnodes to types or entities in the
75 * corresponding types/entities.
77 * @todo @@@ We need a flag that signs the consistency of the out information. */
78 void compute_trouts(void);
80 /** Free trout data. */
81 void free_trouts(void);
84 #endif /* _TROUTS_H_ */