3 * File name: ir/tr/entity_t.h
4 * Purpose: Representation of all program known entities -- private header.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * entity.h: entities represent all program known objects.
18 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
20 * An entity is the representation of program known objects in Firm.
21 * The primary concept of entities is to represent members of complex
22 * types, i.e., fields and methods of classes. As not all programming
23 * language model all variables and methods as members of some class,
24 * the concept of entities is extended to cover also local and global
25 * variables, and arbitrary procedures.
27 * An entity always specifies the type of the object it represents and
28 * the type of the object it is a part of, the owner of the entity.
29 * Originally this is the type of the class of which the entity is a
31 * The owner of local variables is the procedure they are defined in.
32 * The owner of global variables and procedures visible in the whole
33 * program is a universally defined class type "GlobalType". The owner
34 * of procedures defined in the scope of an other procedure is the
35 * enclosing procedure.
44 /** A path in a compund graph. */
45 struct compound_graph_path {
46 firm_kind kind; /**< dynamic type tag for compound graph path. */
52 /** the type of an entity */
54 firm_kind kind; /**< dynamic type tag for entity. */
55 ident *name; /**< name of this entity */
56 ident *ld_name; /**< Unique name of this entity, i.e., the mangled
57 name. If the field is read before written a default
58 magling is applies. The name of the owner is prepended
59 to the name of the entity, separated by a underscore.
60 E.g., for a class `A' with field `a' this
61 is the ident for `A_a'. */
62 type *type; /**< The type of this entity, e.g., a method type, a
63 basic type of the language or a class itself */
64 type *owner; /**< The compound type (e.g. class type) this entity belongs to. */
65 ent_allocation allocation; /**< Distinguishes static and dynamically allocated
66 entities and some further cases. */
67 ent_visibility visibility; /**< Specifies visibility to external program
69 ent_variability variability; /**< Specifies variability of entities content */
70 ent_volatility volatility; /**< Specifies volatility of entities content */
71 ent_stickyness stickyness; /**< Specifies whether this entity is sticky */
72 int offset; /**< Offset in byte for this entity. Fixed when layout
73 of owner is determined. */
74 void *link; /**< To store some intermediate information */
75 unsigned long visit; /**< visited counter for walks of the type information */
76 struct dbg_info* dbi; /**< A pointer to information for debug support. */
78 /* ------------- fields for atomic entities ---------------*/
79 ir_node *value; /**< value if entity is not of variability uninitialized.
80 Only for atomic entities. */
82 /* ------------- fields for compound entities ---------------*/
83 ir_node **values; /**< constant values of compound entities. Only available if
84 variablility not uninitialized. Must be set for variability constant
86 compound_graph_path **val_paths; /**< paths corresponding to constant values. Only available if
87 variablility not uninitialized. Must be set for variability constant */
89 /* ------------- fields for entities owned by a class type ---------------*/
90 entity **overwrites; /**< A list of entities this entity overwrites. */
91 entity **overwrittenby; /**< A list of entities that overwrite this entity. */
93 /* ------------- fields for methods ---------------*/
94 enum peculiarity peculiarity;
95 ir_graph *irg; /**< If (type == method_type) this is the corresponding irg.
96 The ir_graph constructor automatically sets this field.
97 Yes, it must be here. */
99 int nr; /**< a unique node number for each node to make output
104 INLINE long get_entity_nr(entity *ent);
106 # endif /* _ENTITY_T_H_ */