Bitfields in entity need one more bits because of signess,
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 13 Sep 2006 11:58:47 +0000 (11:58 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 13 Sep 2006 11:58:47 +0000 (11:58 +0000)
add is_entity_compiler_generated

[r8237]

ir/tr/entity.c
ir/tr/entity.h
ir/tr/entity_t.h
ir/tr/type.c

index 3e62c51..aef9438 100644 (file)
@@ -62,7 +62,7 @@ entity *get_unknown_entity(void) { return unknown_entity; }
 /* ENTITY                                                          */
 /*-----------------------------------------------------------------*/
 
-static INLINE void insert_entity_in_owner (entity *ent) {
+static INLINE void insert_entity_in_owner(entity *ent) {
   ir_type *owner = ent->owner;
   switch (get_type_tpop_code(owner)) {
   case tpo_class: {
@@ -92,7 +92,7 @@ static INLINE void insert_entity_in_owner (entity *ent) {
  * @return the new created entity
  */
 static INLINE entity *
-new_rd_entity (dbg_info *db, ir_type *owner, ident *name, ir_type *type)
+new_rd_entity(dbg_info *db, ir_type *owner, ident *name, ir_type *type)
 {
   entity *res;
   ir_graph *rem;
@@ -105,16 +105,17 @@ new_rd_entity (dbg_info *db, ir_type *owner, ident *name, ir_type *type)
   res->kind    = k_entity;
   res->name    = name;
   res->ld_name = NULL;
-  res->owner   = owner;
   res->type    = type;
+  res->owner   = owner;
 
-  res->allocation  = allocation_automatic;
-  res->visibility  = visibility_local;
-  res->volatility  = volatility_non_volatile;
-  res->stickyness  = stickyness_unsticky;
-  res->offset      = -1;
-  res->peculiarity = peculiarity_existent;
-  res->link        = NULL;
+  res->allocation   = allocation_automatic;
+  res->visibility   = visibility_local;
+  res->volatility   = volatility_non_volatile;
+  res->stickyness   = stickyness_unsticky;
+  res->peculiarity  = peculiarity_existent;
+  res->compiler_gen = 0;
+  res->offset       = -1;
+  res->link         = NULL;
 
   if (is_Method_type(type)) {
     symconst_symbol sym;
@@ -478,6 +479,18 @@ void
   _set_entity_peculiarity(ent, pec);
 }
 
+/* Checks if an entity is compiler generated */
+int is_entity_compiler_generated(const entity *ent) {
+  assert(is_entity(ent));
+  return ent->compiler_gen;
+}
+
+/* Sets/resets the compiler generated flag */
+void set_entity_compiler_generated(entity *ent, int flag) {
+  assert(is_entity(ent));
+  ent->compiler_gen = flag ? 1 : 0;
+}
+
 /* Get the entity's stickyness */
 ir_stickyness
 (get_entity_stickyness)(const entity *ent) {
index 7aa6bdb..2017b8c 100644 (file)
@@ -331,6 +331,12 @@ ir_peculiarity get_entity_peculiarity(const entity *ent);
 /** Sets the peculiarity of an entity. */
 void           set_entity_peculiarity(entity *ent, ir_peculiarity pec);
 
+/** Checks if an entity is compiler generated */
+int is_entity_compiler_generated(const entity *ent);
+
+/** Sets/resets the compiler generated flag */
+void set_entity_compiler_generated(entity *ent, int flag);
+
 /* -- Representation of constant values of entities -- */
 /** Returns true if the the node is representable as code on
  *  const_code_irg. */
index 345277e..7b83653 100644 (file)
@@ -106,15 +106,16 @@ struct entity {
   ir_type *type;        /**< The type of this entity, e.g., a method type, a
                              basic type of the language or a class itself. */
   ir_type *owner;                /**< The compound type (e.g. class type) this entity belongs to. */
-  ir_allocation allocation:2;    /**< Distinguishes static and dynamically allocated
+  ir_allocation allocation:3;    /**< Distinguishes static and dynamically allocated
                                     entities and some further cases. */
-  ir_visibility visibility:2;    /**< Specifies visibility to external program
+  ir_visibility visibility:3;    /**< Specifies visibility to external program
                                       fragments. */
-  ir_variability variability:2;  /**< Specifies variability of entities content. */
-  ir_volatility volatility:1;    /**< Specifies volatility of entities content. */
-  ir_stickyness stickyness:1;    /**< Specifies whether this entity is sticky.  */
-  ir_peculiarity peculiarity:2;  /**< The peculiarity of this entity. */
-  int  offset;                   /**< Offset in bits for this entity.  Fixed when layout
+  ir_variability variability:3;  /**< Specifies variability of entities content. */
+  ir_volatility volatility:2;    /**< Specifies volatility of entities content. */
+  ir_stickyness stickyness:2;    /**< Specifies whether this entity is sticky.  */
+  ir_peculiarity peculiarity:3;  /**< The peculiarity of this entity. */
+  unsigned compiler_gen:1;       /**< If set, this entity was compiler generated. */
+  int offset;                    /**< Offset in bits for this entity.  Fixed when layout
                                       of owner is determined. */
   unsigned long visit;           /**< visited counter for walks of the type information. */
   struct dbg_info *dbi;          /**< A pointer to information for debug support. */
index b3ca9ba..3eaedfa 100644 (file)
@@ -2066,5 +2066,7 @@ entity *frame_alloc_area(ir_type *frame_type, int size, int alignment, int at_st
   set_entity_offset_bytes(area, offset);
   set_type_size_bytes(frame_type, frame_size);
 
+  /* mark this entity as compiler generated */
+  set_entity_compiler_generated(area, 1);
   return area;
 }