options.c 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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 (enum bfd_endian order)
  21. {
  22. switch (order) {
  23. case BFD_ENDIAN_BIG: return "BIG_ENDIAN";
  24. case BFD_ENDIAN_LITTLE: return "LITTLE_ENDIAN";
  25. }
  26. return "UNKNOWN";
  27. }
  28. STATIC_INLINE_OPTIONS\
  29. (const char *)
  30. options_env (int env)
  31. {
  32. switch (env) {
  33. case OPERATING_ENVIRONMENT: return "OPERATING";
  34. case VIRTUAL_ENVIRONMENT: return "VIRTUAL";
  35. case USER_ENVIRONMENT: return "USER";
  36. case 0: return "0";
  37. }
  38. return "UNKNOWN";
  39. }
  40. STATIC_INLINE_OPTIONS\
  41. (const char *)
  42. options_align (int align)
  43. {
  44. switch (align) {
  45. case NONSTRICT_ALIGNMENT: return "NONSTRICT";
  46. case STRICT_ALIGNMENT: return "STRICT";
  47. case 0: return "0";
  48. }
  49. return "UNKNOWN";
  50. }
  51. STATIC_INLINE_OPTIONS\
  52. (const char *)
  53. options_float (int float_type)
  54. {
  55. switch (float_type) {
  56. case SOFT_FLOATING_POINT: return "SOFTWARE";
  57. case HARD_FLOATING_POINT: return "HARDWARE";
  58. }
  59. return "UNKNOWN";
  60. }
  61. STATIC_INLINE_OPTIONS\
  62. (const char *)
  63. options_mon (int mon)
  64. {
  65. switch (mon) {
  66. case MONITOR_INSTRUCTION_ISSUE|MONITOR_LOAD_STORE_UNIT: return "ALL";
  67. case MONITOR_INSTRUCTION_ISSUE: return "INSTRUCTION";
  68. case MONITOR_LOAD_STORE_UNIT: return "MEMORY";
  69. case 0: return "0";
  70. }
  71. return "UNKNOWN";
  72. }
  73. STATIC_INLINE_OPTIONS\
  74. (const char *)
  75. options_inline (int in)
  76. {
  77. switch (in) {
  78. case /*0*/ 0: return "0";
  79. case /*1*/ REVEAL_MODULE: return "REVEAL_MODULE";
  80. case /*2*/ INLINE_MODULE: return "INLINE_MODULE";
  81. case /*3*/ REVEAL_MODULE|INLINE_MODULE: return "REVEAL_MODULE|INLINE_MODULE";
  82. case /*4*/ INLINE_LOCALS: return "INLINE_LOCALS";
  83. case /*5*/ INLINE_LOCALS|REVEAL_MODULE: return "INLINE_LOCALS|REVEAL_MODULE";
  84. case /*6*/ INLINE_LOCALS|INLINE_MODULE: return "INLINE_LOCALS|INLINE_MODULE";
  85. case /*7*/ ALL_C_INLINE: return "ALL_C_INLINE";
  86. }
  87. return "0";
  88. }
  89. INLINE_OPTIONS\
  90. (void)
  91. print_options (void)
  92. {
  93. #if defined(_GNUC_) && defined(__VERSION__)
  94. printf_filtered ("Compiled by GCC %s on %s %s\n", __VERSION__, __DATE__, __TIME__);
  95. #else
  96. printf_filtered ("Compiled on %s %s\n", __DATE__, __TIME__);
  97. #endif
  98. printf_filtered ("HOST_BYTE_ORDER = %s\n", options_byte_order (HOST_BYTE_ORDER));
  99. printf_filtered ("WITH_TARGET_BYTE_ORDER = %s\n", options_byte_order (WITH_TARGET_BYTE_ORDER));
  100. printf_filtered ("WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
  101. printf_filtered ("WITH_SMP = %d\n", WITH_SMP);
  102. printf_filtered ("WITH_HOST_WORD_BITSIZE = %d\n", WITH_HOST_WORD_BITSIZE);
  103. printf_filtered ("WITH_TARGET_WORD_BITSIZE = %d\n", WITH_TARGET_WORD_BITSIZE);
  104. printf_filtered ("WITH_ENVIRONMENT = %s\n", options_env(WITH_ENVIRONMENT));
  105. printf_filtered ("WITH_EVENTS = %d\n", WITH_EVENTS);
  106. printf_filtered ("WITH_TIME_BASE = %d\n", WITH_TIME_BASE);
  107. printf_filtered ("WITH_CALLBACK_MEMORY = %d\n", WITH_CALLBACK_MEMORY);
  108. printf_filtered ("WITH_ALIGNMENT = %s\n", options_align (WITH_ALIGNMENT));
  109. printf_filtered ("WITH_FLOATING_POINT = %s\n", options_float (WITH_FLOATING_POINT));
  110. printf_filtered ("WITH_TRACE = %d\n", WITH_TRACE);
  111. printf_filtered ("WITH_ASSERT = %d\n", WITH_ASSERT);
  112. printf_filtered ("WITH_MON = %s\n", options_mon (WITH_MON));
  113. printf_filtered ("WITH_DEFAULT_MODEL = %s\n", model_name[WITH_DEFAULT_MODEL]);
  114. printf_filtered ("WITH_MODEL = %s\n", model_name[WITH_MODEL]);
  115. printf_filtered ("WITH_MODEL_ISSUE = %d\n", WITH_MODEL_ISSUE);
  116. printf_filtered ("WITH_RESERVED_BITS = %d\n", WITH_RESERVED_BITS);
  117. printf_filtered ("WITH_STDIO = %d\n", WITH_STDIO);
  118. printf_filtered ("DEFAULT_INLINE = %s\n", options_inline (DEFAULT_INLINE));
  119. printf_filtered ("SIM_ENDIAN_INLINE = %s\n", options_inline (SIM_ENDIAN_INLINE));
  120. printf_filtered ("BITS_INLINE = %s\n", options_inline (BITS_INLINE));
  121. printf_filtered ("CPU_INLINE = %s\n", options_inline (CPU_INLINE));
  122. printf_filtered ("VM_INLINE = %s\n", options_inline (VM_INLINE));
  123. printf_filtered ("CORE_INLINE = %s\n", options_inline (CORE_INLINE));
  124. printf_filtered ("EVENTS_INLINE = %s\n", options_inline (EVENTS_INLINE));
  125. printf_filtered ("MON_INLINE = %s\n", options_inline (MON_INLINE));
  126. printf_filtered ("INTERRUPTS_INLINE = %s\n", options_inline (INTERRUPTS_INLINE));
  127. printf_filtered ("REGISTERS_INLINE = %s\n", options_inline (REGISTERS_INLINE));
  128. printf_filtered ("DEVICE_INLINE = %s\n", options_inline (DEVICE_INLINE));
  129. printf_filtered ("SPREG_INLINE = %s\n", options_inline (SPREG_INLINE));
  130. printf_filtered ("SEMANTICS_INLINE = %s\n", options_inline (SEMANTICS_INLINE));
  131. printf_filtered ("IDECODE_INLINE = %s\n", options_inline (IDECODE_INLINE));
  132. printf_filtered ("OPTIONS_INLINE = %s\n", options_inline (OPTIONS_INLINE));
  133. printf_filtered ("OS_EMUL_INLINE = %s\n", options_inline (OS_EMUL_INLINE));
  134. printf_filtered ("SUPPORT_INLINE = %s\n", options_inline (SUPPORT_INLINE));
  135. #ifdef OPCODE_RULES
  136. printf_filtered ("OPCODE rules = %s\n", OPCODE_RULES);
  137. #endif
  138. #ifdef IGEN_FLAGS
  139. printf_filtered ("IGEN_FLAGS = %s\n", IGEN_FLAGS);
  140. #endif
  141. #ifdef DGEN_FLAGS
  142. printf_filtered ("DGEN_FLAGS = %s\n", DGEN_FLAGS);
  143. #endif
  144. {
  145. static const char *const defines[] = {
  146. #ifdef __GNUC__
  147. "__GNUC__",
  148. #endif
  149. #ifdef __STRICT_ANSI__
  150. "__STRICT_ANSI__",
  151. #endif
  152. #ifdef __CHAR_UNSIGNED__
  153. "__CHAR_UNSIGNED__",
  154. #endif
  155. #ifdef __OPTIMIZE__
  156. "__OPTIMIZE__",
  157. #endif
  158. #ifdef STDC_HEADERS
  159. "STDC_HEADERS",
  160. #endif
  161. #include "defines.h"
  162. #ifdef HAVE_TERMIOS_CLINE
  163. "HAVE_TERMIOS_CLINE",
  164. #endif
  165. #ifdef HAVE_TERMIOS_STRUCTURE
  166. "HAVE_TERMIOS_STRUCTURE",
  167. #endif
  168. #ifdef HAVE_TERMIO_CLINE
  169. "HAVE_TERMIO_CLINE",
  170. #endif
  171. #ifdef HAVE_TERMIO_STRUCTURE
  172. "HAVE_TERMIO_STRUCTURE",
  173. #endif
  174. #ifdef HAVE_DEVZERO
  175. "HAVE_DEVZERO",
  176. #endif
  177. };
  178. int i;
  179. int max_len = 0;
  180. int cols;
  181. for (i = 0; i < ARRAY_SIZE (defines); i++) {
  182. int len = strlen (defines[i]);
  183. if (len > max_len)
  184. max_len = len;
  185. }
  186. cols = 78 / (max_len + 2);
  187. if (cols < 0)
  188. cols = 1;
  189. printf_filtered ("\n#defines:");
  190. for (i = 0; i < ARRAY_SIZE (defines); i++) {
  191. const char *const prefix = ((i % cols) == 0) ? "\n" : "";
  192. printf_filtered ("%s %s%*s", prefix, defines[i],
  193. (((i == ARRAY_SIZE (defines) - 1)
  194. || (((i + 1) % cols) == 0))
  195. ? 0
  196. : max_len + 4 - (int)strlen (defines[i])),
  197. "");
  198. }
  199. printf_filtered ("\n");
  200. }
  201. }
  202. #endif /* _OPTIONS_C_ */