added access routines for new flag in type_class struct
[libfirm] / ir / tr / entity.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 # ifndef _ENTITY_H_
30 # define _ENTITY_H_
31
32 # include "ident.h"
33
34 /*******************************************************************/
35 /** general                                                       **/
36 /*******************************************************************/
37
38 /* initalize entity module */
39 void init_entity (void);
40
41 /*******************************************************************/
42 /** ENTITY                                                        **/
43 /*******************************************************************/
44
45 #ifndef _IR_GRAPH_TYPEDEF_
46 #define _IR_GRAPH_TYPEDEF_
47 /* to resolve recursion between entity.h and irgraph.h */
48 typedef struct ir_graph ir_graph;
49 #endif
50
51 #ifndef _TYPE_TYPEDEF_
52 #define _TYPE_TYPEDEF_
53 /* to resolve recursion between entity.h and irgraph.h */
54 typedef union type type;
55 #endif
56
57 typedef struct entity entity;
58
59 /* create a new entity */
60 entity   *new_entity (type *owner, ident *name, type *type);
61
62 /* manipulate fields of entity */
63 char     *get_entity_name     (entity *ent);
64 ident    *get_entity_ident    (entity *ent);
65
66 ident    *get_entity_ld_name  (entity *ent);
67
68 /*
69 char     *get_entity_ld_name  (entity *ent);
70 void      set_entity_ld_name  (entity *ent, char *ld_name);
71
72 ident    *get_entity_ld_ident (entity *ent);
73 void      set_entity_ld_ident (entity *ent, ident *ld_ident);
74 */
75
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);
79
80 type     *get_entity_type (entity *ent);
81 void      set_entity_type (entity *ent, type *type);
82
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);
87
88
89 # endif /* _ENTITY_H_ */