From ea4bfbc9b3f96097cfc4ad9a96ebe8ca5509ab9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 19 Mar 2002 13:08:33 +0000 Subject: [PATCH] Added flag "peculiarity" to entity.h, type.h. [r337] --- ir/tr/entity.c | 14 ++++++++++++++ ir/tr/entity.h | 19 ++++++++++++++----- ir/tr/entity_t.h | 3 ++- ir/tr/type.c | 10 ++++++++++ ir/tr/type.h | 18 ++++++++++++++++++ ir/tr/type_t.h | 1 + 6 files changed, 59 insertions(+), 6 deletions(-) diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 5322ede34..01cee4adb 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -257,6 +257,20 @@ set_entity_volatility (entity *ent, ent_volatility vol) { ent->volatility = vol; } +inline peculiarity +get_entity_peculiarity (entity *ent) { + assert (ent); + assert (is_method_type(ent->type)); + return ent->peculiarity; +} + +inline void +set_entity_peculiarity (entity *ent, peculiarity pec) { + assert (ent); + assert (is_method_type(ent->type)); + ent->peculiarity = pec; +} + /* Set has no effect for entities of type method. */ inline ir_node * get_atomic_ent_value(entity *ent) { diff --git a/ir/tr/entity.h b/ir/tr/entity.h index eb8e89f95..9dbe0ac45 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -79,21 +79,26 @@ typedef struct ir_graph ir_graph; * type The type of this entity. * name The string that represents this entity in the source program. * allocation A flag saying whether the entity is dynamically or statically - * allocated (values: dynamic_allocated, static_allocated). - * @@@ Does this make sense??? + * allocated (values: dynamic_allocated, static_allocated, + * automatic_allocated). * visibility A flag indicating the visibility of this entity (values: local, * external_visible, external_allocated) * variability A flag indicating the variability of this entity (values: * uninitialized, initalized, part_constant, constant) * offset The offset of the entity within the compound object. Only set - * if IR in the state "@@@" Wie nennen wir den?? + * if the owner in the state "layout_fixed". * overwrites A list of entities overwritten by this entity. This list is only * existent if the owner of this entity is a class. The members in * this list must be entities of super classes. - * link A void* to associate some additional inforamtion with the entity. + * link A void* to associate some additional information with the entity. * irg If the entity is a method this is the ir graph that represents the * code of the method. - * + * peculiarity The peculiarity of the entity. If the entity is a method this + * indicates whether the entity represents + * a real method or whether it only exists to describe an interface. + * In that case there nowhere exists code for this entity and this entity + * is never dynamically used in the code. + * Values: description, existent. Default: existent. * * These fields can only be accessed via access functions. * @@ -198,6 +203,10 @@ typedef enum { ent_volatility get_entity_volatility (entity *ent); void set_entity_volatility (entity *ent, ent_volatility vol); +/* For the definition of enumeration peculiarity see type.h */ +peculiarity get_entity_peculiarity (entity *ent); +void set_entity_peculiarity (entity *ent, peculiarity pec); + /* Set has no effect for entities of type method. */ ir_node *get_atomic_ent_value(entity *ent); void set_atomic_ent_value(entity *ent, ir_node *val); diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index 2ef439d7b..e30ca9978 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -62,13 +62,14 @@ struct entity { 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 */ 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_method, or should Call have an attribute ent?? Yes, it must be here. */ - unsigned long visit; /* visited counter for walks of the type information */ + peculiarity peculiarity; }; diff --git a/ir/tr/type.c b/ir/tr/type.c index 2a41b24e2..f591f5c53 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -384,6 +384,16 @@ void remove_class_supertype(type *clss, type *supertype) { break; } } + +inline peculiarity get_class_peculiarity (type *clss) { + assert(clss && (clss->type_op == type_class)); + return clss->attr.ca.peculiarity; +} +inline void set_class_peculiarity (type *clss, peculiarity pec) { + assert(clss && (clss->type_op == type_class)); + clss->attr.ca.peculiarity = pec; +} + /* typecheck */ bool is_class_type(type *clss) { assert(clss); diff --git a/ir/tr/type.h b/ir/tr/type.h index 98517c88c..58522854d 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -205,6 +205,12 @@ int is_type (void *thing); * * These are dynamic lists that can be grown with an "add_" function, * but not shrinked. + * + * peculiarity The peculiarity of this class. If the class is of peculiarity + * "description" it only is a description of requirememts to a class, + * as, e.g., a Java interface. The class will never be allocated. + * Values: description, existent. Default: existent. + * * SOURCE */ /* create a new class type */ @@ -263,6 +269,18 @@ void set_class_supertype (type *clss, type *supertype, int pos); @@@ Doesn't work properly. */ void remove_class_supertype(type *clss, type *supertype); +/* This enumeration flags the peculiarity of entities and types. */ +typedef enum { + description, /* Represents only a description. The entity/type is never + allocated, no code/data exists for this entity/type. */ + existent /* The entity/type (can) exist. */ +} peculiarity; + +/* The peculiarity of the class. The enumeration peculiarity is defined + in entity.h */ +inline peculiarity get_class_peculiarity (type *clss); +inline void set_class_peculiarity (type *clss, peculiarity pec); + /* typecheck */ bool is_class_type(type *clss); /*****/ diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index bc41895b1..fe15f326a 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -25,6 +25,7 @@ typedef struct { entity **members; /* fields and methods of this class */ type **subtypes; /* direct subtypes */ type **supertypes; /* direct supertypes */ + peculiarity peculiarity; } cls_attr; typedef struct { -- 2.20.1