*** empty log message ***
[libfirm] / ir / tr / entity.h
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Martin Trapp, Christian Schaefer,
5 **          Goetz Lindenmaier
6 **
7 ** entity.h: declarations for entity
8 */
9
10 # ifndef _ENTITY_H_
11 # define _ENTITY_H_
12
13 # include "ident.h"
14 # include "type.h"
15
16 /*******************************************************************/
17 /** general                                                       **/
18 /*******************************************************************/
19
20 /* initalize entity module */
21 void init_entity (void);
22
23 /*******************************************************************/
24 /** ENTITY                                                        **/
25 /*******************************************************************/
26
27 typedef struct entity {
28   firm_kind kind;
29   ident *name;          /* name of this entity */
30   ident *ld_name;       /* Unique name of this entity, i.e., the mangled
31                            name.  E.g., for a class `A' with field `a' this
32                            is the ident for `A_a'. */
33   type *type;           /* The type of this entity, e.g., a method type, a
34                            basic type of the language or a class itself */
35   type *owner;          /* The class this entity belongs to */
36   /* for methods *
37   ir_graph *irg;        * If (type == method_type) this is the corresponding irg.
38                            The ir_graph constructor automatically sets this field.
39                            @@@ Does this go here, or should it be in type_mehtod,
40                            or should Call have an attribute ent?? */
41   /* Do we need to remember the initializer of fields? */
42   unsigned long visit;  /* visited counter for walks of the type information */
43 } entity;
44
45 /* create a new entity */
46 entity   *new_entity (type *owner, ident *name, type *type);
47
48 /* manipulate fields of entity */
49 char     *get_entity_name     (entity *);
50 ident    *get_entity_ident    (entity *);
51
52 /*
53 char     *get_entity_ld_name  (entity *);
54 char     *get_entity_ld_ident (entity *);
55 void      set_entity_ld_name  (entity *, char *ld_name);
56 void      set_entity_ld_ident (entity *, ident *ld_ident);
57 */
58
59 type     *get_entity_owner (entity *);
60 void      set_entity_owner (entity *, type *);
61 inline void  assert_legal_owner_of_ent(type *);
62
63 type     *get_entity_type (entity *);
64 void      set_entity_type (entity *, type *);
65
66 /* The entity knows the corresponding irg if the entity is a method.
67    This allows to get from a Call to the called irg. *
68 ir_graph *get_entity_irg(entity *ent);
69 void      set_entity_irg(entity *ent, ir_graph *irg);
70 */
71
72 # endif /* _ENTITY_H_ */