hooks for libFirm functions added
[libfirm] / ir / ir / irhooks.c
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/irhooks.c
4  * Purpose:     Generic hooks for various libFirm functions.
5  * Author:      Michael Beck
6  * Created:
7  * CVS-ID:      $Id$
8  * Copyright:   (C) 1998-2005 Universität Karlsruhe
9  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
10  */
11
12 /**
13  * @file irhooks.c
14  *
15  * Generic hooks for various libFirm functions.
16  *
17  * @author Michael Beck
18  */
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include "irhooks.h"
24
25 #ifdef FIRM_ENABLE_HOOKS
26
27 /* the hooks */
28 hook_entry_t *hooks[hook_last];
29
30 /* register a hook */
31 void register_hook(hook_type_t hook, hook_entry_t *entry) {
32   if (! entry->hook._hook_turn_into_id)
33     return;
34
35   entry->next = hooks[hook];
36   hooks[hook] = entry;
37 }
38
39 #else
40
41 void register_hook(hook_type_t hook, hook_entry_t *entry) {}
42
43 #endif /* FIRM_ENABLE_HOOKS */