finalize debug stuff before arch_env_done which frees be_emitter
[libfirm] / ir / ir / irhooks.c
index 490b77e..478f2e2 100644 (file)
@@ -25,6 +25,8 @@
  */
 #include "config.h"
 
+#include <assert.h>
+
 #include "irhooks.h"
 
 /* the hooks */
@@ -37,6 +39,9 @@ void register_hook(hook_type_t hook, hook_entry_t *entry)
   if (! entry->hook._hook_turn_into_id)
     return;
 
+  /* hook should not be registered yet */
+  assert(entry->next == NULL && hooks[hook] != entry);
+
   entry->next = hooks[hook];
   hooks[hook] = entry;
 }