- get_entity_nr() now takes an cont entity
[libfirm] / ir / tr / type_t.h
index a8c9cb4..5e57692 100644 (file)
@@ -36,36 +36,37 @@ enum class_flags {
   cf_absctract_class = 4,  /**< Set if a class is "abstract" */
 };
 
-/** Class attributes. */
+/** Class type attributes. */
 typedef struct {
-  entity  **members;        /**< Array containing the fields and methods of this class. */
-  ir_type **subtypes;       /**< Array containing the direct subtypes. */
-  ir_type **supertypes;     /**< Array containing the direct supertypes */
-  peculiarity peculiarity;  /**< The peculiarity of this class. */
-  entity  *type_info;       /**< An entity representing this class, used for type info. */
-  int     dfn;              /**< A number that can be used for 'instanceof' operator. */
-  unsigned vtable_size;     /**< The size of the vtable for this class. */
-  unsigned clss_flags;      /**< Additional class flags. */
+  ir_entity  **members;           /**< Array containing the fields and methods of this class. */
+  ir_type **subtypes;          /**< Array containing the direct subtypes. */
+  ir_type **supertypes;        /**< Array containing the direct supertypes */
+  ir_peculiarity peculiarity;  /**< The peculiarity of this class. */
+  ir_entity *type_info;        /**< An ir_entity representing this class, used for type info. */
+  int      dfn;                /**< A number that can be used for 'instanceof' operator. */
+  unsigned vtable_size;        /**< The size of the vtable for this class. */
+  unsigned clss_flags;         /**< Additional class flags. */
 } cls_attr;
 
-/** struct attributes */
+/** Struct type attributes. */
 typedef struct {
-  entity **members;    /**< Fields of this struct. No method entities allowed. */
+  ir_entity **members; /**< Fields of this struct. No method entities allowed. */
 } stc_attr;
 
-/** A (type, entity) pair */
+/** A (type, ir_entity) pair. */
 typedef struct {
   ir_type *tp;         /**< A type. */
-  entity  *ent;        /**< An entity. */
+  ir_entity  *ent;     /**< An ir_entity. */
+  ident   *param_name; /**< For debugging purposes: the name of the parameter */
 } tp_ent_pair;
 
-/** method attributes */
+/** Method type attributes. */
 typedef struct {
   int n_params;                   /**< Number of parameters. */
-  tp_ent_pair *param_type;        /**< Array of parameter type/value entities pairs. */
+  tp_ent_pair *params;            /**< Array of parameter type/value entities pairs. */
   ir_type *value_params;          /**< A type whose entities represent copied value arguments. */
   int n_res;                      /**< Number of results. */
-  tp_ent_pair *res_type;          /**< Array of result type/value entity pairs. */
+  tp_ent_pair *res_type;          /**< Array of result type/value ir_entity pairs. */
   ir_type *value_ress;            /**< A type whose entities represent copied value results. */
   variadicity variadicity;        /**< The variadicity of the method. */
   int first_variadic_param;       /**< The index of the first variadic parameter or -1 if non-variadic .*/
@@ -73,34 +74,38 @@ typedef struct {
   unsigned irg_calling_conv;      /**< A set of calling convention flags. */
 } mtd_attr;
 
-/** union attributes */
+/** Union type attributes. */
 typedef struct {
-  entity **members;    /**< Fields of this union. No method entities allowed. */
+  ir_entity **members;    /**< Fields of this union. No method entities allowed. */
 } uni_attr;
 
-/** array attributes */
+/** Array type attributes. */
 typedef struct {
-  int   n_dimensions;     /**< Number of array dimensions.  */
+  int     n_dimensions;   /**< Number of array dimensions.  */
   ir_node **lower_bound;  /**< Lower bounds of dimensions.  Usually all 0. */
   ir_node **upper_bound;  /**< Upper bounds or dimensions. */
-  int *order;             /**< Ordering of dimensions. */
+  int     *order;         /**< Ordering of dimensions. */
   ir_type *element_type;  /**< The type of the array elements. */
-  entity *element_ent;    /**< Entity for the array elements, to be used for
-                               element selection with Sel. */
+  ir_entity *element_ent; /**< entity for the array elements, to be used for
+                               element selection with a Sel node. */
 } arr_attr;
 
-/** enum attributes */
+/** An enumerator constant. */
+struct ir_enum_const {
+  tarval  *value;     /**< The constants that represents this enumerator identifier. */
+  ident   *nameid;    /**< The name of the enumerator identifier. */
+  ir_type *owner;     /**< owner type of this enumerator constant. */
+};
+
+/** Enum type attributes. */
 typedef struct {
-  int      n_enums;    /**< Number of enumerators. */
-  tarval **enumer;     /**< Contains all constants that represent a member
-                          of the enum -- enumerators. */
-  ident  **enum_nameid;/**< Contains the names of the enum fields as specified by
-                          the source program. */
+  ir_enum_const *enumer;   /**< Contains all enumerator constants that represent a member
+                                of the enum -- enumerators. */
 } enm_attr;
 
-/** pointer attributes */
+/** Pointer type attributes. */
 typedef struct {
-  ir_type *points_to;  /**< The type of the entity the pointer points to. */
+  ir_type *points_to;  /**< The type of the ir_entity the pointer points to. */
 } ptr_attr;
 
 /*
@@ -126,24 +131,26 @@ typedef union {
 
 /** Additional type flags. */
 enum type_flags {
-  tf_none             = 0,  /**< No flags. */
-  tf_frame_type       = 1,  /**< Set if this is a frame type. */
-  tf_value_param_type = 2,  /**< Set if this is a value param type. */
-  tf_lowered_type     = 4,  /**< Set if this is a lowered type. */
-  tf_layout_fixed     = 8   /**< Set if the layout of a type is fixed */
+  tf_none             =  0, /**< No flags. */
+  tf_frame_type       =  1, /**< Set if this is a frame type. */
+  tf_value_param_type =  2, /**< Set if this is a value param type. */
+  tf_lowered_type     =  4, /**< Set if this is a lowered type. */
+  tf_layout_fixed     =  8, /**< Set if the layout of a type is fixed */
+  tf_global_type      = 16, /**< Set only for the global type */
+  tf_tls_type         = 32, /**< Set only for the tls type */
 };
 
-/** the structure of a type */
+/** 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. */
+  ir_visibility visibility;/**< Visibility of entities of this type. */
   unsigned flags;          /**< Type flags, a bitmask of enum type_flags. */
-  int size;                /**< Size of an entity of this type. This is determined
+  int size;                /**< Size of an ir_entity of this type. This is determined
                                 when fixing the layout of this class.  Size must be
                                 given in bits. */
-  int align;               /**< Alignment of an entity of this type. This should be
+  int align;               /**< Alignment of an ir_entity of this type. This should be
                                 set according to the source language needs. If not set it's
                                 calculated automatically by get_type_alignment().
                                 Alignment must be given in bits. */
@@ -347,7 +354,7 @@ _get_class_n_members (const ir_type *clss) {
   return (ARR_LEN (clss->attr.ca.members));
 }
 
-static INLINE entity *
+static INLINE ir_entity *
 _get_class_member   (const ir_type *clss, int pos) {
   assert(clss && (clss->type_op == type_class));
   assert(pos >= 0 && pos < _get_class_n_members(clss));