mtp_property_runtime added
[r8283]
res->compiler_gen = 0;
res->offset = -1;
res->link = NULL;
res->compiler_gen = 0;
res->offset = -1;
res->link = NULL;
+ res->repr_class = NULL;
if (is_Method_type(type)) {
symconst_symbol sym;
if (is_Method_type(type)) {
symconst_symbol sym;
-new_d_entity (ir_type *owner, ident *name, ir_type *type, dbg_info *db) {
+new_d_entity(ir_type *owner, ident *name, ir_type *type, dbg_info *db) {
- assert_legal_owner_of_ent(owner);
+ assert(is_compound_type(owner));
res = new_rd_entity(db, owner, name, type);
/* Remember entity in it's owner. */
res = new_rd_entity(db, owner, name, type);
/* Remember entity in it's owner. */
- insert_entity_in_owner (res);
+ insert_entity_in_owner(res);
hook_new_entity(res);
return res;
}
entity *
hook_new_entity(res);
return res;
}
entity *
-new_entity (ir_type *owner, ident *name, ir_type *type) {
+new_entity(ir_type *owner, ident *name, ir_type *type) {
return new_d_entity(owner, name, type, NULL);
}
return new_d_entity(owner, name, type, NULL);
}
-copy_entity_own (entity *old, ir_type *new_owner) {
+copy_entity_own(entity *old, ir_type *new_owner) {
- assert(old && old->kind == k_entity);
- assert_legal_owner_of_ent(new_owner);
+ assert(is_entity(old));
+ assert(is_compound_type(new_owner));
if (old->owner == new_owner) return old;
newe = xmalloc(sizeof(*newe));
if (old->owner == new_owner) return old;
newe = xmalloc(sizeof(*newe));
- memcpy (newe, old, sizeof(*newe));
+ memcpy(newe, old, sizeof(*newe));
newe->owner = new_owner;
if (is_Class_type(new_owner)) {
newe->overwrites = NEW_ARR_F(entity *, 0);
newe->owner = new_owner;
if (is_Class_type(new_owner)) {
newe->overwrites = NEW_ARR_F(entity *, 0);
newe->nr = get_irp_new_node_nr();
#endif
newe->nr = get_irp_new_node_nr();
#endif
- insert_entity_in_owner (newe);
+ insert_entity_in_owner(newe);
-copy_entity_name (entity *old, ident *new_name) {
+copy_entity_name(entity *old, ident *new_name) {
entity *newe;
assert(old && old->kind == k_entity);
entity *newe;
assert(old && old->kind == k_entity);
-set_entity_owner (entity *ent, ir_type *owner) {
- assert(ent && ent->kind == k_entity);
- assert_legal_owner_of_ent(owner);
+set_entity_owner(entity *ent, ir_type *owner) {
+ assert(is_entity(ent));
+ assert(is_compound_type(owner));
-void /* should this go into type.c? */
-assert_legal_owner_of_ent(ir_type *owner) {
- assert(get_type_tpop_code(owner) == tpo_class ||
- get_type_tpop_code(owner) == tpo_union ||
- get_type_tpop_code(owner) == tpo_struct ||
- get_type_tpop_code(owner) == tpo_array); /* Yes, array has an entity
- -- to select fields! */
-}
-
ident *
(get_entity_ld_ident)(entity *ent) {
return _get_entity_ld_ident(ent);
ident *
(get_entity_ld_ident)(entity *ent) {
return _get_entity_ld_ident(ent);
}
int is_atomic_entity(entity *ent) {
}
int is_atomic_entity(entity *ent) {
- ir_type *t = get_entity_type(ent);
- tp_op *op = get_type_tpop(t);
+ ir_type *t = get_entity_type(ent);
+ const tp_op *op = get_type_tpop(t);
return (op == type_primitive || op == type_pointer ||
op == type_enumeration || op == type_method);
}
int is_compound_entity(entity *ent) {
return (op == type_primitive || op == type_pointer ||
op == type_enumeration || op == type_method);
}
int is_compound_entity(entity *ent) {
- ir_type *t = get_entity_type(ent);
- tp_op *op = get_type_tpop(t);
+ ir_type *t = get_entity_type(ent);
+ const tp_op *op = get_type_tpop(t);
return (op == type_class || op == type_struct ||
op == type_array || op == type_union);
}
return (op == type_class || op == type_struct ||
op == type_array || op == type_union);
}
+/* Returns the class type that this type info entity represents or NULL
+ if ent is no type info entity. */
+ir_type *(get_entity_repr_class)(const entity *ent) {
+ return _get_entity_repr_class(ent);
+}
+
/* Initialize entity module. */
void firm_init_entity(void)
{
/* Initialize entity module. */
void firm_init_entity(void)
{
* value is a pointer to the method.
* Visibility is local, offset -1, and it is not volatile.
*/
* value is a pointer to the method.
* Visibility is local, offset -1, and it is not volatile.
*/
-entity *new_entity (ir_type *owner, ident *name, ir_type *tp);
+entity *new_entity(ir_type *owner, ident *name, ir_type *tp);
/**
* Creates a new entity.
/**
* Creates a new entity.
* value is a pointer to the method.
* Visibility is local, offset -1, and it is not volatile.
*/
* value is a pointer to the method.
* Visibility is local, offset -1, and it is not volatile.
*/
-entity *new_d_entity (ir_type *owner, ident *name, ir_type *tp, dbg_info *db);
+entity *new_d_entity(ir_type *owner, ident *name, ir_type *tp, dbg_info *db);
/**
* Copies the entity if the new_owner is different from the
/**
* Copies the entity if the new_owner is different from the
* itself and not to the origin. Right now we have to change
* the peculiarity and then set a new atomic value by hand.
*/
* itself and not to the origin. Right now we have to change
* the peculiarity and then set a new atomic value by hand.
*/
-entity *copy_entity_own (entity *old, ir_type *new_owner);
+entity *copy_entity_own(entity *old, ir_type *new_owner);
/**
* Copies the entity if the new_name is different from the
/**
* Copies the entity if the new_name is different from the
* The mangled name ld_name is set to NULL.
* Overwrites relation is copied from old.
*/
* The mangled name ld_name is set to NULL.
* Overwrites relation is copied from old.
*/
-entity *copy_entity_name (entity *old, ident *new_name);
+entity *copy_entity_name(entity *old, ident *new_name);
* The owner will still contain the pointer to this
* entity, as well as all other references!
*/
* The owner will still contain the pointer to this
* entity, as well as all other references!
*/
-void free_entity (entity *ent);
+void free_entity(entity *ent);
/** Returns the name of an entity. */
/** Returns the name of an entity. */
-const char *get_entity_name (const entity *ent);
+const char *get_entity_name(const entity *ent);
/** Returns the ident of an entity. */
/** Returns the ident of an entity. */
-ident *get_entity_ident (const entity *ent);
+ident *get_entity_ident(const entity *ent);
/** Sets the ident of the entity. */
/** Sets the ident of the entity. */
-void set_entity_ident (entity *ent, ident *id);
+void set_entity_ident(entity *ent, ident *id);
/** Returns the mangled name of the entity.
*
/** Returns the mangled name of the entity.
*
* Else it generates a name with mangle_entity()
* and remembers this new name internally.
*/
* Else it generates a name with mangle_entity()
* and remembers this new name internally.
*/
-ident *get_entity_ld_ident (entity *ent);
+ident *get_entity_ld_ident(entity *ent);
/** Sets the mangled name of the entity. */
/** Sets the mangled name of the entity. */
-void set_entity_ld_ident (entity *ent, ident *ld_ident);
+void set_entity_ld_ident(entity *ent, ident *ld_ident);
/** Returns the mangled name of the entity as a string. */
/** Returns the mangled name of the entity as a string. */
-const char *get_entity_ld_name (entity *ent);
+const char *get_entity_ld_name(entity *ent);
/** Returns the owner of the entity. */
/** Returns the owner of the entity. */
-ir_type *get_entity_owner (entity *ent);
+ir_type *get_entity_owner(entity *ent);
/** Sets the owner field in entity to owner. Don't forget to add
ent to owner!! */
/** Sets the owner field in entity to owner. Don't forget to add
ent to owner!! */
-void set_entity_owner (entity *ent, ir_type *owner);
-
-/** Asserts if the type owner is either a compound type or an array */
-void assert_legal_owner_of_ent(ir_type *owner);
+void set_entity_owner(entity *ent, ir_type *owner);
/** Returns the type of an entity. */
/** Returns the type of an entity. */
-ir_type *get_entity_type (entity *ent);
+ir_type *get_entity_type(entity *ent);
/** Sets the type of an entity. */
/** Sets the type of an entity. */
-void set_entity_type (entity *ent, ir_type *tp);
+void set_entity_type(entity *ent, ir_type *tp);
/** The allocation type. */
typedef enum {
/** The allocation type. */
typedef enum {
/** Sets one additional graph property. */
void set_entity_additional_property(entity *ent, mtp_additional_property flag);
/** Sets one additional graph property. */
void set_entity_additional_property(entity *ent, mtp_additional_property flag);
+/** Returns the class type that this type info entity represents or NULL
+ if ent is no type info entity. */
+ir_type *get_entity_repr_class(const entity *ent);
+
/**
* @page unknown_entity
*
/**
* @page unknown_entity
*
* File name: ir/tr/entity_t.h
* Purpose: Representation of all program known entities -- private header.
* Author: Martin Trapp, Christian Schaefer
* File name: ir/tr/entity_t.h
* Purpose: Representation of all program known entities -- private header.
* Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier
+ * Modified by: Goetz Lindenmaier, Michael Beck
* Created:
* CVS-ID: $Id$
* Created:
* CVS-ID: $Id$
- * Copyright: (c) 1998-2003 Universität Karlsruhe
+ * Copyright: (c) 1998-2006 Universität Karlsruhe
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
-/** attributes for atomic entities */
+/** The attributes for atomic entities. */
typedef struct atomic_ent_attr {
ir_node *value; /**< value if entity is not of variability uninitialized.
Only for atomic entities. */
} atomic_ent_attr;
typedef struct atomic_ent_attr {
ir_node *value; /**< value if entity is not of variability uninitialized.
Only for atomic entities. */
} atomic_ent_attr;
-/** attributes for compound entities */
+/** The attributes for compound entities. */
typedef struct compound_ent_attr {
ir_node **values; /**< constant values of compound entities. Only available if
variability not uninitialized. Must be set for variability constant. */
typedef struct compound_ent_attr {
ir_node **values; /**< constant values of compound entities. Only available if
variability not uninitialized. Must be set for variability constant. */
variability not uninitialized. Must be set for variability constant. */
} compound_ent_attr;
variability not uninitialized. Must be set for variability constant. */
} compound_ent_attr;
-/** a reserved value for "not yet set" */
+/** A reserved value for "not yet set". */
#define VTABLE_NUM_NOT_SET ((unsigned)(-1))
#define VTABLE_NUM_NOT_SET ((unsigned)(-1))
-/** attributes for methods */
+/** The attributes for methods. */
typedef struct method_ent_attr {
ir_graph *irg; /**< The corresponding irg if known.
The ir_graph constructor automatically sets this field. */
typedef struct method_ent_attr {
ir_graph *irg; /**< The corresponding irg if known.
The ir_graph constructor automatically sets this field. */
-/** the type of an entity */
+/** The type of an entity. */
struct entity {
firm_kind kind; /**< The dynamic type tag for entity. */
ident *name; /**< The name of this entity. */
struct entity {
firm_kind kind; /**< The dynamic type tag for entity. */
ident *name; /**< The name of this entity. */
unsigned long visit; /**< visited counter for walks of the type information. */
struct dbg_info *dbi; /**< A pointer to information for debug support. */
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. */
void *link; /**< To store some intermediate information. */
+ ir_type *repr_class; /**< If this entity represents a class info, the associated class. */
/* ------------- fields for entities owned by a class type ---------------*/
/* ------------- fields for entities owned by a class type ---------------*/
# endif /* DEBUG_libfirm */
};
# endif /* DEBUG_libfirm */
};
-/** Initialize entity module. */
+/** Initialize the entity module. */
void firm_init_entity(void);
void firm_init_entity(void);
return _get_entity_visited(ent) < firm_type_visited;
}
return _get_entity_visited(ent) < firm_type_visited;
}
+static INLINE ir_type *
+_get_entity_repr_class(const entity *ent) {
+ assert(ent && ent->kind == k_entity);
+ return ent->repr_class;
+}
+
#define is_entity(thing) _is_entity(thing)
#define get_entity_name(ent) _get_entity_name(ent)
#define get_entity_ident(ent) _get_entity_ident(ent)
#define is_entity(thing) _is_entity(thing)
#define get_entity_name(ent) _get_entity_name(ent)
#define get_entity_ident(ent) _get_entity_ident(ent)
#define mark_entity_visited(ent) _mark_entity_visited(ent)
#define entity_visited(ent) _entity_visited(ent)
#define entity_not_visited(ent) _entity_not_visited(ent)
#define mark_entity_visited(ent) _mark_entity_visited(ent)
#define entity_visited(ent) _entity_visited(ent)
#define entity_not_visited(ent) _entity_not_visited(ent)
+#define get_entity_repr_class(ent) _get_entity_repr_class(ent)
+
#endif /* _FIRM_TR_ENTITY_T_H_ */
#endif /* _FIRM_TR_ENTITY_T_H_ */
# include <stdlib.h>
#endif
# include <stdlib.h>
#endif
-# include "xmalloc.h"
-# include "irprog_t.h"
-# include "ircons.h"
-# include "tpop_t.h"
-# include "typegmod.h"
-# include "mangle.h"
-# include "tv_t.h"
-# include "irhooks.h"
-# include "irtools.h"
+#include "xmalloc.h"
+#include "irprog_t.h"
+#include "ircons.h"
+#include "tpop_t.h"
+#include "typegmod.h"
+#include "mangle.h"
+#include "tv_t.h"
+#include "irhooks.h"
+#include "irtools.h"
+#include "entity_t.h"
/*-----------------------------------------------------------------*/
/** TYPE **/
/*-----------------------------------------------------------------*/
/** TYPE **/
}
void set_class_type_info(ir_type *clss, entity *ent) {
clss->attr.ca.type_info = ent;
}
void set_class_type_info(ir_type *clss, entity *ent) {
clss->attr.ca.type_info = ent;
+ if (ent)
+ ent->repr_class = clss;
}
const char *get_peculiarity_name(ir_peculiarity p) {
}
const char *get_peculiarity_name(ir_peculiarity p) {
GCC: __attribute__((malloc)). */
mtp_property_intrinsic = 0x00000040, /**< This method is intrinsic. It is expected that
a lowering phase will remove all calls to it. */
GCC: __attribute__((malloc)). */
mtp_property_intrinsic = 0x00000040, /**< This method is intrinsic. It is expected that
a lowering phase will remove all calls to it. */
+ mtp_property_runtime = 0x00000080, /**< This method represents a runtime routine. */
mtp_property_inherited = (1<<31) /**< Internal. Used only in irg's, means property is
inherited from type. */
} mtp_additional_property;
mtp_property_inherited = (1<<31) /**< Internal. Used only in irg's, means property is
inherited from type. */
} mtp_additional_property;