options.c 7.7 KB

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