From 5496f8d79b51ffee7f8e91953e957a59c93f473e Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 17 Oct 2005 17:02:58 +0000 Subject: [PATCH] added calling conventions to entities renamed init_entity() into firm_init_entity() [r6711] --- ir/tr/entity.c | 16 +++++++++++++--- ir/tr/entity.h | 13 ++++++------- ir/tr/entity_t.h | 32 +++++++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 6ad368dd5..59e404309 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -1308,12 +1308,22 @@ void (set_entity_additional_property)(entity *ent, unsigned flag) { _set_entity_additional_property(ent, (irg_additional_property)flag); } -void init_entity(void) +/* Returns the calling convention of an entities graph. */ +unsigned (get_entity_calling_convention)(const entity *ent) { + return _get_entity_calling_convention(ent); +} + +/* 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); +} + +void firm_init_entity(void) { symconst_symbol sym; - assert(firm_unknown_type && "Call init_type before init_entity!"); - assert(!unknown_entity && "Call init_entity only once!"); + assert(firm_unknown_type && "Call init_type() before firm_init_entity()!"); + assert(!unknown_entity && "Call firm_init_entity() only once!"); unknown_entity = new_rd_entity(NULL, firm_unknown_type, new_id_from_str(UNKNOWN_ENTITY_NAME), firm_unknown_type); set_entity_visibility(unknown_entity, visibility_external_allocated); set_entity_ld_ident(unknown_entity, get_entity_ident(unknown_entity)); diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 0c2c1e83d..b848c56d2 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -71,13 +71,6 @@ # include "tr_inheritance.h" -/*-----------------------------------------------------------------*/ -/* general */ -/*-----------------------------------------------------------------*/ - -/** Initalize entity module. */ -void init_entity (void); - /*-----------------------------------------------------------------*/ /* ENTITY */ /*-----------------------------------------------------------------*/ @@ -555,6 +548,12 @@ 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); + /** * @page unknown_entity * diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index 160671c04..19b9d6fe2 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -83,7 +83,7 @@ struct entity { of owner is determined. */ 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. */ + struct dbg_info *dbi; /**< A pointer to information for debug support. */ /* ------------- fields for atomic entities ---------------*/ @@ -111,6 +111,8 @@ struct entity { 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. */ /* ------------- fields for analyses ---------------*/ @@ -121,6 +123,8 @@ struct entity { # endif /* DEBUG_libfirm */ }; +/** Initialize entity module. */ +void firm_init_entity(void); /* ----------------------- inline functions ------------------------ */ @@ -360,6 +364,30 @@ _set_entity_additional_property(entity *ent, irg_additional_property flag) { 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) @@ -394,5 +422,7 @@ _set_entity_additional_property(entity *ent, irg_additional_property flag) { #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_ */ -- 2.20.1