]> Git Repo - binutils.git/blob - sim/ppc/options.c
Automatic date update in version.in
[binutils.git] / sim / ppc / options.c
1 /*  This file is part of the program psim.
2
3     Copyright (C) 1994-1995, Andrew Cagney <[email protected]>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 3 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, see <http://www.gnu.org/licenses/>.
17
18     */
19
20 #ifndef _OPTIONS_C_
21 #define _OPTIONS_C_
22
23 #include "cpu.h"
24 #include "options.h"
25
26 STATIC_INLINE_OPTIONS\
27 (const char *)
28 options_byte_order (enum bfd_endian order)
29 {
30   switch (order) {
31   case BFD_ENDIAN_BIG:          return "BIG_ENDIAN";
32   case BFD_ENDIAN_LITTLE:       return "LITTLE_ENDIAN";
33   }
34
35   return "UNKNOWN";
36 }
37
38 STATIC_INLINE_OPTIONS\
39 (const char *)
40 options_env (int env)
41 {
42   switch (env) {
43   case OPERATING_ENVIRONMENT:   return "OPERATING";
44   case VIRTUAL_ENVIRONMENT:     return "VIRTUAL";
45   case USER_ENVIRONMENT:        return "USER";
46   case 0:                       return "0";
47   }
48
49   return "UNKNOWN";
50 }
51
52 STATIC_INLINE_OPTIONS\
53 (const char *)
54 options_align (int align)
55 {
56   switch (align) {
57   case NONSTRICT_ALIGNMENT:     return "NONSTRICT";
58   case STRICT_ALIGNMENT:        return "STRICT";
59   case 0:                       return "0";
60   }
61
62   return "UNKNOWN";
63 }
64
65 STATIC_INLINE_OPTIONS\
66 (const char *)
67 options_float (int float_type)
68 {
69   switch (float_type) {
70   case SOFT_FLOATING_POINT:     return "SOFTWARE";
71   case HARD_FLOATING_POINT:     return "HARDWARE";
72   }
73
74   return "UNKNOWN";
75 }
76
77 STATIC_INLINE_OPTIONS\
78 (const char *)
79 options_mon (int mon)
80 {
81   switch (mon) {
82   case MONITOR_INSTRUCTION_ISSUE|MONITOR_LOAD_STORE_UNIT:       return "ALL";
83   case MONITOR_INSTRUCTION_ISSUE:                               return "INSTRUCTION";
84   case MONITOR_LOAD_STORE_UNIT:                                 return "MEMORY";
85   case 0:                                                       return "0";
86   }
87
88   return "UNKNOWN";
89 }
90
91 STATIC_INLINE_OPTIONS\
92 (const char *)
93 options_inline (int in)
94 {
95   switch (in) {
96   case /*0*/ 0:                                 return "0";
97   case /*1*/ REVEAL_MODULE:                     return "REVEAL_MODULE";
98   case /*2*/ INLINE_MODULE:                     return "INLINE_MODULE";
99   case /*3*/ REVEAL_MODULE|INLINE_MODULE:       return "REVEAL_MODULE|INLINE_MODULE";
100   case /*4*/ INLINE_LOCALS:                     return "INLINE_LOCALS";
101   case /*5*/ INLINE_LOCALS|REVEAL_MODULE:       return "INLINE_LOCALS|REVEAL_MODULE";
102   case /*6*/ INLINE_LOCALS|INLINE_MODULE:       return "INLINE_LOCALS|INLINE_MODULE";
103   case /*7*/ ALL_C_INLINE:                      return "ALL_C_INLINE";
104   }
105   return "0";
106 }
107
108
109 INLINE_OPTIONS\
110 (void)
111 print_options (void)
112 {
113   printf_filtered ("HOST_BYTE_ORDER          = %s\n", options_byte_order (HOST_BYTE_ORDER));
114   printf_filtered ("WITH_TARGET_BYTE_ORDER   = %s\n", options_byte_order (WITH_TARGET_BYTE_ORDER));
115   printf_filtered ("WITH_XOR_ENDIAN          = %d\n", WITH_XOR_ENDIAN);
116   printf_filtered ("WITH_SMP                 = %d\n", WITH_SMP);
117   printf_filtered ("WITH_TARGET_WORD_BITSIZE = %d\n", WITH_TARGET_WORD_BITSIZE);
118   printf_filtered ("WITH_ENVIRONMENT         = %s\n", options_env(WITH_ENVIRONMENT));
119   printf_filtered ("WITH_EVENTS              = %d\n", WITH_EVENTS);
120   printf_filtered ("WITH_TIME_BASE           = %d\n", WITH_TIME_BASE);
121   printf_filtered ("WITH_CALLBACK_MEMORY     = %d\n", WITH_CALLBACK_MEMORY);
122   printf_filtered ("WITH_ALIGNMENT           = %s\n", options_align (WITH_ALIGNMENT));
123   printf_filtered ("WITH_FLOATING_POINT      = %s\n", options_float (WITH_FLOATING_POINT));
124   printf_filtered ("WITH_TRACE               = %d\n", WITH_TRACE);
125   printf_filtered ("WITH_ASSERT              = %d\n", WITH_ASSERT);
126   printf_filtered ("WITH_MON                 = %s\n", options_mon (WITH_MON));
127   printf_filtered ("WITH_DEFAULT_MODEL       = %s\n", model_name[WITH_DEFAULT_MODEL]);
128   printf_filtered ("WITH_MODEL               = %s\n", model_name[WITH_MODEL]);
129   printf_filtered ("WITH_MODEL_ISSUE         = %d\n", WITH_MODEL_ISSUE);
130   printf_filtered ("WITH_RESERVED_BITS       = %d\n", WITH_RESERVED_BITS);
131   printf_filtered ("WITH_STDIO               = %d\n", WITH_STDIO);
132   printf_filtered ("DEFAULT_INLINE           = %s\n", options_inline (DEFAULT_INLINE));
133   printf_filtered ("SIM_ENDIAN_INLINE        = %s\n", options_inline (SIM_ENDIAN_INLINE));
134   printf_filtered ("BITS_INLINE              = %s\n", options_inline (BITS_INLINE));
135   printf_filtered ("CPU_INLINE               = %s\n", options_inline (CPU_INLINE));
136   printf_filtered ("VM_INLINE                = %s\n", options_inline (VM_INLINE));
137   printf_filtered ("CORE_INLINE              = %s\n", options_inline (CORE_INLINE));
138   printf_filtered ("EVENTS_INLINE            = %s\n", options_inline (EVENTS_INLINE));
139   printf_filtered ("MON_INLINE               = %s\n", options_inline (MON_INLINE));
140   printf_filtered ("INTERRUPTS_INLINE        = %s\n", options_inline (INTERRUPTS_INLINE));
141   printf_filtered ("REGISTERS_INLINE         = %s\n", options_inline (REGISTERS_INLINE));
142   printf_filtered ("DEVICE_INLINE            = %s\n", options_inline (DEVICE_INLINE));
143   printf_filtered ("SPREG_INLINE             = %s\n", options_inline (SPREG_INLINE));
144   printf_filtered ("SEMANTICS_INLINE         = %s\n", options_inline (SEMANTICS_INLINE));
145   printf_filtered ("IDECODE_INLINE           = %s\n", options_inline (IDECODE_INLINE));
146   printf_filtered ("OPTIONS_INLINE           = %s\n", options_inline (OPTIONS_INLINE));
147   printf_filtered ("OS_EMUL_INLINE           = %s\n", options_inline (OS_EMUL_INLINE));
148   printf_filtered ("SUPPORT_INLINE           = %s\n", options_inline (SUPPORT_INLINE));
149
150 #ifdef OPCODE_RULES
151   printf_filtered ("OPCODE rules             = %s\n", OPCODE_RULES);
152 #endif
153
154 #ifdef IGEN_FLAGS
155   printf_filtered ("IGEN_FLAGS               = %s\n", IGEN_FLAGS);
156 #endif
157
158 #ifdef DGEN_FLAGS
159   printf_filtered ("DGEN_FLAGS               = %s\n", DGEN_FLAGS);
160 #endif
161
162   {
163     static const char *const defines[] = {
164 #ifdef __GNUC__
165       "__GNUC__",
166 #endif
167
168 #ifdef __STRICT_ANSI__
169       "__STRICT_ANSI__",
170 #endif
171
172 #ifdef __CHAR_UNSIGNED__
173       "__CHAR_UNSIGNED__",
174 #endif
175
176 #ifdef __OPTIMIZE__
177       "__OPTIMIZE__",
178 #endif
179
180 #ifdef STDC_HEADERS
181       "STDC_HEADERS",
182 #endif
183
184 #include "defines.h"
185
186 #ifdef HAVE_TERMIOS_CLINE
187       "HAVE_TERMIOS_CLINE",
188 #endif
189
190 #ifdef HAVE_TERMIOS_STRUCTURE
191       "HAVE_TERMIOS_STRUCTURE",
192 #endif
193
194 #ifdef HAVE_TERMIO_CLINE
195       "HAVE_TERMIO_CLINE",
196 #endif
197
198 #ifdef HAVE_TERMIO_STRUCTURE
199       "HAVE_TERMIO_STRUCTURE",
200 #endif
201     };
202
203     int i;
204     int max_len = 0;
205     int cols;
206
207     for (i = 0; i < ARRAY_SIZE (defines); i++) {
208       int len = strlen (defines[i]);
209       if (len > max_len)
210         max_len = len;
211     }
212
213     cols = 78 / (max_len + 2);
214     if (cols < 0)
215       cols = 1;
216
217     printf_filtered ("\n#defines:");
218     for (i = 0; i < ARRAY_SIZE (defines); i++) {
219       const char *const prefix = ((i % cols) == 0) ? "\n" : "";
220       printf_filtered ("%s  %s%*s", prefix, defines[i],
221                        (((i == ARRAY_SIZE (defines) - 1)
222                          || (((i + 1) % cols) == 0))
223                         ? 0
224                         : max_len + 4 - (int)strlen (defines[i])),
225                        "");
226     }
227     printf_filtered ("\n");
228   }
229 }
230
231 #endif /* _OPTIONS_C_ */
This page took 0.036463 seconds and 4 git commands to generate.