Some access routines for visited flags in entity.h, irnode.h,
[libfirm] / ir / tr / type.h
index 66c41ec..fa310c2 100644 (file)
@@ -27,6 +27,9 @@
  *   tpop.h
  *****
  */
+
+/* $Id$ */
+
 # ifndef _TYPE_H_
 # define _TYPE_H_
 
@@ -80,7 +83,17 @@ typedef struct ir_node ir_node;
  *               occupy size bytes in memory.  In several cases this is
  *               determined when fixing the layout of this type (class,
  *               struct, union, array, enumeration).
+ *  state        The state of the type.  The state represents whether the
+ *               layout of the type is undefined or fixed (values: layout_undefined
+ *               or layout_fixed).  Compound types can have an undefined
+ *               layout.  The layout of the basic types primitive and pointer
+ *               is always layout_fixed.  If the layout of
+ *               compound types is fixed all entities must have an offset
+ *               and the size of the type must be set.
+ *               A fixed layout for enumeration types means that each enumeration
+ *               is associated with an implementation value.
  *  visit        A counter for walks of the type information.
+ *  link         A void* to associate some additional inforamtion with the type.
  *
  *  These fields can only be accessed via access functions.
  *
@@ -102,8 +115,8 @@ tp_opcode   get_type_tpop_code(type *tp);
 ir_mode*    get_type_mode(type *tp);
 void        set_type_mode(type *tp, ir_mode* m);
 
-ident*      get_type_nameid(type *tp);
-void        set_type_nameid(type *tp, ident* id);
+ident*      get_type_ident(type *tp);
+void        set_type_ident(type *tp, ident* id);
 const char* get_type_name(type *tp);
 
 int         get_type_size(type *tp);
@@ -202,7 +215,8 @@ entity *get_class_member   (type *clss, int pos);
 /* Overwrites the member at position pos, 0 <= pos < n_member with
    the passed entity. */
 void    set_class_member   (type *clss, entity *member, int pos);
-/* Finds member in the list of members and overwrites it with NULL */
+/* Finds member in the list of members and overwrites it with NULL
+ @@@ Doesn't work properly. */
 void    remove_class_member(type *clss, entity *member);
 
 
@@ -218,7 +232,8 @@ type   *get_class_subtype   (type *clss, int pos);
    set the corresponding supertype relation for subtype: this might
    be a different position! */
 void    set_class_subtype   (type *clss, type *subtype, int pos);
-/* Finds subtype in the list of subtypes and overwrites it with NULL */
+/* Finds subtype in the list of subtypes and overwrites it with NULL
+ @@@ Doesn't work properly. */
 void    remove_class_subtype(type *clss, type *subtype);
 
 
@@ -234,7 +249,8 @@ type   *get_class_supertype   (type *clss, int pos);
    set the corresponding subtype relation for supertype: this might
    be a different position! */
 void    set_class_supertype   (type *clss, type *supertype, int pos);
-/* Finds supertype in the list of supertypes and overwrites it with NULL */
+/* Finds supertype in the list of supertypes and overwrites it with NULL
+ @@@ Doesn't work properly. */
 void    remove_class_supertype(type *clss, type *supertype);
 
 /* typecheck */
@@ -266,7 +282,8 @@ void    add_struct_member   (type *strct, entity *member);
 int     get_struct_n_member (type *strct);
 entity *get_struct_member   (type *strct, int pos);
 void    set_struct_member   (type *strct, int pos, entity *member);
-/* Finds member in the list of memberss and overwrites it with NULL */
+/* Finds member in the list of memberss and overwrites it with NULL
+ @@@ Doesn't work properly. */
 void    remove_struct_member (type *strct, entity *member);
 
 /* typecheck */
@@ -340,6 +357,8 @@ int     get_union_n_members      (type *uni);
 void    add_union_member (type *uni, entity *member);
 entity *get_union_member (type *uni, int pos);
 void    set_union_member (type *uni, int pos, entity *member);
+/* Finds member in the list of members and overwrites it with NULL
+   @@@ Doesn't work properly. */
 void    remove_union_member (type *uni, entity *member);
 
 /* typecheck */
@@ -362,6 +381,8 @@ void   set_union_delim_nameid (type *uni, int pos, ident *id);
  *   Representation of an array type.
  * NOTE
  *   The array type represents rectangular multi dimensional arrays.
+ *   The constants representing the bounds must be allocated to
+ *   get_const_code_irg() by setting current_ir_graph accordingly.
  * ATTRIBUTES
  *   n_dimensions     Number of array dimensions.
  *   *lower_bound     Lower bounds of dimensions.  Usually all 0.
@@ -382,6 +403,9 @@ type *new_type_array         (ident *name, int n_dimensions,
 
 /* manipulate private fields of array type */
 int   get_array_n_dimensions (type *array);
+/* Allocates Const nodes of mode_I for the array dimensions */
+void  set_array_bounds_int   (type *array, int dimension, int lower_bound,
+                                                          int upper_bound);
 void  set_array_bounds       (type *array, int dimension, ir_node *lower_bound,
                                                           ir_node *upper_bound);
 void  set_array_lower_bound  (type *array, int dimension, ir_node *lower_bound);
@@ -467,4 +491,34 @@ type *new_type_primitive (ident *name, ir_mode *mode);
 bool  is_primitive_type  (type *primitive);
 /*****/
 
+
+
+/****f* type/is_atomic_type
+ *
+ * NAME
+ *   is_atomic_type - Checks whether a type is atomic.
+ * SYNOPSIS
+ *   int is_atomic_type(type *tp);
+ * INPUTS
+ *   tp - any type
+ * RESULT
+ *   true if type is primitive, pointer or enumeration
+ ***
+ */
+int is_atomic_type(type *tp);
+
+/****f* type/is_compound_type
+ *
+ * NAME
+ *   is_compound_type - Checks whether a type is compound.
+ * SYNOPSIS
+ *   int is_compound_type(type *tp)
+ * INPUTS
+ *   tp - any type
+ * RESULT
+ *   true if the type is class, structure, union or array type.
+ ***
+ */
+int is_compound_type(type *tp);
+
 # endif /* _TYPE_H_ */