fixed doxygen comments
[libfirm] / ir / tr / entity_t.h
1 /*10 2002/03/19 13:08:33
2 *  Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
3 *  All rights reserved.
4 */
5
6 /**
7 * @file entity_t.h
8 *
9 * entity.h:  entities represent all program known objects.
10 *
11 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
12 *
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.
19 *
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
23 *  member.
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.
29 */
30
31 /* $Id$ */
32
33 # ifndef _ENTITY_T_H_
34 # define _ENTITY_T_H_
35
36 # include "entity.h"
37
38 /** the type of an entity */
39 struct entity {
40   firm_kind kind;       /**< dynamic type tag for entity. */
41   ident *name;          /**< name of this entity */
42   ident *ld_name;       /**< Unique name of this entity, i.e., the mangled
43                            name.  If the field is read before written a default
44                            magling is applies.  The name of the owner is prepended
45                            to the name of the entity, separated by a underscore.
46                            E.g.,  for a class `A' with field `a' this
47                            is the ident for `A_a'. */
48   type *type;           /**< The type of this entity, e.g., a method type, a
49                            basic type of the language or a class itself */
50   type *owner;          /**< The compound type (e.g. class type) this entity belongs to. */
51   ent_allocation allocation;  /**< Distinguishes static and dynamically allocated
52                                  entities and some further cases. */
53   ent_visibility visibility;  /**< Specifies visibility to external program
54                                  fragments */
55   ent_variability variability;  /**< Specifies variability of entities content */
56   ent_volatility volatility;    /**< Specifies volatility of entities content */
57   int  offset;          /**< Offset in byte for this entity.  Fixed when layout
58                            of owner is determined.  */
59   void *link;           /**< To store some intermediate information */
60   unsigned long visit;  /**< visited counter for walks of the type information */
61   struct dbg_info* dbi;    /**< A pointer to information for debug support. */
62
63   /* ------------- fields for atomic entities  ---------------*/
64   ir_node *value;            /**< value if entity is not of variability uninitialized.
65                                Only for atomic entities. */
66
67   /* ------------- fields for compound entities ---------------*/
68   ir_node **values;     /**< constant values of compound entities. Only available if
69                           variablility not uninitialized.  Must be set for variability constant
70                            */
71   entity **val_ents;    /**< entities corresponding to constant values. Only available if
72                           variablility not uninitialized.  Must be set for variability constant */
73
74   /* ------------- fields for entities owned by a class type ---------------*/
75   entity **overwrites;  /**< A list of entities this entity overwrites. */
76   entity **overwrittenby;  /**< A list of entities that overwrite this entity.  */
77
78   /* ------------- fields for methods ---------------*/
79   enum peculiarity peculiarity;
80   ir_graph *irg;        /**< If (type == method_type) this is the corresponding irg.
81                            The ir_graph constructor automatically sets this field.
82                            Yes, it must be here. */
83 };
84
85
86 # endif /* _ENTITY_T_H_ */