new entity hook added
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 24 Oct 2005 11:06:59 +0000 (11:06 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 24 Oct 2005 11:06:59 +0000 (11:06 +0000)
[r6787]

ir/ir/irhooks.h
ir/tr/entity.c

index d834a8d..235fdca 100644 (file)
@@ -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);
index 59e4043..32baff0 100644 (file)
@@ -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;
 }