X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Fentity_t.h;h=6b1eca186d2ddb9eb4e44496ef152af3ec43e178;hb=dd4cd761ab637d4488c7e29f49843b1b02366acf;hp=bbc084b52973ddde1ceb595b703f8d23e7d686d7;hpb=1ce363f80e6a204d4011f85813362d9bd1d0e7e4;p=libfirm diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index bbc084b52..6b1eca186 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -36,6 +36,43 @@ #include "ident.h" #include "pseudo_irg.h" +typedef struct ir_initializer_base_t { + ir_initializer_kind_t kind; +} ir_initializer_base_t; + +/** + * An compound initializer. + */ +typedef struct ir_initializer_compound_t { + ir_initializer_base_t base; + unsigned n_initializers; + ir_initializer_t *initializers[1]; +} ir_initializer_compound_t; + +/** + * An initializer containing an ir_node, + */ +typedef struct ir_initializer_const_t { + ir_initializer_base_t base; + ir_node *value; +} ir_initializer_const_t ; + +/** + * An initializer containing a tarval. + */ +typedef struct ir_initializer_tarval_t { + ir_initializer_base_t base; + tarval *value; +} ir_initializer_tarval_t ; + +union ir_initializer_t { + ir_initializer_kind_t kind; + ir_initializer_base_t base; + ir_initializer_compound_t compound; + ir_initializer_const_t consti; + ir_initializer_tarval_t tarval; +}; + /** A path in a compound graph. */ struct compound_graph_path { firm_kind kind; /**< The dynamic type tag for compound graph path. */ @@ -77,9 +114,8 @@ typedef struct method_ent_attr { in the virtual function table. */ 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. */ - ir_img_section section; /**< The code section where this method should be placed */ + unsigned *param_weight; /**< The weight of method's parameters. Parameters + with a high weight are good candidates for procedure cloning. */ } method_ent_attr; @@ -108,17 +144,18 @@ struct ir_entity { unsigned align:1; /**< Specifies alignment of entities content. */ unsigned stickyness:2; /**< Specifies whether this entity is sticky. */ unsigned peculiarity:3; /**< The peculiarity of this entity. */ - unsigned address_taken:3; /**< A flag that can be set to mark address taken entities. */ + unsigned usage:4; /**< flag indicating usage types of this entity. */ 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 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 by offset. */ - unsigned long visit; /**< visited counter for walks of the type information. */ + ir_visited_t 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. */ @@ -136,6 +173,8 @@ struct ir_entity { compound_ent_attr cmpd_attr; /* ------------- fields for method entities ---------------- */ method_ent_attr mtd_attr; + /* entity initializer */ + ir_initializer_t *initializer; } attr; /**< type specific attributes */ /* ------------- fields for analyses ---------------*/ @@ -330,19 +369,16 @@ _set_entity_backend_marked(ir_entity *ent, int flag) { ent->backend_marked = flag ? 1 : 0; } -static INLINE ir_address_taken_state -_get_entity_address_taken(const ir_entity *ent) { +static INLINE ir_entity_usage +_get_entity_usage(const ir_entity *ent) { assert(ent && ent->kind == k_entity); - return ent->address_taken; + return ent->usage; } static INLINE void -_set_entity_address_taken(ir_entity *ent, ir_address_taken_state state) { +_set_entity_usage(ir_entity *ent, ir_entity_usage state) { assert(ent && ent->kind == k_entity); - assert(state == ir_address_not_taken || - state == ir_address_taken_unknown || - state == ir_address_taken); - ent->address_taken = state; + ent->usage = state; } static INLINE int @@ -392,14 +428,14 @@ _get_entity_irg(const ir_entity *ent) { return irg; } -static INLINE unsigned long +static INLINE ir_visited_t _get_entity_visited(ir_entity *ent) { assert(ent && ent->kind == k_entity); return ent->visit; } static INLINE void -_set_entity_visited(ir_entity *ent, unsigned long num) { +_set_entity_visited(ir_entity *ent, ir_visited_t num) { assert(ent && ent->kind == k_entity); ent->visit = num; } @@ -465,8 +501,8 @@ _set_entity_dbg_info(ir_entity *ent, dbg_info *db) { #define set_entity_compiler_generated(ent, flag) _set_entity_compiler_generated(ent, flag) #define is_entity_backend_marked(ent) _is_entity_backend_marked(ent) #define set_entity_backend_marked(ent, flag) _set_entity_backend_marked(ent, flag) -#define get_entity_address_taken(ent) _get_entity_address_taken(ent) -#define set_entity_address_taken(ent, flag) _set_entity_address_taken(ent, flag) +#define get_entity_usage(ent) _get_entity_usage(ent) +#define set_entity_usage(ent, flags) _set_entity_usage(ent, flags) #define get_entity_offset(ent) _get_entity_offset(ent) #define set_entity_offset(ent, offset) _set_entity_offset(ent, offset) #define get_entity_offset_bits_remainder(ent) _get_entity_offset_bits_remainder(ent)