74cb1bb5c3dc49b96077f73c708457a3dfa1e009
[libfirm] / ir / ir / irflag.c
1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Christian Schaefer
5 **
6 ** irflag --- optimization flags
7 */
8
9 /* $Id$ */
10
11 #ifdef HAVE_CONFIG_H
12 # include <config.h>
13 #endif
14
15 #include "irflag.h"
16 #include "firm_common.h"
17
18
19 /* 0 - don't do this optimization
20    1 - lets see, if there is a better graph */
21 int optimized = 1;                  /* Turn off all optimizations */
22
23 int opt_cse = 1;                    /* Hash the nodes */
24 int opt_global_cse = 0;             /* Don't use block predecessor for comparison */
25 /* @@@ 0 solage code placement fehlt */
26 int opt_constant_folding = 1;       /* Evaluate operations */
27 int opt_unreachable_code = 1;       /* Bad node propagation */
28 int opt_control_flow_straightening = 1;           /*  */
29 int opt_control_flow_weak_simplification = 1;           /*  */
30 int opt_control_flow_strong_simplification = 1;           /*  */
31 int opt_dead_node_elimination = 1;  /* Reclaim memory */
32 int opt_reassociation = 1;          /* Reassociate nodes */
33 int opt_inline = 1;                 /* Do inlining transformation */
34
35 /* set the flags with set_flagname, get the flag with get_flagname */
36 INLINE void
37 set_opt_cse (int value)
38 {
39   opt_cse = value;
40 }
41
42 INLINE int
43 get_opt_cse (void)
44 {
45   return opt_cse;
46 }
47
48 void set_opt_global_cse (int value)
49 {
50   opt_global_cse = value;
51 }
52
53 int  get_opt_global_cse (void)
54 {
55   return opt_global_cse;
56 }
57
58 INLINE void
59 set_opt_constant_folding (int value)
60 {
61   opt_constant_folding=value;
62 }
63
64 INLINE int
65 get_opt_constant_folding (void)
66 {
67   return opt_constant_folding;
68 }
69
70 INLINE void
71 set_opt_unreachable_code(int value)
72 {
73   opt_unreachable_code = value;
74 }
75
76 INLINE int
77 get_opt_unreachable_code(void)
78 {
79   return opt_unreachable_code;
80 }
81
82 INLINE void set_opt_control_flow(int value) {
83   set_opt_control_flow_straightening(value);
84   set_opt_control_flow_weak_simplification(value);
85   set_opt_control_flow_strong_simplification(value);
86 }
87
88 /* Performs Straightening */
89 void set_opt_control_flow_straightening(int value) {
90   opt_control_flow_straightening = value;
91 }
92 int  get_opt_control_flow_straightening(void) {
93   return opt_control_flow_straightening;
94 }
95 /* Performs if simplifications in local optimizations. */
96 void set_opt_control_flow_weak_simplification(int value) {
97   opt_control_flow_weak_simplification = value;
98 }
99 int  get_opt_control_flow_weak_simplification(void) {
100   return opt_control_flow_weak_simplification;
101 }
102 /* Performs strong if and loop simplification (in optimize_cf). */
103 void set_opt_control_flow_strong_simplification(int value) {
104   opt_control_flow_strong_simplification = value;
105 }
106 int  get_opt_control_flow_strong_simplification(void) {
107   return opt_control_flow_strong_simplification;
108 }
109
110
111 INLINE void
112 set_opt_reassociation(int value)
113 {
114   opt_reassociation = value;
115 }
116
117 INLINE int
118 get_opt_reassociation(void)
119 {
120   return opt_reassociation;
121 }
122
123 INLINE void
124 set_opt_dead_node_elimination (int value)
125 {
126   opt_dead_node_elimination = value;
127 }
128
129 INLINE int
130 get_opt_dead_node_elimination (void)
131 {
132   return opt_dead_node_elimination;
133 }
134
135 INLINE void
136 set_optimize (int value)
137 {
138   optimized = value;
139 }
140
141 INLINE int
142 get_optimize (void)
143 {
144   return optimized;
145 }
146
147
148 INLINE void set_opt_inline (int value) {
149   opt_inline = value;
150 }
151
152 INLINE int  get_opt_inline (void) {
153   return opt_inline;
154 }