From f8627e64d46caf669e794220b96d2c64b72c1cea Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=B6tz=20Lindenmaier?= Date: Tue, 19 Mar 2002 14:22:40 +0000 Subject: [PATCH] *** empty log message *** [r339] --- ir/ir/irprog.c | 2 +- ir/tr/entity.c | 1 + ir/tr/entity.h | 4 +++- ir/tr/entity_t.h | 6 ++---- ir/tr/type.h | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index c3a16960b..9f693e169 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -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(); diff --git a/ir/tr/entity.c b/ir/tr/entity.c index bf82cdc0f..e49f6d893 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -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; } diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 9dbe0ac45..8e424e16f 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -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); diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index e30ca9978..5ffe3b5ce 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -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; }; diff --git a/ir/tr/type.h b/ir/tr/type.h index 58522854d..c7fc6d871 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -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. */ -- 2.20.1