minor changes to help with making the ajacs-jikes backend
[libfirm] / ir / tr / entity_t.h
1 /*
2 **  Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
3 **  All rights reserved.
4 **
5 **  Authors: Martin Trapp, Christian Schaefer,
6 **           Goetz Lindenmaier
7 **
8 **  entity.h:  entities represent all program known objects.
9 **
10 **  An entity is the representation of program known objects in Firm.
11 **  The primary concept of entities is to represent members of complex
12 **  types, i.e., fields and methods of classes.  As not all programming
13 **  language model all variables and methods as members of some class,
14 **  the concept of entities is extended to cover also local and global
15 **  variables, and arbitrary procedures.
16 **
17 **  An entity always specifies the type of the object it represents and
18 **  the type of the object it is a part of, the owner of the entity.
19 **  Originally this is the type of the class of which the entity is a
20 **  member.
21 **  The owner of local variables is the procedure they are defined in.
22 **  The owner of global variables and procedures visible in the whole
23 **  program is a universally defined class type "GlobalType".  The owner
24 **  of procedures defined in the scope of an other procedure is the
25 **  enclosing procedure.
26 **
27 */
28
29 /* $Id$ */
30
31 # ifndef _ENTITY_T_H_
32 # define _ENTITY_T_H_
33
34 # include "entity.h"
35
36 #ifndef _IR_GRAPH_TYPEDEF_
37 #define _IR_GRAPH_TYPEDEF_
38 /* to resolve recursion between entity.h and irgraph.h */
39 typedef struct ir_graph ir_graph;
40 #endif
41
42 struct entity {
43   firm_kind kind;
44   ident *name;          /* name of this entity */
45   ident *ld_name;       /* Unique name of this entity, i.e., the mangled
46                            name.  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 class this entity belongs to.  In case of local
51                            variables the method they are defined in. */
52   entity **overwrites;  /* A list of entities this entity overwrites.  */
53   ent_allocation allocation;  /* Distinguishes static and dynamically allocated
54                                  entities. */
55   ent_visibility visibility;  /* Specifies visibility to external program
56                                  fragments */
57   ent_variability variability;  /* Specifies variability of entities content */
58   ent_volatility volatility;    /* Specifies volatility of entities content */
59   ir_node *value;            /* value of atomic entity */
60   ir_node **values;     /* values of compound entities */
61   entity **val_ents;    /* entities corresponding to constant values */
62   int  offset;          /* Offset in byte for this entity.  Fixed when layout
63                            of owner is determined.  */
64   void *link;           /* To store some intermediate information */
65   /* for methods */
66   ir_graph *irg;        /* If (type == method_type) this is the corresponding irg.
67                            The ir_graph constructor automatically sets this field.
68                            @@@ Does this go here, or should it be in type_method,
69                            or should Call have an attribute ent??
70                            Yes, it must be here. */
71   unsigned long visit;  /* visited counter for walks of the type information */
72 };
73
74
75 # endif /* _ENTITY_T_H_ */