4e95b08ddfdd20239428d7b0b1f9fc8f051af871
[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 "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 = 1;           /* control flow optimizations. */
29 int opt_dead_node_elimination = 1;  /* Reclaim memory */
30 int opt_reassociation = 1;          /* Reassociate nodes */
31 int opt_inline = 1;                 /* Do inlining transformation */
32
33 /* set the flags with set_flagname, get the flag with get_flagname */
34 INLINE void
35 set_opt_cse (int value)
36 {
37   opt_cse = value;
38 }
39
40 INLINE int
41 get_opt_cse (void)
42 {
43   return opt_cse;
44 }
45
46 void set_opt_global_cse (int value)
47 {
48   opt_global_cse = value;
49 }
50
51 int  get_opt_global_cse (void)
52 {
53   return opt_global_cse;
54 }
55
56 INLINE void
57 set_opt_constant_folding (int value)
58 {
59   opt_constant_folding=value;
60 }
61
62 INLINE int
63 get_opt_constant_folding (void)
64 {
65   return opt_constant_folding;
66 }
67
68 INLINE void
69 set_opt_unreachable_code(int value)
70 {
71   opt_unreachable_code = value;
72 }
73
74 INLINE int
75 get_opt_unreachable_code(void)
76 {
77   return opt_unreachable_code;
78 }
79
80 INLINE void set_opt_control_flow(int value) {
81   opt_control_flow = value;
82 }
83
84 INLINE int  get_opt_control_flow(void) {
85   return opt_control_flow;
86 }
87
88 INLINE void
89 set_opt_reassociation(int value)
90 {
91   opt_reassociation = value;
92 }
93
94 INLINE int
95 get_opt_reassociation(void)
96 {
97   return opt_reassociation;
98 }
99
100 INLINE void
101 set_opt_dead_node_elimination (int value)
102 {
103   opt_dead_node_elimination = value;
104 }
105
106 INLINE int
107 get_opt_dead_node_elimination (void)
108 {
109   return opt_dead_node_elimination;
110 }
111
112 INLINE void
113 set_optimize (int value)
114 {
115   optimized = value;
116 }
117
118 INLINE int
119 get_optimize (void)
120 {
121   return optimized;
122 }
123
124
125 INLINE void set_opt_inline (int value) {
126   opt_inline = value;
127 }
128
129 INLINE int  get_opt_inline (void) {
130   return opt_inline;
131 }