*** 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 #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;
31 #endif
32
33 struct entity {
34   firm_kind kind;
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 */
42   /* for methods */
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 */
49 };
50
51 #ifndef _ENTITY_TYPEDEF_
52 #define _ENTITY_TYPEDEF_
53 /* to resolve recursion between entity.h and irgraph.h */
54 typedef struct entity entity;
55 #endif
56
57 /* create a new entity */
58 entity   *new_entity (type *owner, ident *name, type *type);
59
60 /* manipulate fields of entity */
61 char     *get_entity_name     (entity *);
62 ident    *get_entity_ident    (entity *);
63
64 ident    *get_entity_ld_name  (entity *);
65 /*
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);
70 */
71
72 type     *get_entity_owner (entity *);
73 void      set_entity_owner (entity *, type *);
74 inline void  assert_legal_owner_of_ent(type *);
75
76 type     *get_entity_type (entity *);
77 void      set_entity_type (entity *, type *);
78
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);
83 */
84
85 # endif /* _ENTITY_H_ */