becopyopt: Inline the thin wrapper nodes_interfere(), so we do not need to fetch...
[libfirm] / include / libfirm / trouts.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief    Reverse edges that reference types/entities.
9  * @author   Goetz Lindenmaier
10  * @date     29.10.2004
11  */
12 #ifndef FIRM_ANA_TROUTS_H
13 #define FIRM_ANA_TROUTS_H
14
15 #include "firm_types.h"
16 #include "irgraph.h"
17
18 #include "begin.h"
19
20 /**
21  * @ingroup ir_type
22  * @defgroup trouts Reverse Type Edges
23  * Trouts list all uses of types and entities.
24  * Each type gets a list of all Alloc nodes allocating it.
25  * Each entity gets two lists:
26  *   - one containing all accesses (Load, (Call), Store),
27  *   - and one containing all uses to get a reference (Sel, SymConst).
28  * @{
29  */
30
31 /** Returns number of Load/Store nodes that possibly access entity @p entity. */
32 FIRM_API size_t get_entity_n_accesses(const ir_entity *entity);
33 /** Returns Load/Store node number @p pos that possibly accesses entity @p entity. */
34 FIRM_API ir_node *get_entity_access(const ir_entity *entity, size_t pos);
35
36 /** Returns number of references to entity @p entity, in form of SymConst/Sel,
37  * including references from constant entities and the like. */
38 FIRM_API size_t get_entity_n_references(const ir_entity *entity);
39 /** Returns reference number @p pos of references to an entity, in form of
40  * SymConst/Sel, including references from constants. */
41 FIRM_API ir_node *get_entity_reference(const ir_entity *entity, size_t pos);
42
43 /** Returns number of Alloc nodes that create an instance of type @p type. */
44 FIRM_API size_t get_type_n_allocs(const ir_type *type);
45 /** Returns Alloc node number @p pos that create an instance of type @p type. */
46 FIRM_API ir_node *get_type_alloc(const ir_type *type, size_t pos);
47
48 /** Returns number of pointertypes that point to type @p type. */
49 FIRM_API size_t get_type_n_pointertypes_to(const ir_type *type);
50 /** Returns pointer type number @p pos that points to type @p type. */
51 FIRM_API ir_type *get_type_pointertype_to(const ir_type *type, size_t pos);
52
53 /** Returns number of array types with element type @p type. */
54 FIRM_API size_t get_type_n_arraytypes_of(const ir_type *type);
55 /** Returns array type number @p pos with element type @p type. */
56 FIRM_API ir_type *get_type_arraytype_of(const ir_type *type, size_t pos);
57
58 /** Computes the outs of types and entities.
59  *
60  *  Collects all reference from irnodes to types or entities in the
61  *  corresponding types/entities.  Further reverses references between
62  *  types and entities.
63  *
64  *  Annotates the following nodes:
65  *    Alloc    --> get_Alloc_type()
66  *    Cast     --> get_Cast_type()
67  *    Sel      --> get_Sel_entity()
68  *    SymConst --> get_SymConst_entity()
69  *    Load(addr)  --> get_addr_entity() \  ent von SymConst, oder falls Sel: ent von
70  *    Store(addr) --> get_addr_entity() /  outermost im compound.  Ansonsten: nirgends.
71  *                                         d.h. wir bekommen die array Elementzugriffe
72  *                                         an die jack array Klasse annotiert.
73  *    Call(Sel)   --> get_Sel_entity()  // ev. Tabellenzugriff --> Load.
74  *
75  *   type --> pointer type refering to this type.
76  *   type --> entity of this type. @@@ to be implemented.
77  *
78  *  Sets trout state to outs_consistent.
79  */
80 FIRM_API void compute_trouts(void);
81
82 /** Frees trout data. */
83 FIRM_API void free_trouts(void);
84
85 /** @} */
86
87 #include "end.h"
88
89 #endif