out edges for entities and types
[libfirm] / ir / ana / trouts.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/trouts.h
4  * Purpose:     Reverse edges that reference types/entities.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     29.10.2004
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2004 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14 * @file trouts.h
15 *
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).
21 *
22 * @todo
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.
26 *
27 * @author Goetz Lindenmaier
28 *
29 */
30
31 # ifndef _TROUTS_H_
32 # define _TROUTS_H_
33
34 #include "type.h"
35 #include "entity.h"
36 #include "irnode.h"
37
38
39 /*------------------------------------------------------------------*/
40 /* Accessing the trout datastructures.                              */
41 /* These routines only work properly if firm is in state            */
42 /* trouts_consistent or trouts_inconsistent.                        */
43 /*------------------------------------------------------------------*/
44
45
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);
50
51
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);
58
59
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);
64
65
66
67 /*------------------------------------------------------------------*/
68 /* Building and Removing the trout datastructure                    */
69 /*------------------------------------------------------------------*/
70
71
72 void compute_trouts(void);
73
74 void free_trouts(void);
75
76
77 #endif /* _TROUTS_H_ */