type: Make an assert()ion independent of the last entry of an enum.
[cparser] / driver / firm_opt.h
1 /*
2  * This file is part of cparser.
3  * Copyright (C) 2012 Michael Beck <mm.beck@gmx.net>
4  */
5 #ifndef FIRM_OPT_H
6 #define FIRM_OPT_H
7
8 #include <stdio.h>
9 #include <libfirm/firm_types.h>
10 #include <libfirm/dbginfo.h>
11
12 enum rts_names {
13         rts_debugbreak,  /**< the name of the __debugbreak() intrinsic */
14         rts_abort,       /**< the name of the abort() function */
15         rts_abs,         /**< the name of the abs() function */
16         rts_alloca,      /**< the name of the alloca() function */
17         rts_labs,        /**< the name of the labs() function */
18         rts_llabs,       /**< the name of the llabs() function */
19         rts_imaxabs,     /**< the name of the imaxabs() function */
20
21         /* double -> double functions */
22         rts_fabs,        /**< the name of the fabs() function */
23         rts_sqrt,        /**< the name of the sqrt() function */
24         rts_cbrt,        /**< the name of the cbrt() function */
25         rts_pow,         /**< the name of the pow() function */
26         rts_exp,         /**< the name of the exp() function */
27         rts_exp2,        /**< the name of the exp2() function */
28         rts_exp10,       /**< the name of the exp10() function */
29         rts_log,         /**< the name of the log() function */
30         rts_log2,        /**< the name of the log2() function */
31         rts_log10,       /**< the name of the log10() function */
32         rts_sin,         /**< the name of the sin() function */
33         rts_cos,         /**< the name of the cos() function */
34         rts_tan,         /**< the name of the tan() function */
35         rts_asin,        /**< the name of the asin() function */
36         rts_acos,        /**< the name of the acos() function */
37         rts_atan,        /**< the name of the atan() function */
38         rts_sinh,        /**< the name of the sinh() function */
39         rts_cosh,        /**< the name of the cosh() function */
40         rts_tanh,        /**< the name of the tanh() function */
41
42         /* float -> float functions */
43         rts_fabsf,       /**< the name of the fabsf() function */
44         rts_sqrtf,       /**< the name of the sqrtf() function */
45         rts_cbrtf,       /**< the name of the cbrtf() function */
46         rts_powf,        /**< the name of the powf() function */
47         rts_expf,        /**< the name of the expf() function */
48         rts_exp2f,       /**< the name of the exp2f() function */
49         rts_exp10f,      /**< the name of the exp10f() function */
50         rts_logf,        /**< the name of the logf() function */
51         rts_log2f,       /**< the name of the log2f() function */
52         rts_log10f,      /**< the name of the log10f() function */
53         rts_sinf,        /**< the name of the sinf() function */
54         rts_cosf,        /**< the name of the cosf() function */
55         rts_tanf,        /**< the name of the tanf() function */
56         rts_asinf,       /**< the name of the asinf() function */
57         rts_acosf,       /**< the name of the acosf() function */
58         rts_atanf,       /**< the name of the atanf() function */
59         rts_sinhf,       /**< the name of the sinhf() function */
60         rts_coshf,       /**< the name of the coshf() function */
61         rts_tanhf,       /**< the name of the tanhf() function */
62
63         /* long double -> long double functions */
64         rts_fabsl,       /**< the name of the fabsl() function */
65         rts_sqrtl,       /**< the name of the sqrtl() function */
66         rts_cbrtl,       /**< the name of the cbrtl() function */
67         rts_powl,        /**< the name of the powl() function */
68         rts_expl,        /**< the name of the expl() function */
69         rts_exp2l,       /**< the name of the exp2l() function */
70         rts_exp10l,      /**< the name of the exp10l() function */
71         rts_logl,        /**< the name of the log() function */
72         rts_log2l,       /**< the name of the log2() function */
73         rts_log10l,      /**< the name of the log10() function */
74         rts_sinl,        /**< the name of the sinl() function */
75         rts_cosl,        /**< the name of the cosl() function */
76         rts_tanl,        /**< the name of the tanl() function */
77         rts_asinl,       /**< the name of the asinl() function */
78         rts_acosl,       /**< the name of the acosl() function */
79         rts_atanl,       /**< the name of the atanl() function */
80         rts_sinhl,       /**< the name of the sinhl() function */
81         rts_coshl,       /**< the name of the coshl() function */
82         rts_tanhl,       /**< the name of the tanhl() function */
83
84         /* string functions */
85         rts_strcmp,      /**< the name of the strcmp() function */
86         rts_strncmp,     /**< the name of the strncmp() function */
87         rts_strcpy,      /**< the name of the strcpy() function */
88         rts_strlen,      /**< the name of the strlen() function */
89         rts_memcpy,      /**< the name of the memcpy() function */
90         rts_mempcpy,     /**< the name of the mempcpy() function */
91         rts_memmove,     /**< the name of the memmove() function */
92         rts_memset,      /**< the name of the memset() function */
93         rts_memcmp,      /**< the name of the memcmp() function */
94
95         rts_max
96 };
97
98 extern ir_entity *rts_entities[rts_max];
99
100 /** Initialize for the Firm-generating back end. */
101 void gen_firm_init(void);
102
103 /** free resources hold by firm-generating back end */
104 void gen_firm_finish(void);
105
106 /**
107  * Transform, optimize and generate code
108  *
109  * @param out                a file handle for the output, may be NULL
110  * @param input_filename     the name of the (main) source file
111  */
112 void generate_code(FILE *out, const char *input_filename);
113
114 /** process optimization commandline option */
115 int firm_option(const char *opt);
116
117 typedef void (*print_option_help_func)(const char *name, const char *description);
118
119 void firm_option_help(print_option_help_func func);
120
121 /** Choose an optimization level. (Typically used to interpret the -O compiler
122  * switches) */
123 void choose_optimization_pack(int level);
124
125 /**
126  * Initialize implicit optimization settings in firm. Frontends should call this
127  * before starting graph construction
128  */
129 void init_implicit_optimizations(void);
130
131 #endif