2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Generic hooks for various libFirm functions.
17 hook_entry_t *hooks[hook_last];
19 void register_hook(hook_type_t hook, hook_entry_t *entry)
21 /* check if a hook function is specified. It's a union, so no matter which one */
22 if (! entry->hook._hook_turn_into_id)
25 /* hook should not be registered yet */
26 assert(entry->next == NULL && hooks[hook] != entry);
28 entry->next = hooks[hook];
32 void unregister_hook(hook_type_t hook, hook_entry_t *entry)
36 if (hooks[hook] == entry) {
37 hooks[hook] = entry->next;
42 for (p = hooks[hook]; p && p->next != entry; p = p->next) {
46 p->next = entry->next;