* File name: ir/tr/type_t.h
* Purpose: Representation of types -- private header.
* Author: Goetz Lindenmaier
- * Modified by:
+ * Modified by: Michael Beck
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2001-2003 Universität Karlsruhe
entity **members; /**< fields and methods of this class */
ir_type **subtypes; /**< direct subtypes */
ir_type **supertypes;/**< direct supertypes */
- peculiarity peculiarity;
+ peculiarity peculiarity; /**< peculiarity of this class */
+ entity *type_info; /**< a entity representing this class, used for type info */
+ unsigned final; /**< non-zero if this is a final class */
int dfn; /**< number used for 'instanceof' operator */
} cls_attr;
ptr_attr pa; /**< attributes of a pointer type */
} tp_attr;
+enum type_flags {
+ tf_none = 0, /**< No flags. */
+ tf_frame_type = 1, /**< Set if this is a frame type. */
+ tf_lowered_type = 2, /**< Set if this is a lowered type. */
+ tf_layout_fixed = 4 /**< set if the layout of a type is fixed */
+};
+
/** the structure of a type */
struct ir_type {
firm_kind kind; /**< the firm kind, must be k_type */
const tp_op *type_op; /**< the type operation of the type */
ident *name; /**< The name of the type */
visibility visibility; /**< Visibility of entities of this type. */
- char frame_type; /**< True if this is a frame type, false else */
- type_state state; /**< Represents the types state: layout undefined or
- fixed. */
+ unsigned flags; /**< Type flags, a bitmask of enum type_flags. */
int size; /**< Size of an entity of this type. This is determined
when fixing the layout of this class. Size must be
given in bits. */
unsigned long visit; /**< visited counter for walks of the type information */
void *link; /**< holds temporary data - like in irnode_t.h */
struct dbg_info *dbi; /**< A pointer to information for debug support. */
+ ir_type *assoc_type; /**< The associated lowered/unlowered type */
/* ------------- fields for analyses ---------------*/
#ifdef DEBUG_libfirm
- int nr; /**< a unique node number for each node to make output
+ long nr; /**< a unique node number for each node to make output
readable. */
#endif
tp_attr attr; /* type kind specific fields. This must be the last
static INLINE type_state
_get_type_state(const ir_type *tp) {
assert(tp && tp->kind == k_type);
- return tp->state;
+ return tp->flags & tf_layout_fixed ? layout_fixed : layout_undefined;
}
static INLINE unsigned long
return clss->attr.ca.members[pos];
}
+static INLINE int
+_is_class_final (const ir_type *clss) {
+ assert(clss && (clss->type_op == type_class));
+ return clss->attr.ca.final;
+}
+
+static INLINE void
+_set_class_final (ir_type *clss, int final) {
+ assert(clss && (clss->type_op == type_class));
+ clss->attr.ca.final = final;
+}
+
static INLINE int
_is_struct_type(const ir_type *strct) {
assert(strct);
#define is_Class_type(clss) _is_class_type(clss)
#define get_class_n_members(clss) _get_class_n_members(clss)
#define get_class_member(clss, pos) _get_class_member(clss, pos)
+#define is_class_final(clss) _is_class_final(clss)
+#define set_class_final(clss, final) _set_class_final(clss, final)
#define is_Struct_type(strct) _is_struct_type(strct)
#define is_Method_type(method) _is_method_type(method)
#define is_Union_type(uni) _is_union_type(uni)