struct types still require names.
[libfirm] / ir / tr / entity_t.h
index 92aee12..a3f46ca 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 /*
- * @file     entity_t.h
+ * @file
  * @brief   Representation of all program known entities -- private header.
  * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
  * @version $Id$
 
 #include <assert.h>
 
-#include "firm_common_t.h"
-
 #include "typerep.h"
 #include "type_t.h"
 #include "ident.h"
 #include "pseudo_irg.h"
+#include "compound_path.h"
 
 typedef struct ir_initializer_base_t {
        ir_initializer_kind_t kind;
@@ -72,18 +71,6 @@ union ir_initializer_t {
        ir_initializer_tarval_t    tarval;
 };
 
-/** A path in a compound graph. */
-struct compound_graph_path {
-       firm_kind kind;       /**< The dynamic type tag for compound graph path. */
-       ir_type *tp;          /**< The type this path belongs to. */
-       int len;              /**< The length of the path. */
-       struct tuple {
-               int       index;    /**< Array index.  To compute position of array elements */
-               ir_entity *node;    /**< The accessed entity. */
-       } list[1];            /**< List of entity/index tuple of length len to express the
-                                  access path. */
-};
-
 /** The attributes for atomic entities. */
 typedef struct atomic_ent_attr {
        ir_node *value;            /**< value if entity is not of variability uninitialized.
@@ -117,6 +104,11 @@ typedef struct method_ent_attr {
                                            with a high weight are good candidates for procedure cloning. */
 } method_ent_attr;
 
+/** additional attributes for code entities */
+typedef struct code_ent_attr {
+       ir_label_t  label;       /** label of the basic block */
+} code_ent_attr;
+
 
 /**
  * An abstract data type to represent program entities.
@@ -140,7 +132,7 @@ struct ir_entity {
        unsigned visibility:3;         /**< Specifies visibility to external program fragments. */
        unsigned variability:3;        /**< Specifies variability of entities content. */
        unsigned volatility:1;         /**< Specifies volatility of entities content. */
-       unsigned align:1;              /**< Specifies alignment of entities content. */
+       unsigned aligned:1;            /**< Specifies alignment of entities content. */
        unsigned stickyness:2;         /**< Specifies whether this entity is sticky.  */
        unsigned peculiarity:3;        /**< The peculiarity of this entity. */
        unsigned usage:4;              /**< flag indicating usage types of this entity, see ir_entity_usage. */
@@ -150,6 +142,7 @@ struct ir_entity {
        unsigned has_initializer:1;    /**< if set, this entity is initialized by new style initializers. */
        int offset;                    /**< Offset in bytes for this entity.  Fixed when layout
                                            of owner is determined. */
+       unsigned alignment;            /**< entity alignment in bytes */
        unsigned char offset_bit_remainder;
                                       /**< If the entity is a bit field, this is the offset of
                                            the start of the bit field within the byte specified
@@ -172,6 +165,8 @@ struct ir_entity {
                compound_ent_attr cmpd_attr;
                /* ------------- fields for method entities ---------------- */
                method_ent_attr   mtd_attr;
+               /* fields for code entities */
+               code_ent_attr     code_attr;
                /* entity initializer */
                ir_initializer_t *initializer;
        } attr; /**< type specific attributes */
@@ -214,7 +209,7 @@ _set_entity_ident(ir_entity *ent, ident *id) {
 static inline ir_type *
 _get_entity_owner(ir_entity *ent) {
        assert(ent && ent->kind == k_entity);
-       return ent->owner = skip_tid(ent->owner);
+       return ent->owner;
 }
 
 static inline ident *
@@ -241,7 +236,7 @@ _get_entity_ld_name(ir_entity *ent) {
 static inline ir_type *
 _get_entity_type(ir_entity *ent) {
        assert(ent && ent->kind == k_entity);
-       return ent->type = skip_tid(ent->type);
+       return ent->type;
 }
 
 static inline void
@@ -286,16 +281,28 @@ _set_entity_volatility(ir_entity *ent, ir_volatility vol) {
        ent->volatility = vol;
 }
 
+static inline unsigned
+_get_entity_alignment(const ir_entity *ent) {
+       assert(ent && ent->kind == k_entity);
+       return ent->alignment;
+}
+
+static inline void
+_set_entity_alignment(ir_entity *ent, unsigned alignment) {
+       assert(ent && ent->kind == k_entity);
+       ent->alignment = alignment;
+}
+
 static inline ir_align
-_get_entity_align(const ir_entity *ent) {
+_get_entity_aligned(const ir_entity *ent) {
        assert(ent && ent->kind == k_entity);
-       return ent->align;
+       return ent->aligned;
 }
 
 static inline void
-_set_entity_align(ir_entity *ent, ir_align a) {
+_set_entity_aligned(ir_entity *ent, ir_align a) {
        assert(ent && ent->kind == k_entity);
-       ent->align = a;
+       ent->aligned = a;
 }
 
 static inline ir_peculiarity
@@ -491,6 +498,8 @@ _set_entity_dbg_info(ir_entity *ent, dbg_info *db) {
 #define get_entity_variability(ent)              _get_entity_variability(ent)
 #define get_entity_volatility(ent)               _get_entity_volatility(ent)
 #define set_entity_volatility(ent, vol)          _set_entity_volatility(ent, vol)
+#define set_entity_alignment(ent, alignment)     _set_entity_alignment(ent, alignment)
+#define get_entity_alignment(ent)                _get_entity_alignment(ent)
 #define get_entity_align(ent)                    _get_entity_align(ent)
 #define set_entity_align(ent, a)                 _set_entity_align(ent, a)
 #define get_entity_peculiarity(ent)              _get_entity_peculiarity(ent)