Added flag "peculiarity" to entity.h, type.h.
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Mar 2002 13:08:33 +0000 (13:08 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Mar 2002 13:08:33 +0000 (13:08 +0000)
[r337]

ir/tr/entity.c
ir/tr/entity.h
ir/tr/entity_t.h
ir/tr/type.c
ir/tr/type.h
ir/tr/type_t.h

index 5322ede..01cee4a 100644 (file)
@@ -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) {
index eb8e89f..9dbe0ac 100644 (file)
@@ -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);
index 2ef439d..e30ca99 100644 (file)
@@ -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;
 };
 
 
index 2a41b24..f591f5c 100644 (file)
@@ -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);
index 98517c8..5852285 100644 (file)
@@ -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);
 /*****/
index bc41895..fe15f32 100644 (file)
@@ -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 {