added register pressure statistics
[libfirm] / ir / tr / type.h
index b68d69e..6e9d4c5 100644 (file)
@@ -419,9 +419,9 @@ int smaller_type (ir_type *st, ir_type *lt);
  *  The following two are dynamic lists that can be grown with an "add_" function,
  *  but not shrinked:
  *
- *  - subtypes:   A list of direct subclasses.
+ *  - subtypes:    A list of direct subclasses.
  *
- *  - supertypes: A list of direct superclasses.
+ *  - supertypes:  A list of direct superclasses.
  *
  *  - peculiarity: The peculiarity of this class.  If the class is of peculiarity
  *                 "description" it only is a description of requirements to a class,
@@ -432,6 +432,17 @@ int smaller_type (ir_type *st, ir_type *lt);
  *                 no value for irg.
  *                 Values: description, existent, inherited.  Default: existent.
  *
+ *  - type_info:   An entity representing the type information of this class.
+ *                 This entity can be of arbitrari type, Firm did not use it yet.
+ *                 It allows to express the coupling of a type with an entity
+ *                 representing this type.  This information is useful for lowering
+ *                 of InstOf and TypeChk nodes.  Default: NULL
+ *
+ *  - final:       A final class is always a leaf in the class hierarchy.  Final
+ *                 classes cannot be super classes of other ones.  As this information
+ *                 can only be computed in whole world compilations, we allow to
+ *                 set this flag.  It is used in optimizations if get_opt_closed_world()
+ *                 is false.  Default:  false
  */
 
 /** Creates a new class type. */
@@ -452,7 +463,7 @@ int     get_class_n_members (const ir_type *clss);
 entity *get_class_member   (const ir_type *clss, int pos);
 
 /** Returns index of mem in clss, -1 if not contained. */
-int     get_class_member_index(ir_type *clss, entity *mem);
+int     get_class_member_index(const ir_type *clss, entity *mem);
 
 /** Finds the member with name 'name'. If several members with the same
  *  name returns one of them.  Returns NULL if no member found. */
@@ -577,6 +588,18 @@ peculiarity get_class_peculiarity (const ir_type *clss);
 /** Sets the peculiarity of the class. */
 void        set_class_peculiarity (ir_type *clss, peculiarity pec);
 
+/** Returns the type info entity of a class. */
+entity *get_class_type_info(const ir_type *clss);
+
+/** Set a type info entity for the class. */
+void set_class_type_info(ir_type *clss, entity *ent);
+
+/** Returns non-zero if a class is final. */
+int is_class_final(const ir_type *clss);
+
+/** Sets if a class is final. */
+void set_class_final(ir_type *clss, int flag);
+
 /* Set and get a class' dfn --
    @todo This is an undocumented field, subject to change! */
 void set_class_dfn (ir_type *clss, int dfn);
@@ -617,7 +640,7 @@ int     get_struct_n_members (const ir_type *strct);
 entity *get_struct_member   (const ir_type *strct, int pos);
 
 /** Returns index of member in strct, -1 if not contained. */
-int     get_struct_member_index(ir_type *strct, entity *member);
+int     get_struct_member_index(const ir_type *strct, entity *member);
 
 /** Overwrites the member at position pos, 0 <= pos < n_member with
    the passed entity. */
@@ -902,6 +925,9 @@ void    add_union_member (ir_type *uni, entity *member);
 /** Returns the entity at position pos of a union */
 entity *get_union_member (const ir_type *uni, int pos);
 
+/** Returns index of member in uni, -1 if not contained. */
+int     get_union_member_index(const ir_type *uni, entity *member);
+
 /** Overwrites a entity at position pos in a union type. */
 void    set_union_member (ir_type *uni, int pos, entity *member);
 
@@ -1088,7 +1114,7 @@ int   is_Pointer_type            (const ir_type *pointer);
 
 /** Returns the first pointer type that has as points_to tp.
  *  Not efficient: O(#types).
- *  If not found returns unknown_type. */
+ *  If not found returns firm_unknown_type. */
 ir_type *find_pointer_type_to_type (ir_type *tp);
 
 /**
@@ -1097,7 +1123,7 @@ ir_type *find_pointer_type_to_type (ir_type *tp);
  * Primitive types are types that represent indivisible data values that
  * map directly to modes.  They don't have a private attribute.  The
  * important information they carry is held in the common mode field.
-*/
+ */
 /** Creates a new primitive type. */
 ir_type *new_type_primitive (ident *name, ir_mode *mode);
 
@@ -1109,7 +1135,7 @@ int  is_Primitive_type  (const ir_type *primitive);
 
 
 /**
- * @page none_type
+ * @page none_type The None type
  *
  *  This type is an auxiliary type dedicated to support type analyses.
  *
@@ -1126,7 +1152,7 @@ int  is_Primitive_type  (const ir_type *primitive);
  *    - size:  0
  */
 /** A variable that contains the only none type. */
-extern type *firm_none_type;
+extern ir_type *firm_none_type;
 /** Returns the none type */
 ir_type *get_none_type(void);
 
@@ -1148,7 +1174,7 @@ ir_type *get_none_type(void);
  *    - size:  0
  */
 /** A variable that contains the only unknown type. */
-extern type *firm_unknown_type;
+extern ir_type *firm_unknown_type;
 /** Returns the unknown type */
 ir_type *get_unknown_type(void);
 
@@ -1187,6 +1213,9 @@ int get_compound_n_members(const ir_type *tp);
  */
 entity *get_compound_member(const ir_type *tp, int pos);
 
+/** Returns index of member in tp, -1 if not contained. */
+int     get_compound_member_index(const ir_type *tp, entity *member);
+
 /**
  * Checks whether a type is compound.
  *
@@ -1197,10 +1226,15 @@ entity *get_compound_member(const ir_type *tp, int pos);
 int is_compound_type(const ir_type *tp);
 
 /**
- * Checks, whether a type is a frame type
+ * Checks, whether a type is a frame type.
  */
 int is_frame_type(const ir_type *tp);
 
+/**
+ * Checks, whether a type is a lowered type.
+ */
+int is_lowered_type(const ir_type *tp);
+
 /**
  * Makes a new frame type. Frame types are class types,
  * so all class access functions work.
@@ -1208,6 +1242,32 @@ int is_frame_type(const ir_type *tp);
  */
 ir_type   *new_type_frame(ident *name);
 
+/**
+ * Sets a lowered type for a type. This sets both associations
+ * and marks lowered type as a "lowered" one.
+ */
+void set_lowered_type(ir_type *tp, ir_type *lowered_type);
+
+/**
+ * Gets the lowered/unlowered type of a type or NULL if this type
+ * has no lowered/unlowered one.
+ */
+ir_type *get_associated_type(const ir_type *tp);
+
+/**
+ * Allocate an area of size bytes aligned at alignment
+ * at the start or the end of a frame type.
+ * The frame type must have already an fixed layout.
+ *
+ * @param frame_type a frame type
+ * @param size       the size of the entity
+ * @param alignment  the alignment of the entity
+ * @param at_start   if true, put the area at the frame type's start, else at end
+ *
+ * @return the entity representing the area
+ */
+entity *frame_alloc_area(type *frame_type, int size, int alignment, int at_start);
+
 /*-----------------------------------------------------------------*/
 /** Debug aides                                                   **/
 /*-----------------------------------------------------------------*/