X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Fentity_t.h;h=13617ad56cb71ebe6baf83d1ea6854a098c1cd68;hb=c7d0ab306a70e42dee8a5d91bc52197730a1ba91;hp=17c43ef2e91cbac5426aa9fe24d41980f0dd68d5;hpb=58278afc9917d9fc28ae5a4def6e1d9e53d7179f;p=libfirm diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index 17c43ef2e..13617ad56 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -1,76 +1,105 @@ -/*10 2002/03/19 13:08:33 -** 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. -** -** 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. -** +/* + * Project: libFIRM + * File name: ir/tr/entity_t.h + * Purpose: Representation of all program known entities -- private header. + * Author: Martin Trapp, Christian Schaefer + * Modified by: Goetz Lindenmaier + * Created: + * CVS-ID: $Id$ + * Copyright: (c) 1998-2003 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + +/** +* @file entity_t.h +* +* entity.h: entities represent all program known objects. +* +* @author 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. */ -/* $Id$ */ # ifndef _ENTITY_T_H_ # define _ENTITY_T_H_ # include "entity.h" -#ifndef _IR_GRAPH_TYPEDEF_ -#define _IR_GRAPH_TYPEDEF_ -/* to resolve recursion between entity.h and irgraph.h */ -typedef struct ir_graph ir_graph; -#endif +/** A path in a compund graph. */ +struct compound_graph_path { + firm_kind kind; /**< dynamic type tag for compound graph path. */ + type *tp; + int len; + entity *nodes[1]; +}; +/** the type of an entity */ 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 + firm_kind kind; /**< dynamic type tag for entity. */ + ident *name; /**< name of this entity */ + ident *ld_name; /**< Unique name of this entity, i.e., the mangled + name. If the field is read before written a default + magling is applies. The name of the owner is prepended + to the name of the entity, separated by a underscore. + 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 + 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. In case of local - variables the method they are defined in. */ - entity **overwrites; /* A list of entities this entity overwrites. */ - entity **overwrittenby; /* A list of entities that overwrite this entity. */ - ent_allocation allocation; /* Distinguishes static and dynamically allocated - entities. */ - ent_visibility visibility; /* Specifies visibility to external program + type *owner; /**< The compound type (e.g. class type) this entity belongs to. */ + ent_allocation allocation; /**< Distinguishes static and dynamically allocated + entities and some further cases. */ + ent_visibility visibility; /**< Specifies visibility to external program fragments */ - ent_variability variability; /* Specifies variability of entities content */ - ent_volatility volatility; /* Specifies volatility of entities content */ - ir_node *value; /* value of atomic entity */ - ir_node **values; /* values of compound entities */ - entity **val_ents; /* entities corresponding to constant values */ - int offset; /* Offset in byte for this entity. Fixed when layout + ent_variability variability; /**< Specifies variability of entities content */ + ent_volatility volatility; /**< Specifies volatility of entities content */ + int offset; /**< Offset in byte for this entity. Fixed when layout of owner is determined. */ - void *link; /* To store some intermediate information */ - unsigned long visit; /* visited counter for walks of the type information */ - /* for methods */ + void *link; /**< To store some intermediate information */ + unsigned long visit; /**< visited counter for walks of the type information */ + struct dbg_info* dbi; /**< A pointer to information for debug support. */ + + /* ------------- fields for atomic entities ---------------*/ + ir_node *value; /**< value if entity is not of variability uninitialized. + Only for atomic entities. */ + + /* ------------- fields for compound entities ---------------*/ + ir_node **values; /**< constant values of compound entities. Only available if + variablility not uninitialized. Must be set for variability constant + */ + compound_graph_path **val_paths; /**< paths corresponding to constant values. Only available if + variablility not uninitialized. Must be set for variability constant */ + + /* ------------- fields for entities owned by a class type ---------------*/ + entity **overwrites; /**< A list of entities this entity overwrites. */ + entity **overwrittenby; /**< A list of entities that overwrite this entity. */ + + /* ------------- fields for methods ---------------*/ enum peculiarity peculiarity; - ir_graph *irg; /* If (type == method_type) this is the corresponding irg. + ir_graph *irg; /**< If (type == method_type) this is the corresponding irg. The ir_graph constructor automatically sets this field. Yes, it must be here. */ - struct dbg_info* dbi; /* A pointer to information for debug support. */ +#ifdef DEBUG_libfirm + int nr; /**< a unique node number for each node to make output + readable. */ +#endif }; +INLINE long get_entity_nr(entity *ent); # endif /* _ENTITY_T_H_ */