From: Michael Beck Date: Mon, 24 Oct 2005 11:06:59 +0000 (+0000) Subject: new entity hook added X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f9d916d24111a4b271cee4100a322444bf6cbc3c;p=libfirm new entity hook added [r6787] --- diff --git a/ir/ir/irhooks.h b/ir/ir/irhooks.h index d834a8d92..235fdca53 100644 --- a/ir/ir/irhooks.h +++ b/ir/ir/irhooks.h @@ -147,6 +147,9 @@ typedef struct hook_entry { /** This hook is called after a new mode was registered. */ void (*_hook_new_mode)(void *context, const ir_mode *tmpl, ir_mode *mode); + + /** This hook is called after a new entity was created */ + void (*_hook_new_entity)(void *context, entity *ent); } hook; /** the context for every hook */ @@ -183,6 +186,7 @@ typedef enum { hook_arch_dep_replace_mul_with_shifts, hook_arch_dep_replace_division_by_const, hook_new_mode, + hook_new_entity, hook_last } hook_type_t; @@ -256,6 +260,7 @@ extern hook_entry_t *hooks[hook_last]; #define hook_arch_dep_replace_division_by_const(irn) \ hook_exec(hook_arch_dep_replace_division_by_const, (ctx, irn)) #define hook_new_mode(tmpl, mode) hook_exec(hook_new_mode, (ctx, tmpl, mode)) +#define hook_new_entity(ent) hook_exec(hook_new_entity, (ctx, ent)) /* the initializer, move to hooks_t.h some day */ int init_hooks(void); diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 59e404309..32baff0a5 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -29,6 +29,7 @@ # include "typegmod.h" # include "array.h" # include "irtools.h" +# include "irhooks.h" /* All this is needed to build the constant node for methods: */ # include "irprog_t.h" @@ -159,6 +160,7 @@ new_d_entity (type *owner, ident *name, type *type, dbg_info *db) { /* Remember entity in it's owner. */ insert_entity_in_owner (res); + hook_new_entity(res); return res; }