Do no include -Wswitch-default in -Wall.
[cparser] / driver / firm_cmdline.h
1 /**
2  * @file firm_cmdline.h -- Additional Firm generating backend parameters
3  *
4  * Generates Firm fro the IL.  It works with both C++ and C programs.
5  *
6  * Compile with STANDALONE_CP_FIRM_BE defined and BACK_END_IS_CP_FIRM_BE
7  * defined as 1 to get a main program back end.  Otherwise, a version to be
8  * called in the same program as the front end is produced (if needed).
9  */
10 #ifndef FIRM_CMDLINE_H
11 #define FIRM_CMDLINE_H
12
13 #include "fe_common.h"
14
15 enum an_os_support {
16   OS_SUPPORT_LINUX,         /**< create code for Linux OS */
17   OS_SUPPORT_MINGW          /**< create code for MinGW WIN32 */
18 } an_os_support;
19
20 enum a_debug_mode {
21   DBG_MODE_NONE      = 0,   /**< no special debug support */
22   DBG_MODE_BACKSTORE = 1,   /**< backstores are created */
23   DBG_MODE_FULL      = 2,   /**< no register valiables */
24 };
25
26 /* optimization settings */
27 struct a_firm_opt {
28   a_byte   enabled;         /**< enable all optimizations */
29   a_byte   debug_mode;      /**< debug mode: store all local variables */
30   a_byte   const_folding;   /**< enable constant folding */
31   a_byte   reassoc;         /**< enable reassociation */
32   a_byte   cse;             /**< enable common-subexpression elimination */
33   a_byte   control_flow;    /**< enable control flow optimizations */
34   a_byte   code_place;      /**< enable global common-subexpression elimination
35                                  and code placement */
36   a_byte   gvn_pre;         /**< enable global common-subexpression elimination
37                                  and partial redundancy elimination */
38   a_byte   cond_eval;       /**< enable condition evaluation */
39   a_byte   if_conversion;   /**< enable if-conversion */
40   a_byte   loop_unrolling;  /**< enable automatic loop unrolling */
41   a_byte   func_calls;      /**< enable function call optimization */
42   a_byte   do_inline;       /**< do automatic inlining */
43   a_byte   auto_inline;     /**< current automatic inlining state */
44   a_byte   tail_rec;        /**< tail recursion optimization */
45   a_byte   strength_red;    /**< enable strength reduction */
46   a_byte   scalar_replace;  /**< enable scalar replacement */
47   a_byte   confirm;         /**< enable Confirm optimization */
48   a_byte   muls;            /**< enable architecture dependent mul optimization */
49   a_byte   divs;            /**< enable architecture dependent div optimization */
50   a_byte   mods;            /**< enable architecture dependent mod optimization */
51   a_byte   fragile_ops;     /**< enable fragile ops optimization */
52   a_byte   load_store;      /**< enable load store optimization */
53   a_byte   modes;           /**< enable integer mode optimizations */
54   a_byte   precise_exc;     /**< use precise exception context */
55   a_byte   use_DivMod;      /**< use DivMod nodes */
56   a_byte   remove_unused;   /**< remove unused functions */
57   a_byte   jmp_tbls;        /**< create jump table for switch */
58   a_byte   cloning;         /**< enable procedure cloning */
59   a_byte   auto_sync;       /**< automatically create Sync nodes */
60   a_byte   alias_analysis;  /**< enable Alias Analysis */
61   a_byte   strict_alias;    /**< enable strict Alias Analysis (using type based AA) */
62   a_byte   no_alias;        /**< no aliasing possible. */
63   a_byte   luffig;          /**< enable fluffy load/store optimization */
64   a_byte   deconv;          /**< enable conv node optimization */
65   a_byte   cc_opt;          /**< optimize calling conventions */
66   a_byte   bool_opt;        /**< perform bool simplification */
67   a_byte   freestanding;    /**< if set, freestanding mode is enabled */
68   a_byte   fp_model;        /**< fp model */
69   a_byte   lower_ll;        /**< lower double word access */
70   a_byte   vrfy;            /**< Firm verifier setting */
71   a_byte   check_all;       /**< enable checking all Firm phases */
72   a_byte   lower;           /**< enable Firm lowering */
73   a_byte   os_support;      /**< current os support */
74   a_byte   honor_restrict;  /**< enable restrict keyword */
75   a_byte   lower_bitfields; /**< lower bitfield access */
76   a_byte   ycomp_dbg;       /**< yComp debugger extension */
77   char     *ycomp_host;     /**< The host, yComp is running on */
78   int      ycomp_port;      /**< The port, yComp is listening on */
79   int      clone_threshold; /**< The threshold value for procedure cloning. */
80   a_byte   vrfy_edges;      /**< verify edges */
81   a_byte   grs_simd_opt;
82   a_byte   grs_create_pattern;
83   unsigned spare_size;      /**< allowed spare size for table switches in machine words. */
84 };
85
86 /** statistic options */
87 typedef enum a_firmstat_selection_tag {
88   STAT_NONE        = 0x00000000,
89   STAT_BEFORE_OPT  = 0x00000001,
90   STAT_AFTER_OPT   = 0x00000002,
91   STAT_AFTER_LOWER = 0x00000004,
92   STAT_FINAL_IR    = 0x00000008,
93   STAT_FINAL       = 0x00000010,
94 } a_firmstat_selection;
95
96 /* backend selection */
97 typedef enum a_backend_selection_tag {
98   BE_NONE      = 0,       /**< no backend */
99   BE_FIRM_BE   = 1,       /**< Use Firm internal backend facility. */
100   BE_FIRM2C    = 2        /**< Use generic Firm2C backend */
101 } a_backend_selection;
102
103 /* dumping options */
104 struct a_firm_dump {
105   a_byte debug_print;   /**< enable debug print */
106   a_byte all_types;     /**< dump the All_types graph */
107   a_byte no_blocks;     /**< dump non-blocked graph */
108   a_byte extbb;         /**< dumps extended basic blocks */
109   a_byte ir_graph;      /**< dump all graphs */
110   a_byte all_phases;    /**< dump the IR graph after all phases */
111   a_byte edge_labels;   /**< use edge labels when dumping IR graphs */
112   a_byte statistic;     /**< Firm statistic setting */
113   a_byte stat_pattern;  /**< enable Firm statistic pattern */
114   a_byte stat_dag;      /**< enable Firm DAG statistic */
115   a_byte gen_firm_asm;  /**< generate Firm assembler and exit */
116   char   *filter;       /**< the dump filter */
117 };
118
119 struct a_firm_be_opt {
120   a_byte selection;
121   a_byte node_stat;
122 };
123
124 #ifdef FIRM_EXT_GRS
125 struct a_firm_ext_grs {
126   a_byte simd_opt;          /**< enable graph based SIMD optimization */
127   a_byte create_pattern;    /**< enable pattern creation for SIMD opts */
128 };
129 #endif
130
131
132 extern struct a_firm_be_opt firm_be_opt;
133 extern struct a_firm_opt firm_opt;
134 extern struct a_firm_dump firm_dump;
135 extern struct a_firm_ext_grs firm_ext_grs;
136
137
138 /**
139  * prints the firm version number
140  */
141 void print_firm_version(FILE *f);
142
143 /**
144  * called by the generic command line parser
145  * to handle the --firm= or -f options
146  */
147 int firm_option(const char *opt);
148
149 /**
150  * called by the generic command line parser
151  * to handle the --backend= or -b options
152  */
153 int firm_be_option(const char *opt);
154
155 #endif /* FIRM_CMDLINE_H */