bugfix: free_entity removed entity that still was in tarval hash table for tarval_p_...
[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_critical_edges = 1;
32 int opt_dead_node_elimination = 1;  /* Reclaim memory */
33 int opt_reassociation = 1;          /* Reassociate nodes */
34 int opt_inline = 1;                 /* Do inlining transformation */
35
36 /* set the flags with set_flagname, get the flag with get_flagname */
37 INLINE void
38 set_opt_cse (int value)
39 {
40   opt_cse = value;
41 }
42
43 INLINE int
44 get_opt_cse (void)
45 {
46   return opt_cse;
47 }
48
49 void set_opt_global_cse (int value)
50 {
51   opt_global_cse = value;
52 }
53
54 int  get_opt_global_cse (void)
55 {
56   return opt_global_cse;
57 }
58
59 INLINE void
60 set_opt_constant_folding (int value)
61 {
62   opt_constant_folding=value;
63 }
64
65 INLINE int
66 get_opt_constant_folding (void)
67 {
68   return opt_constant_folding;
69 }
70
71 INLINE void
72 set_opt_unreachable_code(int value)
73 {
74   opt_unreachable_code = value;
75 }
76
77 INLINE int
78 get_opt_unreachable_code(void)
79 {
80   return opt_unreachable_code;
81 }
82
83 INLINE void set_opt_control_flow(int value) {
84   set_opt_control_flow_straightening(value);
85   set_opt_control_flow_weak_simplification(value);
86   set_opt_control_flow_strong_simplification(value);
87   set_opt_critical_edges(value);
88 }
89
90 /* Performs Straightening */
91 void set_opt_control_flow_straightening(int value) {
92   opt_control_flow_straightening = value;
93 }
94 int  get_opt_control_flow_straightening(void) {
95   return opt_control_flow_straightening;
96 }
97 /* Performs if simplifications in local optimizations. */
98 void set_opt_control_flow_weak_simplification(int value) {
99   opt_control_flow_weak_simplification = value;
100 }
101 int  get_opt_control_flow_weak_simplification(void) {
102   return opt_control_flow_weak_simplification;
103 }
104 /* Performs strong if and loop simplification (in optimize_cf). */
105 void set_opt_control_flow_strong_simplification(int value) {
106   opt_control_flow_strong_simplification = value;
107 }
108 int  get_opt_control_flow_strong_simplification(void) {
109   return opt_control_flow_strong_simplification;
110 }
111
112 void set_opt_critical_edges(int value) {
113   opt_critical_edges = value;
114 }
115 int  get_opt_critical_edges(void) {
116   return opt_critical_edges;
117 }
118
119
120 INLINE void
121 set_opt_reassociation(int value)
122 {
123   opt_reassociation = value;
124 }
125
126 INLINE int
127 get_opt_reassociation(void)
128 {
129   return opt_reassociation;
130 }
131
132 INLINE void
133 set_opt_dead_node_elimination (int value)
134 {
135   opt_dead_node_elimination = value;
136 }
137
138 INLINE int
139 get_opt_dead_node_elimination (void)
140 {
141   return opt_dead_node_elimination;
142 }
143
144 INLINE void
145 set_optimize (int value)
146 {
147   optimized = value;
148 }
149
150 INLINE int
151 get_optimize (void)
152 {
153   return optimized;
154 }
155
156
157 INLINE void set_opt_inline (int value) {
158   opt_inline = value;
159 }
160
161 INLINE int  get_opt_inline (void) {
162   return opt_inline;
163 }