From ce529889e89f11f14a4e09d8da23ecc6332ed666 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 1 Aug 2005 09:52:11 +0000 Subject: [PATCH] add new_frame_type() and is_frame_type() functions [r6335] --- ir/tr/type.c | 31 +++++++++++++++++++++++++------ ir/tr/type.h | 18 +++++++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/ir/tr/type.c b/ir/tr/type.c index 1c42a9170..a18e02c4f 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -109,30 +109,32 @@ void (inc_master_type_visited)(void) { _inc_master_type_visited(); type * new_type(tp_op *type_op, ir_mode *mode, ident* name) { type *res; - int node_size ; + int node_size; assert(type_op != type_id); assert(!id_contains_char(name, ' ') && "type name should not contain spaces"); node_size = offsetof(type, attr) + type_op->attr_size; - res = xmalloc (node_size); + res = xmalloc(node_size); memset(res, 0, node_size); - add_irp_type(res); /* Remember the new type global. */ res->kind = k_type; res->type_op = type_op; res->mode = mode; res->name = name; res->visibility = visibility_external_allocated; + res->frame_type = 0; res->state = layout_undefined; res->size = -1; res->align = -1; res->visit = 0; - res -> link = NULL; + res->link = NULL; #ifdef DEBUG_libfirm res->nr = get_irp_new_node_nr(); #endif /* defined DEBUG_libfirm */ + add_irp_type(res); /* Remember the new type global. */ + return res; } @@ -1086,7 +1088,7 @@ build_value_type(ident *name, int len, type **tps) { int i; type *res = new_type_struct(name); /* Remove type from type list. Must be treated differently than other types. */ - remove_irp_type_from_list(res); + remove_irp_type(res); for (i = 0; i < len; i++) { type *elt_type = res; /* use res as default if corresponding type is not yet set. */ if (tps[i]) elt_type = tps[i]; @@ -1777,8 +1779,25 @@ entity *get_compound_member(const type *tp, int pos) return res; } - int is_compound_type(const type *tp) { assert(tp && tp->kind == k_type); return tp->type_op->flags & TP_OP_FLAG_COMPOUND; } + +/* Checks, whether a type is a frame type */ +int is_frame_type(const type *tp) { + return tp->frame_type; +} + +/* Makes a new frame type. */ +type *new_type_frame(ident *name) +{ + type *res = new_type_class(name); + + res->frame_type = 1; + + /* Remove type from type list. Must be treated differently than other types. */ + remove_irp_type(res); + + return res; +} diff --git a/ir/tr/type.h b/ir/tr/type.h index 49f200e93..c8662ba71 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -1084,14 +1084,26 @@ int get_compound_n_members(const type *tp); entity *get_compound_member(const type *tp, int pos); /** - * Checks whether a type is compound. + * Checks whether a type is compound. * - * @param tp - any type + * @param tp - any type * - * @return true if the type is class, structure, union or array type. + * @return true if the type is class, structure, union or array type. */ int is_compound_type(const type *tp); +/** + * Checks, whether a type is a frame type + */ +int is_frame_type(const type *tp); + +/** + * Makes a new frame type. Frame types are class types, + * so all class access functions work. + * Frame types are not in the global list of types. + */ +type *new_type_frame(ident *name); + /*-----------------------------------------------------------------*/ /** Debug aides **/ /*-----------------------------------------------------------------*/ -- 2.20.1