X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Fentity.h;h=70dbf9b9a13c50c349b5662ca6e359bd0836d590;hb=fb1ecf296897fed644337520cf750e0e32af0003;hp=4bd3be1d6003741f7c3fafba5762e9e3c6014dad;hpb=3183ecb6e7f1f77fcc05fb5787c45033cfb6df1c;p=libfirm diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 4bd3be1d6..70dbf9b9a 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -1,17 +1,35 @@ -/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe -** All rights reserved. +/* +** Copyright (C) 1998 - 2000 by Universitaet Karlsruhe +** All rights reserved. +** +** Authors: Martin Trapp, Christian Schaefer, +** Goetz Lindenmaier +** +** entity.h: entities represent all program known objects. ** -** Authors: Martin Trapp, Christian Schaefer, -** Goetz Lindenmaier +** An entity is the representation of program known objects in Firm. +** The primary concept of entities is to represent members of complex +** types, i.e., fields and methods of classes. As not all programming +** language model all variables and methods as members of some class, +** the concept of entities is extended to cover also local and global +** variables, and arbitrary procedures. +** +** An entity always specifies the type of the object it represents and +** the type of the object it is a part of, the owner of the entity. +** Originally this is the type of the class of which the entity is a +** member. +** The owner of local variables is the procedure they are defined in. +** The owner of global variables and procedures visible in the whole +** program is a universally defined class type "GlobalType". The owner +** of procedures defined in the scope of an other procedure is the +** enclosing procedure. ** -** entity.h: declarations for entity */ # ifndef _ENTITY_H_ # define _ENTITY_H_ # include "ident.h" -# include "type.h" /*******************************************************************/ /** general **/ @@ -30,56 +48,42 @@ void init_entity (void); typedef struct ir_graph ir_graph; #endif -struct entity { - firm_kind kind; - ident *name; /* name of this entity */ - ident *ld_name; /* Unique name of this entity, i.e., the mangled - name. E.g., for a class `A' with field `a' this - is the ident for `A_a'. */ - type *type; /* The type of this entity, e.g., a method type, a - basic type of the language or a class itself */ - type *owner; /* The class this entity belongs to */ - /* for methods */ - ir_graph *irg; /* If (type == method_type) this is the corresponding irg. - The ir_graph constructor automatically sets this field. - @@@ Does this go here, or should it be in type_mehtod, - or should Call have an attribute ent?? */ - /* Do we need to remember the initializer of fields? */ - unsigned long visit; /* visited counter for walks of the type information */ -}; - -#ifndef _ENTITY_TYPEDEF_ -#define _ENTITY_TYPEDEF_ +#ifndef _TYPE_TYPEDEF_ +#define _TYPE_TYPEDEF_ /* to resolve recursion between entity.h and irgraph.h */ -typedef struct entity entity; +typedef union type type; #endif +typedef struct entity entity; + /* create a new entity */ entity *new_entity (type *owner, ident *name, type *type); /* manipulate fields of entity */ -char *get_entity_name (entity *); -ident *get_entity_ident (entity *); +char *get_entity_name (entity *ent); +ident *get_entity_ident (entity *ent); + +ident *get_entity_ld_name (entity *ent); -ident *get_entity_ld_name (entity *); /* -char *get_entity_ld_name (entity *); -ident *get_entity_ld_ident (entity *); -void set_entity_ld_name (entity *, char *ld_name); -void set_entity_ld_ident (entity *, ident *ld_ident); +char *get_entity_ld_name (entity *ent); +void set_entity_ld_name (entity *ent, char *ld_name); + +ident *get_entity_ld_ident (entity *ent); +void set_entity_ld_ident (entity *ent, ident *ld_ident); */ -type *get_entity_owner (entity *); -void set_entity_owner (entity *, type *); -inline void assert_legal_owner_of_ent(type *); +type *get_entity_owner (entity *ent); +void set_entity_owner (entity *ent, type *owner); +inline void assert_legal_owner_of_ent(type *owner); -type *get_entity_type (entity *); -void set_entity_type (entity *, type *); +type *get_entity_type (entity *ent); +void set_entity_type (entity *ent, type *type); /* The entity knows the corresponding irg if the entity is a method. - This allows to get from a Call to the called irg. * + This allows to get from a Call to the called irg. */ ir_graph *get_entity_irg(entity *ent); void set_entity_irg(entity *ent, ir_graph *irg); -*/ + # endif /* _ENTITY_H_ */