1 /*10 2002/03/19 13:08:33
2 * Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
9 * entity.h: entities represent all program known objects.
11 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
13 * An entity is the representation of program known objects in Firm.
14 * The primary concept of entities is to represent members of complex
15 * types, i.e., fields and methods of classes. As not all programming
16 * language model all variables and methods as members of some class,
17 * the concept of entities is extended to cover also local and global
18 * variables, and arbitrary procedures.
20 * An entity always specifies the type of the object it represents and
21 * the type of the object it is a part of, the owner of the entity.
22 * Originally this is the type of the class of which the entity is a
24 * The owner of local variables is the procedure they are defined in.
25 * The owner of global variables and procedures visible in the whole
26 * program is a universally defined class type "GlobalType". The owner
27 * of procedures defined in the scope of an other procedure is the
28 * enclosing procedure.
38 /** A path in a compund graph. */
39 struct compound_graph_path {
40 firm_kind kind; /**< dynamic type tag for compound graph path. */
46 /** the type of an entity */
48 firm_kind kind; /**< dynamic type tag for entity. */
49 ident *name; /**< name of this entity */
50 ident *ld_name; /**< Unique name of this entity, i.e., the mangled
51 name. If the field is read before written a default
52 magling is applies. The name of the owner is prepended
53 to the name of the entity, separated by a underscore.
54 E.g., for a class `A' with field `a' this
55 is the ident for `A_a'. */
56 type *type; /**< The type of this entity, e.g., a method type, a
57 basic type of the language or a class itself */
58 type *owner; /**< The compound type (e.g. class type) this entity belongs to. */
59 ent_allocation allocation; /**< Distinguishes static and dynamically allocated
60 entities and some further cases. */
61 ent_visibility visibility; /**< Specifies visibility to external program
63 ent_variability variability; /**< Specifies variability of entities content */
64 ent_volatility volatility; /**< Specifies volatility of entities content */
65 int offset; /**< Offset in byte for this entity. Fixed when layout
66 of owner is determined. */
67 void *link; /**< To store some intermediate information */
68 unsigned long visit; /**< visited counter for walks of the type information */
69 struct dbg_info* dbi; /**< A pointer to information for debug support. */
71 /* ------------- fields for atomic entities ---------------*/
72 ir_node *value; /**< value if entity is not of variability uninitialized.
73 Only for atomic entities. */
75 /* ------------- fields for compound entities ---------------*/
76 ir_node **values; /**< constant values of compound entities. Only available if
77 variablility not uninitialized. Must be set for variability constant
79 compound_graph_path **val_paths; /**< paths corresponding to constant values. Only available if
80 variablility not uninitialized. Must be set for variability constant */
82 /* ------------- fields for entities owned by a class type ---------------*/
83 entity **overwrites; /**< A list of entities this entity overwrites. */
84 entity **overwrittenby; /**< A list of entities that overwrite this entity. */
86 /* ------------- fields for methods ---------------*/
87 enum peculiarity peculiarity;
88 ir_graph *irg; /**< If (type == method_type) this is the corresponding irg.
89 The ir_graph constructor automatically sets this field.
90 Yes, it must be here. */
92 int nr; /**< a unique node number for each node to make output
97 INLINE long get_entity_nr(entity *ent);
99 # endif /* _ENTITY_T_H_ */