wrapped debugging modules with DEBUG_ONLY
[libfirm] / ir / be / ia32 / bearch_ia32_t.h
1 #ifndef _BEARCH_IA32_T_H_
2 #define _BEARCH_IA32_T_H_
3
4 #include "firm_config.h"
5
6 #include "debug.h"
7 #include "bearch_ia32.h"
8 #include "ia32_nodes_attr.h"
9 #include "set.h"
10 #include "../be.h"
11
12 #ifdef NDEBUG
13 #define SET_IA32_ORIG_NODE(n, o)
14 #else
15 #define SET_IA32_ORIG_NODE(n, o) set_ia32_orig_node(n, o);
16 #endif /* NDEBUG */
17
18 /* some typedefs */
19
20 /**
21  * Bitmask for the backend optimization settings.
22  */
23 typedef struct _ia32_optimize_t {
24         unsigned incdec    : 1;   /**< optimize add/sub 1/-1 to inc/dec */
25         unsigned doam      : 1;   /**< do address mode optimizations */
26         unsigned placecnst : 1;   /**< place constants in the blocks where they are used */
27         unsigned immops    : 1;   /**< create operations with immediates */
28         unsigned extbb     : 1;   /**< do extended basic block scheduling */
29 } ia32_optimize_t;
30
31 /** floating point support */
32 typedef enum fp_support {
33   fp_x87,   /**< use x87 instructions */
34   fp_sse2   /**< use SSE2 instructions */
35 } fp_support;
36
37 /**
38  * IA32 code generator
39  */
40 typedef struct _ia32_code_gen_t {
41         const arch_code_generator_if_t *impl;          /**< implementation */
42         ir_graph                       *irg;           /**< current irg */
43         FILE                           *out;           /**< output file */
44         const arch_env_t               *arch_env;      /**< the arch env */
45         set                            *reg_set;       /**< set to memorize registers for non-ia32 nodes (e.g. phi nodes) */
46         int                             emit_decls;    /**< flag indicating if decls were already emitted */
47         pmap                           *types;         /**< A map of modes to primitive types */
48         pmap                           *tv_ent;        /**< A map of entities that store tarvals */
49         const be_irg_t                 *birg;          /**< The be-irg (contains additional information about the irg) */
50         ir_node                        **blk_sched;    /**< an array containing the scheduled blocks */
51         ia32_optimize_t                 opt;           /**< contains optimization information */
52         char                            fp_kind;       /**< floating point kind */
53         char                            used_x87;      /**< x87 floating point unit used in this graph */
54         DEBUG_ONLY(firm_dbg_module_t   *mod;)          /**< debugging module */
55 } ia32_code_gen_t;
56
57 typedef struct _ia32_isa_t {
58         const arch_isa_if_t   *impl;
59         const arch_register_t *sp;            /**< The stack pointer register. */
60         const arch_register_t *bp;            /**< The base pointer register. */
61         const int              stack_dir;     /**< -1 for decreasing, 1 for increasing. */
62         int                    num_codegens;  /**< The number of code generator objects created so far */
63         pmap                  *regs_16bit;    /**< Contains the 16bits names of the gp registers */
64         pmap                  *regs_8bit;     /**< Contains the 8bits names of the gp registers */
65         char                   fp_kind;       /**< floating point kind */
66 #ifndef NDEBUG
67         struct obstack        *name_obst;     /**< holds the original node names (for debugging) */
68         unsigned long          name_obst_size;
69 #endif /* NDEBUG */
70 } ia32_isa_t;
71
72 typedef struct _ia32_irn_ops_t {
73         const arch_irn_ops_if_t *impl;
74         ia32_code_gen_t         *cg;
75 } ia32_irn_ops_t;
76
77 /* this is a struct to minimize the number of parameters
78    for transformation walker */
79 typedef struct _ia32_transform_env_t {
80         dbg_info          *dbg;        /**< The node debug info */
81         ir_graph          *irg;        /**< The irg, the node should be created in */
82         ir_node           *block;      /**< The block, the node should belong to */
83         ir_node           *irn;        /**< The irn, to be transformed */
84         ir_mode           *mode;       /**< The mode of the irn */
85         ia32_code_gen_t   *cg;         /**< The code generator */
86         DEBUG_ONLY(firm_dbg_module_t *mod;) /**< The firm debugger */
87 } ia32_transform_env_t;
88
89 /**
90  * Creates the unique per irg GP NoReg node.
91  */
92 ir_node *ia32_new_NoReg_gp(ia32_code_gen_t *cg);
93
94 /**
95  * Creates the unique per irg FP NoReg node.
96  */
97 ir_node *ia32_new_NoReg_fp(ia32_code_gen_t *cg);
98
99 #endif /* _BEARCH_IA32_T_H_ */