summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bemodule.h
blob: 27164b33f3b7dfdc1b9fc5e84eb078e9f1067b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief       Backend module interface.
 * @author      Matthias Braun
 * @date        11.12.2006
 */
#ifndef FIRM_BE_BEMODULE_H
#define FIRM_BE_BEMODULE_H

/**
 * Mark a function as module constructor.
 * Currently you have to add modules manually in the list in bemodule.c.
 * However future extensions might allow them to be automatically discovered
 * when they are marked with BE_REGISTER_MODULE_CONSTRUCTOR
 *
 * Add this before your constructor as it will declare the function
 */
#define BE_REGISTER_MODULE_CONSTRUCTOR(func)         void func(void);

/**
 * Mark a function as module destructor.
 *
 * Add this before your constructor as it will declare the function
 */
#define BE_REGISTER_MODULE_DESTRUCTOR(func)          void func(void);

/**
 * Call all module constructors
 */
void be_init_modules(void);

/**
 * Call all module destructors
 */
void be_quit_modules(void);

//---------------------------------------------------------------------------

#include "lc_opts.h"

typedef struct be_module_list_entry_t be_module_list_entry_t;

void be_add_module_to_list(be_module_list_entry_t **list_head, const char *name,
                           void *module);

void be_add_module_list_opt(lc_opt_entry_t *grp, const char *name,
                            const char *description,
                            be_module_list_entry_t * const * first,
                            void **var);

#endif