*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Mar 2002 14:22:40 +0000 (14:22 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 19 Mar 2002 14:22:40 +0000 (14:22 +0000)
[r339]

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

index c3a1696..9f693e1 100644 (file)
@@ -40,7 +40,7 @@ ir_prog *new_ir_prog (void) {
   res->types  = NEW_ARR_F (type *, 1);
   res->glob_type = new_type_class(id_from_str (GLOBAL_TYPE_NAME,
                                               strlen(GLOBAL_TYPE_NAME)));
-  add_irp_type((type *)res->glob_type);
+  add_irp_type(res->glob_type);
 
   res->const_code_irg = new_const_code_irg();
 
index bf82cdc..e49f6d8 100644 (file)
@@ -410,6 +410,7 @@ set_entity_irg(entity *ent, ir_graph *irg) {
   assert (ent && ent->type);
   assert (irg);
   assert (is_method_type(ent->type));
+  assert (ent->peculiarity == existent);
   ent->irg = irg;
 }
 
index 9dbe0ac..8e424e1 100644 (file)
@@ -246,7 +246,9 @@ void*   get_entity_link(entity *ent);
 void    set_entity_link(entity *ent, void *l);
 
 /* 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.
+   Only entities of peculiarity "existent" can have a corresponding irg,
+   else the field is fixed to NULL.  (Get returns NULL, set asserts.) */
 ir_graph *get_entity_irg(entity *ent);
 void      set_entity_irg(entity *ent, ir_graph *irg);
 
index e30ca99..5ffe3b5 100644 (file)
@@ -1,4 +1,4 @@
-/*
+/*10 2002/03/19 13:08:33
 **  Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
 **  All rights reserved.
 **
@@ -64,12 +64,10 @@ struct entity {
   void *link;           /* To store some intermediate information */
   unsigned long visit;  /* visited counter for walks of the type information */
   /* for methods */
+  enum peculiarity peculiarity;
   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. */
-  peculiarity peculiarity;
 };
 
 
index 5852285..c7fc6d8 100644 (file)
@@ -1,4 +1,4 @@
-/****h* libfirm/type
+/****h* libfirm/type6 2002/03/19 13:08:33
  *
  * NAME
  *   file type.h - datastructure to hold type information.
@@ -270,7 +270,7 @@ void    set_class_supertype   (type *clss, type *supertype, int pos);
 void    remove_class_supertype(type *clss, type *supertype);
 
 /* This enumeration flags the peculiarity of entities and types. */
-typedef enum {
+typedef enum peculiarity {
   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. */