From c39143631002d7913214982d368fa16b56fa30c1 Mon Sep 17 00:00:00 2001 From: Florian Liekweg Date: Tue, 25 Jun 2002 16:05:53 +0000 Subject: [PATCH] Added iro_InstOf operator --flo Added exc/instanceof fields --flo [r416] --- ir/tr/entity.c | 3 ++- ir/tr/entity.h | 4 ++-- ir/tr/type.c | 16 ++++++++++++++-- ir/tr/type.h | 8 ++++++-- ir/tr/type_t.h | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 4c1d4bbc7..b2c482eac 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -354,7 +354,8 @@ get_compound_ent_value(entity *ent, int pos) { } /* Copies the value i of the entity to current_block in current_ir_graph. */ -ir_node *copy_compound_ent_value(entity *ent, int pos) { +ir_node * +copy_compound_ent_value(entity *ent, int pos) { assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized)); return copy_const_value(ent->values[pos+1]); } diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 7a9c4d5f1..f5931b2ba 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -39,7 +39,7 @@ ** of owner is determined. ** ir_graph *irg; If (type == method_type) this is the corresponding irg. ** The ir_graph constructor automatically sets this field. -** If (type !- method_type) access of this field will cause +** If (type != method_type) access of this field will cause ** an assertion. */ @@ -175,7 +175,7 @@ typedef enum { external_visible, /* The entity is visible to other external program parts, but it is defined here. It may not be optimized away. The entity must be static_allocated. */ - external_allocated /* The entity is defined and allocated externaly. This compilation + external_allocated /* The entity is defined and allocated externally. This compilation must not allocate memory for this entity. The entity must be static_allocated. */ } ent_visibility; diff --git a/ir/tr/type.c b/ir/tr/type.c index a6cf88b7c..29ba93d09 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -150,7 +150,7 @@ void set_type_ident(type *tp, ident* id) { const char* get_type_name(type *tp) { assert(tp && tp->kind == k_type); - return id_to_str(tp->name); + return (id_to_str(tp->name)); } int get_type_size(type *tp) { @@ -263,6 +263,7 @@ type *new_type_class (ident *name) { res->attr.ca.subtypes = NEW_ARR_F (type *, 1); res->attr.ca.supertypes = NEW_ARR_F (type *, 1); res->attr.ca.peculiarity = existent; + res->attr.ca.dfn = 0; return res; } @@ -395,6 +396,16 @@ inline void set_class_peculiarity (type *clss, peculiarity pec) { clss->attr.ca.peculiarity = pec; } +void set_class_dfn (type *clss, int dfn) +{ + clss->attr.ca.dfn = dfn; +} + +int get_class_dfn (type *clss) +{ + return (clss->attr.ca.dfn); +} + /* typecheck */ bool is_class_type(type *clss) { assert(clss); @@ -607,7 +618,7 @@ bool is_union_type (type *uni) { /* create a new type array -- set dimension sizes independently */ type *new_type_array (ident *name, int n_dimensions, - type *element_type) { + type *element_type) { type *res; int i; assert((element_type->type_op != type_method)); @@ -627,6 +638,7 @@ type *new_type_array (ident *name, int n_dimensions, new_entity(res, mangle_u(name, id_from_str("elem_ent", 8)), element_type); return res; } + inline void free_array_attrs (type *array) { assert(array && (array->type_op == type_array)); free(array->attr.aa.lower_bound); diff --git a/ir/tr/type.h b/ir/tr/type.h index c7fc6d871..762fd0df0 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -125,7 +125,7 @@ void set_type_ident(type *tp, ident* id); const char* get_type_name(type *tp); int get_type_size(type *tp); -/* For primitives, enumerationsm, pointer and method types the size +/* For primitives, enumerations, pointer and method types the size is always fixed. This call is legal but has no effect. */ void set_type_size(type *tp, int size); @@ -281,6 +281,10 @@ typedef enum peculiarity { inline peculiarity get_class_peculiarity (type *clss); inline void set_class_peculiarity (type *clss, peculiarity pec); +/* Set and get a class' dfn */ +void set_class_dfn (type*, int); +int get_class_dfn (type*); + /* typecheck */ bool is_class_type(type *clss); /*****/ @@ -429,7 +433,7 @@ void set_union_delim_nameid (type *uni, int pos, ident *id); Entity for array elements is built automatically. Set dimension sizes after call to constructor with set_* routines. */ type *new_type_array (ident *name, int n_dimensions, - type *element_type); + type *element_type); /* manipulate private fields of array type */ int get_array_n_dimensions (type *array); diff --git a/ir/tr/type_t.h b/ir/tr/type_t.h index fe15f326a..b6e790a32 100644 --- a/ir/tr/type_t.h +++ b/ir/tr/type_t.h @@ -26,6 +26,7 @@ typedef struct { type **subtypes; /* direct subtypes */ type **supertypes; /* direct supertypes */ peculiarity peculiarity; + int dfn; /* number used for 'instanceof' operator */ } cls_attr; typedef struct { -- 2.20.1