1 /* This file is part of the program psim. 2 3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> 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 (int order) 29 { 30 switch (order) { 31 case 0: return "0"; 32 case BIG_ENDIAN: return "BIG_ENDIAN"; 33 case LITTLE_ENDIAN: return "LITTLE_ENDIAN"; 34 } 35 36 return "UNKNOWN"; 37 } 38 39 STATIC_INLINE_OPTIONS\ 40 (const char *) 41 options_env (int env) 42 { 43 switch (env) { 44 case OPERATING_ENVIRONMENT: return "OPERATING"; 45 case VIRTUAL_ENVIRONMENT: return "VIRTUAL"; 46 case USER_ENVIRONMENT: return "USER"; 47 case 0: return "0"; 48 } 49 50 return "UNKNOWN"; 51 } 52 53 STATIC_INLINE_OPTIONS\ 54 (const char *) 55 options_align (int align) 56 { 57 switch (align) { 58 case NONSTRICT_ALIGNMENT: return "NONSTRICT"; 59 case STRICT_ALIGNMENT: return "STRICT"; 60 case 0: return "0"; 61 } 62 63 return "UNKNOWN"; 64 } 65 66 STATIC_INLINE_OPTIONS\ 67 (const char *) 68 options_float (int float_type) 69 { 70 switch (float_type) { 71 case SOFT_FLOATING_POINT: return "SOFTWARE"; 72 case HARD_FLOATING_POINT: return "HARDWARE"; 73 } 74 75 return "UNKNOWN"; 76 } 77 78 STATIC_INLINE_OPTIONS\ 79 (const char *) 80 options_mon (int mon) 81 { 82 switch (mon) { 83 case MONITOR_INSTRUCTION_ISSUE|MONITOR_LOAD_STORE_UNIT: return "ALL"; 84 case MONITOR_INSTRUCTION_ISSUE: return "INSTRUCTION"; 85 case MONITOR_LOAD_STORE_UNIT: return "MEMORY"; 86 case 0: return "0"; 87 } 88 89 return "UNKNOWN"; 90 } 91 92 STATIC_INLINE_OPTIONS\ 93 (const char *) 94 options_inline (int in) 95 { 96 switch (in) { 97 case /*0*/ 0: return "0"; 98 case /*1*/ REVEAL_MODULE: return "REVEAL_MODULE"; 99 case /*2*/ INLINE_MODULE: return "INLINE_MODULE"; 100 case /*3*/ REVEAL_MODULE|INLINE_MODULE: return "REVEAL_MODULE|INLINE_MODULE"; 101 case /*4*/ PSIM_INLINE_LOCALS: return "PSIM_LOCALS_INLINE"; 102 case /*5*/ PSIM_INLINE_LOCALS|REVEAL_MODULE: return "PSIM_INLINE_LOCALS|REVEAL_MODULE"; 103 case /*6*/ PSIM_INLINE_LOCALS|INLINE_MODULE: return "PSIM_INLINE_LOCALS|INLINE_MODULE"; 104 case /*7*/ ALL_INLINE: return "ALL_INLINE"; 105 } 106 return "0"; 107 } 108 109 110 INLINE_OPTIONS\ 111 (void) 112 print_options (void) 113 { 114 #if defined(_GNUC_) && defined(__VERSION__) 115 printf_filtered ("Compiled by GCC %s on %s %s\n", __VERSION__, __DATE__, __TIME__); 116 #else 117 printf_filtered ("Compiled on %s %s\n", __DATE__, __TIME__); 118 #endif 119 120 printf_filtered ("WITH_HOST_BYTE_ORDER = %s\n", options_byte_order (WITH_HOST_BYTE_ORDER)); 121 printf_filtered ("WITH_TARGET_BYTE_ORDER = %s\n", options_byte_order (WITH_TARGET_BYTE_ORDER)); 122 printf_filtered ("WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN); 123 printf_filtered ("WITH_BSWAP = %d\n", WITH_BSWAP); 124 printf_filtered ("WITH_SMP = %d\n", WITH_SMP); 125 printf_filtered ("WITH_HOST_WORD_BITSIZE = %d\n", WITH_HOST_WORD_BITSIZE); 126 printf_filtered ("WITH_TARGET_WORD_BITSIZE = %d\n", WITH_TARGET_WORD_BITSIZE); 127 printf_filtered ("WITH_ENVIRONMENT = %s\n", options_env(WITH_ENVIRONMENT)); 128 printf_filtered ("WITH_EVENTS = %d\n", WITH_EVENTS); 129 printf_filtered ("WITH_TIME_BASE = %d\n", WITH_TIME_BASE); 130 printf_filtered ("WITH_CALLBACK_MEMORY = %d\n", WITH_CALLBACK_MEMORY); 131 printf_filtered ("WITH_ALIGNMENT = %s\n", options_align (WITH_ALIGNMENT)); 132 printf_filtered ("WITH_FLOATING_POINT = %s\n", options_float (WITH_FLOATING_POINT)); 133 printf_filtered ("WITH_TRACE = %d\n", WITH_TRACE); 134 printf_filtered ("WITH_ASSERT = %d\n", WITH_ASSERT); 135 printf_filtered ("WITH_MON = %s\n", options_mon (WITH_MON)); 136 printf_filtered ("WITH_DEFAULT_MODEL = %s\n", model_name[WITH_DEFAULT_MODEL]); 137 printf_filtered ("WITH_MODEL = %s\n", model_name[WITH_MODEL]); 138 printf_filtered ("WITH_MODEL_ISSUE = %d\n", WITH_MODEL_ISSUE); 139 printf_filtered ("WITH_RESERVED_BITS = %d\n", WITH_RESERVED_BITS); 140 printf_filtered ("WITH_STDIO = %d\n", WITH_STDIO); 141 printf_filtered ("WITH_REGPARM = %d\n", WITH_REGPARM); 142 printf_filtered ("WITH_STDCALL = %d\n", WITH_STDCALL); 143 printf_filtered ("DEFAULT_INLINE = %s\n", options_inline (DEFAULT_INLINE)); 144 printf_filtered ("SIM_ENDIAN_INLINE = %s\n", options_inline (SIM_ENDIAN_INLINE)); 145 printf_filtered ("BITS_INLINE = %s\n", options_inline (BITS_INLINE)); 146 printf_filtered ("CPU_INLINE = %s\n", options_inline (CPU_INLINE)); 147 printf_filtered ("VM_INLINE = %s\n", options_inline (VM_INLINE)); 148 printf_filtered ("CORE_INLINE = %s\n", options_inline (CORE_INLINE)); 149 printf_filtered ("EVENTS_INLINE = %s\n", options_inline (EVENTS_INLINE)); 150 printf_filtered ("MON_INLINE = %s\n", options_inline (MON_INLINE)); 151 printf_filtered ("INTERRUPTS_INLINE = %s\n", options_inline (INTERRUPTS_INLINE)); 152 printf_filtered ("REGISTERS_INLINE = %s\n", options_inline (REGISTERS_INLINE)); 153 printf_filtered ("DEVICE_INLINE = %s\n", options_inline (DEVICE_INLINE)); 154 printf_filtered ("SPREG_INLINE = %s\n", options_inline (SPREG_INLINE)); 155 printf_filtered ("SEMANTICS_INLINE = %s\n", options_inline (SEMANTICS_INLINE)); 156 printf_filtered ("IDECODE_INLINE = %s\n", options_inline (IDECODE_INLINE)); 157 printf_filtered ("OPTIONS_INLINE = %s\n", options_inline (OPTIONS_INLINE)); 158 printf_filtered ("OS_EMUL_INLINE = %s\n", options_inline (OS_EMUL_INLINE)); 159 printf_filtered ("SUPPORT_INLINE = %s\n", options_inline (SUPPORT_INLINE)); 160 161 #ifdef OPCODE_RULES 162 printf_filtered ("OPCODE rules = %s\n", OPCODE_RULES); 163 #endif 164 165 #ifdef IGEN_FLAGS 166 printf_filtered ("IGEN_FLAGS = %s\n", IGEN_FLAGS); 167 #endif 168 169 #ifdef DGEN_FLAGS 170 printf_filtered ("DGEN_FLAGS = %s\n", DGEN_FLAGS); 171 #endif 172 173 { 174 static const char *const defines[] = { 175 #ifdef __GNUC__ 176 "__GNUC__", 177 #endif 178 179 #ifdef __STRICT_ANSI__ 180 "__STRICT_ANSI__", 181 #endif 182 183 #ifdef __CHAR_UNSIGNED__ 184 "__CHAR_UNSIGNED__", 185 #endif 186 187 #ifdef __OPTIMIZE__ 188 "__OPTIMIZE__", 189 #endif 190 191 #ifdef STDC_HEADERS 192 "STDC_HEADERS", 193 #endif 194 195 #include "defines.h" 196 197 #ifdef HAVE_TERMIOS_CLINE 198 "HAVE_TERMIOS_CLINE", 199 #endif 200 201 #ifdef HAVE_TERMIOS_STRUCTURE 202 "HAVE_TERMIOS_STRUCTURE", 203 #endif 204 205 #ifdef HAVE_TERMIO_CLINE 206 "HAVE_TERMIO_CLINE", 207 #endif 208 209 #ifdef HAVE_TERMIO_STRUCTURE 210 "HAVE_TERMIO_STRUCTURE", 211 #endif 212 213 #ifdef HAVE_DEVZERO 214 "HAVE_DEVZERO", 215 #endif 216 }; 217 218 int i; 219 int max_len = 0; 220 int cols; 221 222 for (i = 0; i < sizeof (defines) / sizeof (defines[0]); i++) { 223 int len = strlen (defines[i]); 224 if (len > max_len) 225 max_len = len; 226 } 227 228 cols = 78 / (max_len + 2); 229 if (cols < 0) 230 cols = 1; 231 232 printf_filtered ("\n#defines:"); 233 for (i = 0; i < sizeof (defines) / sizeof (defines[0]); i++) { 234 const char *const prefix = ((i % cols) == 0) ? "\n" : ""; 235 printf_filtered ("%s %s%*s", prefix, defines[i], 236 (((i == (sizeof (defines) / sizeof (defines[0])) - 1) 237 || (((i + 1) % cols) == 0)) 238 ? 0 239 : max_len + 4 - strlen (defines[i])), 240 ""); 241 } 242 printf_filtered ("\n"); 243 } 244 } 245 246 #endif /* _OPTIONS_C_ */ 247