adapt to new firm dumper interface
[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   OS_SUPPORT_MACHO          /**< create code for MacOS Mach-O */
19 } an_os_support;
20
21 enum a_debug_mode {
22   DBG_MODE_NONE      = 0,   /**< no special debug support */
23   DBG_MODE_BACKSTORE = 1,   /**< backstores are created */
24   DBG_MODE_FULL      = 2,   /**< no register valiables */
25 };
26
27 /* optimization settings */
28 struct a_firm_opt {
29   a_byte   enabled;         /**< enable all optimizations */
30   a_byte   debug_mode;      /**< debug mode: store all local variables */
31   a_byte   const_folding;   /**< enable constant folding */
32   a_byte   cse;             /**< enable common-subexpression elimination */
33   a_byte   control_flow;    /**< enable control flow optimizations */
34   a_byte   gcse;            /**< enable global common-subexpression elimination */
35   a_byte   confirm;         /**< enable Confirm optimization */
36   a_byte   muls;            /**< enable architecture dependent mul optimization */
37   a_byte   divs;            /**< enable architecture dependent div optimization */
38   a_byte   mods;            /**< enable architecture dependent mod optimization */
39   a_byte   alias_analysis;  /**< enable Alias Analysis */
40   a_byte   strict_alias;    /**< enable strict Alias Analysis (using type based AA) */
41   a_byte   no_alias;        /**< no aliasing possible. */
42   a_byte   cc_opt;          /**< optimize calling conventions */
43   a_byte   freestanding;    /**< if set, freestanding mode is enabled */
44   a_byte   fp_model;        /**< fp model */
45   a_byte   vrfy;            /**< Firm verifier setting */
46   a_byte   check_all;       /**< enable checking all Firm phases */
47   a_byte   lower;           /**< enable Firm lowering */
48   a_byte   os_support;      /**< current os support */
49   a_byte   honor_restrict;  /**< enable restrict keyword */
50   a_byte   lower_bitfields; /**< lower bitfield access */
51   a_byte   pic;             /**< generate position independent code */
52   int      clone_threshold; /**< The threshold value for procedure cloning. */
53   unsigned inline_maxsize;  /**< Maximum function size for inlining. */
54   unsigned inline_threshold;/**< Inlining benefice threshold. */
55   a_byte   vrfy_edges;      /**< verify edges */
56   a_byte   grs_simd_opt;
57   a_byte   grs_create_pattern;
58   unsigned spare_size;      /**< allowed spare size for table switches in machine words. */
59   a_byte   enable_statev;   /**< enable statev output */
60   char     *statev_filter;  /**< statev filter */
61 };
62
63 /** statistic options */
64 typedef enum a_firmstat_selection_tag {
65   STAT_NONE        = 0x00000000,
66   STAT_BEFORE_OPT  = 0x00000001,
67   STAT_AFTER_OPT   = 0x00000002,
68   STAT_AFTER_LOWER = 0x00000004,
69   STAT_FINAL_IR    = 0x00000008,
70   STAT_FINAL       = 0x00000010,
71 } a_firmstat_selection;
72
73 /* backend selection */
74 typedef enum a_backend_selection_tag {
75   BE_NONE      = 0,       /**< no backend */
76   BE_FIRM_BE   = 1,       /**< Use Firm internal backend facility. */
77   BE_FIRM2C    = 2        /**< Use generic Firm2C backend */
78 } a_backend_selection;
79
80 /* dumping options */
81 struct a_firm_dump {
82   a_byte debug_print;   /**< enable debug print */
83   a_byte all_types;     /**< dump the All_types graph */
84   a_byte no_blocks;     /**< dump non-blocked graph */
85   a_byte extbb;         /**< dumps extended basic blocks */
86   a_byte ir_graph;      /**< dump all graphs */
87   a_byte all_phases;    /**< dump the IR graph after all phases */
88   a_byte statistic;     /**< Firm statistic setting */
89   a_byte stat_pattern;  /**< enable Firm statistic pattern */
90   a_byte stat_dag;      /**< enable Firm DAG statistic */
91   char   *filter;       /**< the dump filter */
92 };
93
94 struct a_firm_be_opt {
95   a_byte selection;
96   a_byte node_stat;
97 };
98
99 #ifdef FIRM_EXT_GRS
100 struct a_firm_ext_grs {
101   a_byte simd_opt;          /**< enable graph based SIMD optimization */
102   a_byte create_pattern;    /**< enable pattern creation for SIMD opts */
103 };
104 #endif
105
106
107 extern struct a_firm_be_opt firm_be_opt;
108 extern struct a_firm_opt firm_opt;
109 extern struct a_firm_dump firm_dump;
110 extern struct a_firm_ext_grs firm_ext_grs;
111
112 void print_option_help(const char *name, const char *description);
113
114 /**
115  * prints the firm version number
116  */
117 void print_firm_version(FILE *f);
118
119 /**
120  * called by the generic command line parser
121  * to handle the --firm= or -f options
122  */
123 int firm_option(const char *opt);
124
125 #endif