res->value = new_SymConst(sym, symconst_addr_ent);
current_ir_graph = rem;
res->variability = variability_constant;
- res->irg_add_properties = irg_no_property;
+ res->irg_add_properties = mtp_property_inherited;
res->param_access = NULL;
res->param_weight = NULL;
}
return _entity_not_visited(ent);
}
-unsigned (get_entity_additional_properties)(const entity *ent) {
- return _get_entity_additional_properties(ent);
-}
+/* Returns the mask of the additional entity properties. */
+unsigned get_entity_additional_properties(entity *ent) {
+ ir_graph *irg;
-void (set_entity_additional_properties)(entity *ent, unsigned property_mask) {
- _set_entity_additional_properties(ent, property_mask);
-}
+ assert(is_Method_type(get_entity_type(ent)));
+
+ /* first check, if the graph has additional properties */
+ irg = get_entity_irg(ent);
+
+ if (irg)
+ return get_irg_additional_properties(irg);
+
+ if (ent->irg_add_properties & mtp_property_inherited)
+ return get_method_additional_properties(get_entity_type(ent));
-void (set_entity_additional_property)(entity *ent, unsigned flag) {
- _set_entity_additional_property(ent, (irg_additional_property)flag);
+ return ent->irg_add_properties;
}
-/* Returns the calling convention of an entities graph. */
-unsigned (get_entity_calling_convention)(const entity *ent) {
- return _get_entity_calling_convention(ent);
+/* Sets the mask of the additional graph properties. */
+void set_entity_additional_properties(entity *ent, unsigned property_mask)
+{
+ ir_graph *irg;
+
+ assert(is_Method_type(get_entity_type(ent)));
+
+ /* first check, if the graph exists */
+ irg = get_entity_irg(ent);
+ if (irg)
+ set_irg_additional_properties(irg, property_mask);
+ else {
+ /* do not allow to set the mtp_property_inherited flag or
+ * the automatic inheritance of flags will not work */
+ ent->irg_add_properties = property_mask & ~mtp_property_inherited;
+ }
}
-/* Sets the calling convention of an entities graph. */
-void (set_entity_calling_convention)(entity *ent, unsigned cc_mask) {
- _set_entity_calling_convention(ent, cc_mask);
+/* Sets one additional graph property. */
+void set_entity_additional_property(entity *ent, mtp_additional_property flag)
+{
+ ir_graph *irg;
+
+ assert(is_Method_type(get_entity_type(ent)));
+
+ /* first check, if the graph exists */
+ irg = get_entity_irg(ent);
+ if (irg)
+ set_irg_additional_property(irg, flag);
+ else {
+ unsigned mask = ent->irg_add_properties;
+
+ if (mask & mtp_property_inherited)
+ mask = get_method_additional_properties(get_entity_type(ent));
+
+ /* do not allow to set the mtp_property_inherited flag or
+ * the automatic inheritance of flags will not work */
+ ent->irg_add_properties = mask | (flag & ~mtp_property_inherited);
+ }
}
void firm_init_entity(void)
/** Returns true if this entity was not visited. */
int entity_not_visited(entity *ent);
-/** Returns the mask of the additional graph properties. */
-unsigned get_entity_additional_properties(const entity *ent);
+/**
+ * Returns the mask of the additional entity properties.
+ * The properties are automatically inherited from the irg if available
+ * or from the method type if they were not set using
+ * set_entity_additional_properties() or
+ * set_entity_additional_property().
+ */
+unsigned get_entity_additional_properties(entity *ent);
/** Sets the mask of the additional graph properties. */
void set_entity_additional_properties(entity *ent, unsigned property_mask);
/** Sets one additional graph property. */
-void set_entity_additional_property(entity *ent, unsigned flag);
-
-/** Returns the calling convention of an entities graph. */
-unsigned get_entity_calling_convention(const entity *ent);
-
-/** Sets the calling convention of an entities graph. */
-void set_entity_calling_convention(entity *ent, unsigned cc_mask);
+void set_entity_additional_property(entity *ent, mtp_additional_property flag);
/**
* @page unknown_entity
ent_variability variability; /**< Specifies variability of entities content */
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
+ int offset; /**< Offset in bits for this entity. Fixed when layout
of owner is determined. */
- void *link; /**< To store some intermediate information */
+ peculiarity peculiarity; /**< peculiarity 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 */
/* ------------- fields for atomic entities ---------------*/
/* ------------- fields for methods ---------------*/
- 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. */
- unsigned irg_add_properties; /**< If (type == method_type) this is a set of additional.
- graph flags if the irg of an entity is not known. */
- unsigned irg_calling_conv; /**< If (type == method_type) this is a set of calling.
- convention flags if the irg of an entity is not known. */
+ unsigned irg_add_properties; /**< Additional graph properties can be
+ stored in a entity if no irg is available. */
+
ptr_access_kind *param_access; /**< the parameter access */
float *param_weight; /**< The weight of method's parameters. Parameters
with a high weight are good for procedure cloning.*/
return _get_entity_visited(ent) < firm_type_visited;
}
-static INLINE unsigned
-_get_entity_additional_properties(const entity *ent) {
- ir_graph *irg;
- assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
- irg = _get_entity_irg(ent);
- return irg ?
- get_irg_additional_properties(irg) :
- ent->irg_add_properties;
-}
-
-static INLINE void
-_set_entity_additional_properties(entity *ent, unsigned mask) {
- ir_graph *irg;
- assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
- irg = _get_entity_irg(ent);
- if (irg)
- set_irg_additional_properties(irg, mask);
- else
- ent->irg_add_properties = mask;
-}
-
-static INLINE void
-_set_entity_additional_property(entity *ent, irg_additional_property flag) {
- ir_graph *irg;
- assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
- irg = _get_entity_irg(ent);
- if (irg)
- set_irg_additional_property(irg, flag);
- else
- ent->irg_add_properties |= flag;
-}
-
-static INLINE unsigned
-_get_entity_calling_convention(const entity *ent) {
- ir_graph *irg;
- assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
- irg = _get_entity_irg(ent);
- if (irg)
- return get_irg_calling_convention(irg);
- else
- return ent->irg_calling_conv;
-}
-
-static INLINE void
-_set_entity_calling_convention(entity *ent, unsigned cc_mask) {
- ir_graph *irg;
- assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
- irg = _get_entity_irg(ent);
- if (irg)
- set_irg_calling_convention(irg, cc_mask);
- else
- ent->irg_calling_conv = cc_mask;
-}
-
#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 get_entity_additional_properties(ent) _get_entity_additional_properties(ent)
-#define set_entity_additional_properties(ent, m) _set_entity_additional_properties(ent, m)
-#define set_entity_additional_property(ent, f) _set_entity_additional_property(ent, f)
-#define get_entity_calling_convention(ent) _get_entity_calling_convention(ent)
-#define set_entity_calling_convention(ent, cc) _set_entity_calling_convention(ent, cc)
# endif /* _ENTITY_T_H_ */