X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Ftrouts.h;h=8556b2d548336a1e1761bd5a025d94761ad5f2c5;hb=ca63c180b7cc9b93f63877bf69e298bad45de6f1;hp=7bdcf8d358daba0ecf1c74b2f06d19fa3edecfb4;hpb=993376697dc65bdb0e069436520e92bbbadfd0a8;p=libfirm diff --git a/ir/ana/trouts.h b/ir/ana/trouts.h index 7bdcf8d35..8556b2d54 100644 --- a/ir/ana/trouts.h +++ b/ir/ana/trouts.h @@ -31,24 +31,24 @@ # ifndef _TROUTS_H_ # define _TROUTS_H_ -#include "type.h" -#include "entity.h" -#include "irnode.h" +#include "firm_types.h" +#include "irgraph.h" +/*-----------------------------------------------------------------*/ +/* Accessing the trout datastructures. */ +/* These routines only work properly if firm is in state */ +/* trouts_consistent or trouts_inconsistent. */ +/*-----------------------------------------------------------------*/ -/*------------------------------------------------------------------*/ -/* Accessing the trout datastructures. */ -/* These routines only work properly if firm is in state */ -/* trouts_consistent or trouts_inconsistent. */ -/*------------------------------------------------------------------*/ - +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* entities */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /** Number of Load/Store nodes that possibly access this entity. */ int get_entity_n_accesses(entity *ent); /** Load/Store node that possibly access this entity. */ ir_node *get_entity_access(entity *ent, int pos); - /** Number of references to an entity, in form of SymConst/Sel. * Including references from constant entities and the like. */ int get_entity_n_references(entity *ent); @@ -56,25 +56,75 @@ int get_entity_n_references(entity *ent); * Including references from constants. */ ir_node *get_entity_reference(entity *ent, int pos); +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* types */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/** Number of Alloc nodes that create an instance of this type. */ +int get_type_n_allocs(ir_type *tp); +/** Alloc node that create an instance of this type. */ +ir_node *get_type_alloc(ir_type *tp, int pos); + +/** Number of Cast nodes that cast a pointer to this type. */ +int get_type_n_casts(ir_type *tp); +/** Cast node that cast a pointer to this type. */ +ir_node *get_type_cast(ir_type *tp, int pos); +void add_type_cast(ir_type *tp, ir_node *cast); +/** Return number of upcasts. O(#casts). */ +int get_class_n_upcasts(ir_type *clss); +/** Return number of downcasts. O(#casts). */ +int get_class_n_downcasts(ir_type *clss); -/** Number of Alloc nodes that create an instance of this type */ -int get_type_n_allocations(type *tp); -/** Alloc node that create an instance of this type */ -ir_node *get_type_allocation(type *tp, int pos); +/* Access all pointer types that point to tp. */ +int get_type_n_pointertypes_to(ir_type *tp); +ir_type *get_type_pointertype_to(ir_type *tp, int pos); +void add_type_pointertype_to(ir_type *tp, ir_type *ptp); +/* Access all array types that contain elements of type tp. + * Does not find subarrays, e.g., int[] being element of int[][] + * for multi dimensional arrays. */ +int get_type_n_arraytypes_of(ir_type *tp); +ir_type *get_type_arraytype_of(ir_type *tp, int pos); +void add_type_arraytype_of(ir_type *tp, ir_type *atp); + +/* @@@ TODO: compute all entities that use a type. */ + /*------------------------------------------------------------------*/ /* Building and Removing the trout datastructure */ /*------------------------------------------------------------------*/ +/** The state of the tr_out datastructure. + * + * We reuse the enum of irouts. + * @see irouts.h. */ +irg_outs_state get_trouts_state(void); +/** Set the tr out state to inconsistent if it is consistent. */ +void set_trouts_inconsistent(void); /** Compute the outs of types and entities. * * Collects all reference from irnodes to types or entities in the - * corresponding types/entities. + * corresponding types/entities. Further reverses references between + * types and entities. * - * @todo @@@ We need a flag that signs the consistency of the out information. */ + * Annotates the following nodes: + * Alloc --> get_Alloc_type() + * Cast --> get_Cast_type() + * Sel --> get_Sel_entity() + * SymConst --> get_SymConst_entity() + * Load(addr) --> get_addr_entity() \ ent von SymConst, oder falls Sel: ent von + * Store(addr) --> get_addr_entity() / outermost im compound. Ansonsten: nirgends. + * d.h. wir bekommen die array Elementzugriffe + * an die jack array Klasse annotiert. + * Call(Sel) --> get_Sel_entity() // ev. Tabellenzugriff --> Load. + * + * type --> pointer type refering to this type. + * type --> entity of this type. @@@ to be implemented. + * + * Sets trout state to outs_consistent. + */ void compute_trouts(void); /** Free trout data. */