change pn_XXX_max enum to really be the maximum pn and not maximum+1, add n_XXX_max...
[libfirm] / ir / be / bemodule.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       Backend module interface.
23  * @author      Matthias Braun
24  * @date        11.12.2006
25  * @version     $Id$
26  */
27 #ifndef FIRM_BE_BEMODULE_H
28 #define FIRM_BE_BEMODULE_H
29
30 /**
31  * Mark a function as module constructor.
32  * Currently you have to add modules manually in the list in bemodule.c.
33  * However future extensions might allow them to be automatically discovered
34  * when they are marked with BE_REGISTER_MODULE_CONSTRUCTOR
35  *
36  * Add this before your constructor as it will declare the function
37  */
38 #define BE_REGISTER_MODULE_CONSTRUCTOR(func)         void func(void);
39
40 /**
41  * Mark a function as module destructor.
42  *
43  * Add this before your constructor as it will declare the function
44  */
45 #define BE_REGISTER_MODULE_DESTRUCTOR(func)          void func(void);
46
47 /**
48  * Call all module constructors
49  */
50 void be_init_modules(void);
51
52 /**
53  * Call all module destructors
54  */
55 void be_quit_modules(void);
56
57 //---------------------------------------------------------------------------
58
59 #include "lc_opts.h"
60
61 typedef struct be_module_list_entry_t be_module_list_entry_t;
62
63 void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
64                            void *module);
65
66 void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
67                             const char *description,
68                             be_module_list_entry_t * const * first,
69                             void **var);
70
71 #endif /* FIRM_BE_BEMODULE_H */