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.
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. */
+ unsigned usage:4; /**< flag indicating usage types of this entity, see ir_entity_usage. */
unsigned final:1; /**< If set, this entity cannot be overridden. */
unsigned compiler_gen:1; /**< If set, this entity was compiler generated. */
unsigned backend_marked:1; /**< If set, this entity was marked by the backend for emission. */
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
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 */
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
_get_entity_irg(const ir_entity *ent) {
ir_graph *irg;
assert(ent && ent->kind == k_entity);
- assert(ent == unknown_entity || is_Method_type(ent->type));
+ if (!is_Method_type(ent->type) || ent == unknown_entity) {
+ return NULL;
+ }
+
irg = ent->attr.mtd_attr.irg;
if (irg != NULL && !get_visit_pseudo_irgs() && is_pseudo_ir_graph(irg))
return NULL;
#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)