Added support for out edges.
[libfirm] / ir / tr / entity_t.h
index 4f08500..a9842c7 100644 (file)
@@ -43,6 +43,7 @@
 # include "entity.h"
 # include "typegmod.h"
 # include "mangle.h"
+# include "pseudo_irg.h"
 
 
 /** A path in a compund graph. */
@@ -50,10 +51,10 @@ struct compound_graph_path {
   firm_kind kind;       /**< dynamic type tag for compound graph path. */
   type *tp;             /**< The type this path belongs to. */
   int len;              /**< length of the path */
-  int *arr_indicees;    /**< List of array indicees.  To compute position of
-                            array elements */
+  int *arr_indicees;    /**< List of array indeces.  To compute position of
+                 array elements */
   entity *nodes[1];     /**< List of entities of length len to express the
-                            access path. */
+                 access path. */
 };
 
 /** the type of an entity */
@@ -62,7 +63,7 @@ struct entity {
   ident *name;          /**< name of this entity */
   ident *ld_name;       /**< Unique name of this entity, i.e., the mangled
                            name.  If the field is read before written a default
-                           magling is applies.  The name of the owner is prepended
+                           mangling is applies.  The name of the owner is prepended
                            to the name of the entity, separated by a underscore.
                            E.g.,  for a class `A' with field `a' this
                            is the ident for `A_a'. */
@@ -77,7 +78,7 @@ struct entity {
   ent_volatility volatility;    /**< Specifies volatility of entities content */
   ent_stickyness stickyness;    /**< Specifies whether this entity is sticky  */
   int  offset;          /**< Offset in bits for this entity.  Fixed when layout
-                          of owner is determined.  */
+               of owner is determined.  */
   void *link;           /**< To store some intermediate information */
   unsigned long visit;  /**< visited counter for walks of the type information */
   struct dbg_info* dbi;    /**< A pointer to information for debug support. */
@@ -90,10 +91,10 @@ struct entity {
   /* ------------- fields for compound entities ---------------*/
 
   ir_node **values;     /**< constant values of compound entities. Only available if
-                          variablility not uninitialized.  Must be set for variability constant
+               variablility not uninitialized.  Must be set for variability constant
                            */
   compound_graph_path **val_paths; /**< paths corresponding to constant values. Only available if
-                                     variablility not uninitialized.  Must be set for variability constant */
+                      variablility not uninitialized.  Must be set for variability constant */
 
   /* ------------- fields for entities owned by a class type ---------------*/
 
@@ -104,33 +105,34 @@ struct entity {
 
   enum peculiarity peculiarity;
   ir_graph *irg;        /**< If (type == method_type) this is the corresponding irg.
-                          The ir_graph constructor automatically sets this field.
-                          Yes, it must be here. */
+               The ir_graph constructor automatically sets this field.
+               Yes, it must be here. */
 
   /* ------------- fields for analyses ---------------*/
 
-  ir_node **accesses;                      /**< accessing nodes: loads, stores. */
 
 #ifdef DEBUG_libfirm
   int nr;             /**< a unique node number for each node to make output
-                        readable. */
-#endif
+                           readable. */
+# endif /* DEBUG_libfirm */
 };
 
+
+
 /* ----------------------- inline functions ------------------------ */
 static INLINE int
-__is_entity(void *thing) {
+__is_entity(const void *thing) {
   return get_kind(thing) == k_entity;
 }
 
 static INLINE const char *
-__get_entity_name(entity *ent) {
+__get_entity_name(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return get_id_str(get_entity_ident(ent));
 }
 
 static INLINE ident *
-__get_entity_ident(entity *ent) {
+__get_entity_ident(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->name;
 }
@@ -175,7 +177,7 @@ __set_entity_type(entity *ent, type *type) {
 }
 
 static INLINE ent_allocation
-__get_entity_allocation(entity *ent) {
+__get_entity_allocation(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->allocation;
 }
@@ -187,19 +189,19 @@ __set_entity_allocation(entity *ent, ent_allocation al) {
 }
 
 static INLINE ent_visibility
-__get_entity_visibility(entity *ent) {
+__get_entity_visibility(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->visibility;
 }
 
 static INLINE ent_variability
-__get_entity_variability(entity *ent) {
+__get_entity_variability(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->variability;
 }
 
 static INLINE ent_volatility
-__get_entity_volatility(entity *ent) {
+__get_entity_volatility(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->volatility;
 }
@@ -211,7 +213,7 @@ __set_entity_volatility(entity *ent, ent_volatility vol) {
 }
 
 static INLINE peculiarity
-__get_entity_peculiarity(entity *ent) {
+__get_entity_peculiarity(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->peculiarity;
 }
@@ -223,12 +225,13 @@ static INLINE void
 __set_entity_peculiarity(entity *ent, peculiarity pec) {
   assert(ent && ent->kind == k_entity);
   /* @@@ why peculiarity only for methods? */
-  assert(is_method_type(ent->type));
+  assert(is_Method_type(ent->type));
+
   ent->peculiarity = pec;
 }
 
 static INLINE ent_stickyness
-__get_entity_stickyness(entity *ent) {
+__get_entity_stickyness(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->stickyness;
 }
@@ -241,13 +244,13 @@ __set_entity_stickyness(entity *ent, ent_stickyness stickyness)
 }
 
 static INLINE int
-__get_entity_offset_bits(entity *ent) {
+__get_entity_offset_bits(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->offset;
 }
 
 static INLINE int
-__get_entity_offset_bytes(entity *ent) {
+__get_entity_offset_bytes(const entity *ent) {
   int bits = __get_entity_offset_bits(ent);
 
   if (bits & 7) return -1;
@@ -266,7 +269,7 @@ __set_entity_offset_bytes(entity *ent, int offset) {
 }
 
 static INLINE void *
-__get_entity_link(entity *ent) {
+__get_entity_link(const entity *ent) {
   assert(ent && ent->kind == k_entity);
   return ent->link;
 }
@@ -278,9 +281,11 @@ __set_entity_link(entity *ent, void *l) {
 }
 
 static INLINE ir_graph *
-__get_entity_irg(entity *ent) {
+__get_entity_irg(const entity *ent) {
   assert(ent && ent->kind == k_entity);
-  assert(is_method_type(ent->type));
+  assert(ent == unknown_entity || is_Method_type(ent->type));
+  if (!get_visit_pseudo_irgs() && ent->irg && is_pseudo_ir_graph(ent->irg))
+    return NULL;
   return ent->irg;
 }