2 ** Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
3 ** All rights reserved.
5 ** Authors: Martin Trapp, Christian Schaefer,
8 ** entity.h: entities represent all program known objects.
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.
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
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.
35 /*******************************************************************/
37 /*******************************************************************/
39 /* initalize entity module */
40 void init_entity (void);
42 /*******************************************************************/
44 /*******************************************************************/
46 #ifndef _IR_GRAPH_TYPEDEF_
47 #define _IR_GRAPH_TYPEDEF_
48 /* to resolve recursion between entity.h and irgraph.h */
49 typedef struct ir_graph ir_graph;
52 #ifndef _ENTITY_TYPEDEF_
53 #define _ENTITY_TYPEDEF_
54 /* to resolve recursion between entity.h and type.h */
55 typedef struct entity entity;
58 /* Creates a new entity.
59 Automatically inserts the entity as a member of owner. */
60 entity *new_entity (type *owner, ident *name, type *type);
62 /* manipulate fields of entity */
63 const char *get_entity_name (entity *ent);
64 ident *get_entity_ident (entity *ent);
65 /* returns the mangled name of the entity */
66 ident *get_entity_ld_name (entity *ent);
69 char *get_entity_ld_name (entity *ent);
70 void set_entity_ld_name (entity *ent, char *ld_name);
72 ident *get_entity_ld_ident (entity *ent);
73 void set_entity_ld_ident (entity *ent, ident *ld_ident);
76 type *get_entity_owner (entity *ent);
77 void set_entity_owner (entity *ent, type *owner);
78 inline void assert_legal_owner_of_ent(type *owner);
80 type *get_entity_type (entity *ent);
81 void set_entity_type (entity *ent, type *type);
83 /* The entity knows the corresponding irg if the entity is a method.
84 This allows to get from a Call to the called irg. */
85 ir_graph *get_entity_irg(entity *ent);
86 void set_entity_irg(entity *ent, ir_graph *irg);
89 # endif /* _ENTITY_H_ */