added register pressure statistics
[libfirm] / ir / tr / type_t.h
index e8e9255..2b6f3df 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -33,7 +33,9 @@ typedef struct {
   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;
 
@@ -113,15 +115,20 @@ typedef union {
   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. */
@@ -133,11 +140,12 @@ struct ir_type {
   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
@@ -277,7 +285,7 @@ _get_type_size_bytes(const ir_type *tp) {
 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
@@ -335,6 +343,18 @@ _get_class_member   (const ir_type *clss, int pos) {
   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);
@@ -456,6 +476,8 @@ _set_method_calling_convention(ir_type *method, unsigned cc_mask) {
 #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)