1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer,
7 ** entity.h: declarations for entity
16 /*******************************************************************/
18 /*******************************************************************/
20 /* initalize entity module */
21 void init_entity (void);
23 /*******************************************************************/
25 /*******************************************************************/
27 #ifndef _IR_GRAPH_TYPEDEF_
28 #define _IR_GRAPH_TYPEDEF_
29 /* to resolve recursion between entity.h and irgraph.h */
30 typedef struct ir_graph ir_graph;
35 ident *name; /* name of this entity */
36 ident *ld_name; /* Unique name of this entity, i.e., the mangled
37 name. E.g., for a class `A' with field `a' this
38 is the ident for `A_a'. */
39 type *type; /* The type of this entity, e.g., a method type, a
40 basic type of the language or a class itself */
41 type *owner; /* The class this entity belongs to */
43 ir_graph *irg; /* If (type == method_type) this is the corresponding irg.
44 The ir_graph constructor automatically sets this field.
45 @@@ Does this go here, or should it be in type_mehtod,
46 or should Call have an attribute ent?? */
47 /* Do we need to remember the initializer of fields? */
48 unsigned long visit; /* visited counter for walks of the type information */
51 #ifndef _ENTITY_TYPEDEF_
52 #define _ENTITY_TYPEDEF_
53 /* to resolve recursion between entity.h and irgraph.h */
54 typedef struct entity entity;
57 /* create a new entity */
58 entity *new_entity (type *owner, ident *name, type *type);
60 /* manipulate fields of entity */
61 char *get_entity_name (entity *);
62 ident *get_entity_ident (entity *);
64 ident *get_entity_ld_name (entity *);
66 char *get_entity_ld_name (entity *);
67 ident *get_entity_ld_ident (entity *);
68 void set_entity_ld_name (entity *, char *ld_name);
69 void set_entity_ld_ident (entity *, ident *ld_ident);
72 type *get_entity_owner (entity *);
73 void set_entity_owner (entity *, type *);
74 inline void assert_legal_owner_of_ent(type *);
76 type *get_entity_type (entity *);
77 void set_entity_type (entity *, type *);
79 /* The entity knows the corresponding irg if the entity is a method.
80 This allows to get from a Call to the called irg. *
81 ir_graph *get_entity_irg(entity *ent);
82 void set_entity_irg(entity *ent, ir_graph *irg);
85 # endif /* _ENTITY_H_ */