vms.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. /* Output variables, constants and external declarations, for GNU compiler.
  2. Copyright (C) 1996-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /* Alpha/VMS object format is not really Elf, but this makes compiling
  16. crtstuff.c and dealing with shared library initialization much easier. */
  17. #define OBJECT_FORMAT_ELF
  18. /* Do not use TM clone registry as it currently doesn't work. Alpha/VMS
  19. object is too far from ELF for supporting TM out of the box. */
  20. #define USE_TM_CLONE_REGISTRY 0
  21. /* This enables certain macros in alpha.h, which will make an indirect
  22. reference to an external symbol an invalid address. This needs to be
  23. defined before we include alpha.h, since it determines which macros
  24. are used for GO_IF_*. */
  25. #define NO_EXTERNAL_INDIRECT_ADDRESS
  26. #define SUBTARGET_OS_CPP_BUILTINS() \
  27. do { \
  28. builtin_define ("__ALPHA"); \
  29. if (TARGET_FLOAT_VAX) \
  30. builtin_define ("__G_FLOAT"); \
  31. else \
  32. builtin_define ("__IEEE_FLOAT"); \
  33. } while (0)
  34. #undef PCC_STATIC_STRUCT_RETURN
  35. #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
  36. /* The maximum alignment 'malloc' honors. */
  37. #undef MALLOC_ABI_ALIGNMENT
  38. #define MALLOC_ABI_ALIGNMENT \
  39. ((flag_vms_malloc64 && flag_vms_pointer_size != VMS_POINTER_SIZE_NONE \
  40. ? 16 : 8) * BITS_PER_UNIT)
  41. #undef FIXED_REGISTERS
  42. #define FIXED_REGISTERS \
  43. {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  44. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
  45. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  46. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
  47. #undef CALL_USED_REGISTERS
  48. #define CALL_USED_REGISTERS \
  49. {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  50. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
  51. 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \
  52. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
  53. /* List the order in which to allocate registers. Each register must be
  54. listed once, even those in FIXED_REGISTERS.
  55. We allocate in the following order:
  56. $f1 (nonsaved floating-point register)
  57. $f10-$f15 (likewise)
  58. $f22-$f30 (likewise)
  59. $f21-$f16 (likewise, but input args)
  60. $f0 (nonsaved, but return value)
  61. $f2-$f9 (saved floating-point registers)
  62. $1 (nonsaved integer registers)
  63. $22-$25 (likewise)
  64. $28 (likewise)
  65. $0 (likewise, but return value)
  66. $21-$16 (likewise, but input args)
  67. $27 (procedure value in OSF, nonsaved in NT)
  68. $2-$8 (saved integer registers)
  69. $9-$14 (saved integer registers)
  70. $26 (return PC)
  71. $15 (frame pointer)
  72. $29 (global pointer)
  73. $30, $31, $f31 (stack pointer and always zero/ap & fp) */
  74. #undef REG_ALLOC_ORDER
  75. #define REG_ALLOC_ORDER \
  76. {33, \
  77. 42, 43, 44, 45, 46, 47, \
  78. 54, 55, 56, 57, 58, 59, 60, 61, 62, \
  79. 53, 52, 51, 50, 49, 48, \
  80. 32, \
  81. 34, 35, 36, 37, 38, 39, 40, 41, \
  82. 1, \
  83. 22, 23, 24, 25, \
  84. 28, \
  85. 0, \
  86. 21, 20, 19, 18, 17, 16, \
  87. 27, \
  88. 2, 3, 4, 5, 6, 7, 8, \
  89. 9, 10, 11, 12, 13, 14, \
  90. 26, \
  91. 15, \
  92. 29, \
  93. 30, 31, 63 }
  94. #undef HARD_FRAME_POINTER_REGNUM
  95. #define HARD_FRAME_POINTER_REGNUM 29
  96. /* Define registers used by the epilogue and return instruction. */
  97. #undef EPILOGUE_USES
  98. #define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29)
  99. #undef INITIAL_ELIMINATION_OFFSET
  100. #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
  101. ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
  102. /* Define a data type for recording info about an argument list
  103. during the scan of that argument list. This data type should
  104. hold all necessary information about the function itself
  105. and about the args processed so far, enough to enable macros
  106. such as FUNCTION_ARG to determine where the next arg should go.
  107. On Alpha/VMS, this is a structure that contains the number of
  108. arguments and, for each argument, the datatype of that argument.
  109. The number of arguments is a number of words of arguments scanned so far.
  110. Thus 6 or more means all following args should go on the stack. */
  111. enum avms_arg_type {I64, FF, FD, FG, FS, FT};
  112. typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
  113. #undef CUMULATIVE_ARGS
  114. #define CUMULATIVE_ARGS avms_arg_info
  115. /* Initialize a variable CUM of type CUMULATIVE_ARGS
  116. for a call to a function whose data type is FNTYPE.
  117. For a library call, FNTYPE is 0. */
  118. #undef INIT_CUMULATIVE_ARGS
  119. #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
  120. (CUM).num_args = 0; \
  121. (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \
  122. (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64;
  123. #define DEFAULT_PCC_STRUCT_RETURN 0
  124. /* Even though pointers are 64bits, only 32bit ever remain significant in code
  125. addresses. */
  126. #define MASK_RETURN_ADDR \
  127. (flag_vms_pointer_size == VMS_POINTER_SIZE_NONE \
  128. ? constm1_rtx \
  129. : GEN_INT (0xffffffff))
  130. #undef ASM_WEAKEN_LABEL
  131. #define ASM_WEAKEN_LABEL(FILE, NAME) \
  132. do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
  133. fputc ('\n', FILE); } while (0)
  134. #define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
  135. #define CTORS_SECTION_ASM_OP "\t.ctors"
  136. #define DTORS_SECTION_ASM_OP "\t.dtors"
  137. #define SDATA_SECTION_ASM_OP "\t.sdata"
  138. #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
  139. asm (SECTION_OP "\n\t.long " #FUNC"\n");
  140. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  141. #undef ASM_OUTPUT_ADDR_VEC_ELT
  142. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
  143. fprintf (FILE, "\t.quad $L%d\n", (VALUE))
  144. #undef CASE_VECTOR_MODE
  145. #define CASE_VECTOR_MODE DImode
  146. #undef CASE_VECTOR_PC_RELATIVE
  147. #undef ASM_OUTPUT_CASE_LABEL
  148. #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
  149. { ASM_OUTPUT_ALIGN (FILE, 3); (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); }
  150. /* This says how to output assembler code to declare an
  151. uninitialized external linkage data object. */
  152. #define COMMON_ASM_OP "\t.comm\t"
  153. #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
  154. #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
  155. vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
  156. /* Control how constructors and destructors are emitted. */
  157. #define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor
  158. #define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor
  159. #define DWARF2_DEBUGGING_INFO 1
  160. #define VMS_DEBUGGING_INFO 1
  161. #define DWARF2_UNWIND_INFO 1
  162. #undef EH_RETURN_HANDLER_RTX
  163. #define EH_RETURN_HANDLER_RTX \
  164. gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, 8))
  165. #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
  166. #define LINK_GCC_C_SEQUENCE_SPEC "%G"
  167. /* This is how to output an assembler line
  168. that says to advance the location counter
  169. to a multiple of 2**LOG bytes. */
  170. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  171. fprintf (FILE, "\t.align %d\n", LOG);
  172. /* This is how to advance the location counter by SIZE bytes. */
  173. #define ASM_OUTPUT_SKIP(FILE,SIZE) \
  174. fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
  175. /* This says how to output an assembler line
  176. to define a global common symbol. */
  177. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
  178. ( fputs ("\t.lcomm ", (FILE)), \
  179. assemble_name ((FILE), (NAME)), \
  180. fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)))
  181. /* Switch into a generic section. */
  182. #define TARGET_ASM_NAMED_SECTION vms_asm_named_section
  183. #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
  184. do \
  185. { \
  186. fprintf ((FILE), "\t"); \
  187. assemble_name (FILE, LABEL1); \
  188. fprintf (FILE, " = "); \
  189. assemble_name (FILE, LABEL2); \
  190. fprintf (FILE, "\n"); \
  191. } \
  192. while (0)
  193. #undef PREFERRED_DEBUGGING_TYPE
  194. #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
  195. #define ASM_PN_FORMAT "%s___%lu"
  196. /* ??? VMS uses different linkage. */
  197. #undef TARGET_ASM_OUTPUT_MI_THUNK
  198. #undef ASM_SPEC
  199. #undef ASM_FINAL_SPEC
  200. /* The VMS convention is to always provide minimal debug info
  201. for a traceback unless specifically overridden.
  202. Because ASM_OUTPUT_ADDR_DIFF_ELT is not defined for alpha-vms,
  203. jump tables cannot be output for PIC code, because you can't put
  204. an absolute address in a readonly section. Putting the table in
  205. a writable section is a security hole. Therefore, we unset the
  206. flag_jump_tables flag, forcing switch statements to be expanded
  207. using decision trees. There are probably other ways to address
  208. this issue, but using a decision tree is clearly safe. */
  209. #undef SUBTARGET_OVERRIDE_OPTIONS
  210. #define SUBTARGET_OVERRIDE_OPTIONS \
  211. do { \
  212. if (write_symbols == NO_DEBUG \
  213. && debug_info_level == DINFO_LEVEL_NONE) \
  214. { \
  215. write_symbols = VMS_DEBUG; \
  216. debug_info_level = DINFO_LEVEL_TERSE; \
  217. } \
  218. if (flag_pic) \
  219. flag_jump_tables = 0; \
  220. } while (0)
  221. #undef LINK_SPEC
  222. #if HAVE_GNU_LD
  223. /* GNU-ld built-in linker script already handles the dwarf2 debug sections. */
  224. #define LINK_SPEC "%{shared} %{v}"
  225. #else
  226. /* Link with vms-dwarf2.o if -g (except -g0). This causes the
  227. VMS link to pull all the dwarf2 debug sections together. */
  228. #define LINK_SPEC "%{g0} %{g*:-g vms-dwarf2.o%s} %{shared} %{v} %{map}"
  229. #endif
  230. #undef STARTFILE_SPEC
  231. #define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
  232. %{!static:%{shared:crtbeginS.o%s}}"
  233. #define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
  234. #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
  235. #define LONGLONG_STANDALONE 1
  236. #undef TARGET_VALID_POINTER_MODE
  237. #define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
  238. /* Default values for _CRTL_VER and _VMS_VER. */
  239. #define VMS_DEFAULT_CRTL_VER 70320000
  240. #define VMS_DEFAULT_VMS_VER 70320000