diff options
Diffstat (limited to 'contrib/gcc/config/alpha/vms.h')
-rw-r--r-- | contrib/gcc/config/alpha/vms.h | 358 |
1 files changed, 185 insertions, 173 deletions
diff --git a/contrib/gcc/config/alpha/vms.h b/contrib/gcc/config/alpha/vms.h index 44388b2..a01556e 100644 --- a/contrib/gcc/config/alpha/vms.h +++ b/contrib/gcc/config/alpha/vms.h @@ -1,5 +1,6 @@ /* Output variables, constants and external declarations, for GNU compiler. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -18,7 +19,8 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define OPEN_VMS 1 +#define TARGET_OBJECT_SUFFIX ".obj" +#define TARGET_EXECUTABLE_SUFFIX ".exe" /* This enables certain macros in alpha.h, which will make an indirect reference to an external symbol an invalid address. This needs to be @@ -31,7 +33,7 @@ Boston, MA 02111-1307, USA. */ #undef CPP_PREDEFINES #define CPP_PREDEFINES \ -"-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem(vms)" +"-D__ALPHA -Dvms -DVMS -D__vms__ -D__VMS__ -Asystem=vms" #undef CPP_SUBTARGET_SPEC #define CPP_SUBTARGET_SPEC "\ @@ -39,38 +41,13 @@ Boston, MA 02111-1307, USA. */ %{mfloat-vax:-D__G_FLOAT} \ %{!mfloat-vax:-D__IEEE_FLOAT}" -/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */ - -#define LIB_SPEC "%{p:-lprof1 -lpdf} %{pg:-lprof1 -lpdf} %{a:-lprof2} -lc" - -/* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are - optimizing, -O1 if we are not. Pass -shared, -non_shared or - -call_shared as appropriate. Also pass -pg. */ -#define LINK_SPEC \ - "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \ - %{!static:%{shared:-shared} %{!shared:-call_shared}} %{pg} %{taso} \ - %{rpath*}" - -/* We allow $'s in identifiers unless -ansi is used .. */ - -#define DOLLARS_IN_IDENTIFIERS 2 - -/* These match the definitions used in DECCRTL, the VMS C run-time library - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -*/ - -/* Use memcpy for structure copying, and so forth. */ -#define TARGET_MEM_FUNCTIONS - /* By default, allow $ to be part of an identifier. */ #define DOLLARS_IN_IDENTIFIERS 2 #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_FP|MASK_FPREGS|MASK_GAS) -#undef TARGET_OPEN_VMS -#define TARGET_OPEN_VMS 1 +#undef TARGET_ABI_OPEN_VMS +#define TARGET_ABI_OPEN_VMS 1 #undef TARGET_NAME #define TARGET_NAME "OpenVMS/Alpha" @@ -82,14 +59,12 @@ Boston, MA 02111-1307, USA. */ #define STRUCT_VALUE 0 #undef PCC_STATIC_STRUCT_RETURN -/* no floating emulation. */ -#undef REAL_ARITHMETIC - -/* "long" is 32 bits. */ +/* "long" is 32 bits, but 64 bits for Ada. */ #undef LONG_TYPE_SIZE #define LONG_TYPE_SIZE 32 +#define ADA_LONG_TYPE_SIZE 64 -/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ +/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ #undef POINTER_SIZE #define POINTER_SIZE 32 #define POINTERS_EXTEND_UNSIGNED 0 @@ -110,9 +85,57 @@ Boston, MA 02111-1307, USA. */ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, \ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } +/* List the order in which to allocate registers. Each register must be + listed once, even those in FIXED_REGISTERS. + + We allocate in the following order: + $f1 (nonsaved floating-point register) + $f10-$f15 (likewise) + $f22-$f30 (likewise) + $f21-$f16 (likewise, but input args) + $f0 (nonsaved, but return value) + $f2-$f9 (saved floating-point registers) + $1 (nonsaved integer registers) + $22-$25 (likewise) + $28 (likewise) + $0 (likewise, but return value) + $21-$16 (likewise, but input args) + $27 (procedure value in OSF, nonsaved in NT) + $2-$8 (saved integer registers) + $9-$14 (saved integer registers) + $26 (return PC) + $15 (frame pointer) + $29 (global pointer) + $30, $31, $f31 (stack pointer and always zero/ap & fp) */ + +#undef REG_ALLOC_ORDER +#define REG_ALLOC_ORDER \ + {33, \ + 42, 43, 44, 45, 46, 47, \ + 54, 55, 56, 57, 58, 59, 60, 61, 62, \ + 53, 52, 51, 50, 49, 48, \ + 32, \ + 34, 35, 36, 37, 38, 39, 40, 41, \ + 1, \ + 22, 23, 24, 25, \ + 28, \ + 0, \ + 21, 20, 19, 18, 17, 16, \ + 27, \ + 2, 3, 4, 5, 6, 7, 8, \ + 9, 10, 11, 12, 13, 14, \ + 26, \ + 15, \ + 29, \ + 30, 31, 63 } + #undef HARD_FRAME_POINTER_REGNUM #define HARD_FRAME_POINTER_REGNUM 29 +/* Define registers used by the epilogue and return instruction. */ +#undef EPILOGUE_USES +#define EPILOGUE_USES(REGNO) ((REGNO) == 26 || (REGNO) == 29) + #undef CAN_ELIMINATE #define CAN_ELIMINATE(FROM, TO) \ ((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ()) @@ -126,6 +149,8 @@ Boston, MA 02111-1307, USA. */ + get_frame_size () \ + current_function_pretend_args_size) \ - current_function_pretend_args_size); \ + else \ + abort(); \ if ((TO) == STACK_POINTER_REGNUM) \ (OFFSET) += ALPHA_ROUND (current_function_outgoing_args_size); \ } @@ -143,7 +168,7 @@ Boston, MA 02111-1307, USA. */ Thus 6 or more means all following args should go on the stack. */ enum avms_arg_type {I64, FF, FD, FG, FS, FT}; -typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info; +typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info; #undef CUMULATIVE_ARGS #define CUMULATIVE_ARGS avms_arg_info @@ -158,41 +183,6 @@ typedef struct {char num_args; enum avms_arg_type atypes[6];} avms_arg_info; (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \ (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64; -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ - -extern enum avms_arg_type alpha_arg_type (); - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode (or VOIDmode for no more args). - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - - On Alpha the first 6 words of args are normally in registers - and the rest are pushed. */ - -extern struct rtx_def *alpha_arg_info_reg_val (); -#undef FUNCTION_ARG -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -((MODE) == VOIDmode ? alpha_arg_info_reg_val (CUM) \ - : ((CUM.num_args) < 6 && ! MUST_PASS_IN_STACK (MODE, TYPE) \ - ? gen_rtx(REG, (MODE), \ - ((CUM).num_args + 16 \ - + ((TARGET_FPREGS \ - && (GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ - || GET_MODE_CLASS (MODE) == MODE_FLOAT)) \ - * 32))) \ - : 0)) - #undef FUNCTION_ARG_ADVANCE #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ if (MUST_PASS_IN_STACK (MODE, TYPE)) \ @@ -234,7 +224,7 @@ extern struct rtx_def *alpha_arg_info_reg_val (); However, if NO registers need to be saved, don't allocate any space. This is not only because we won't need the space, but because AP includes the current_pretend_args_size and we don't want to mess up any - ap-relative addresses already made. */ + ap-relative addresses already made. */ #undef SETUP_INCOMING_VARARGS #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ @@ -242,7 +232,7 @@ extern struct rtx_def *alpha_arg_info_reg_val (); { \ if (! (NO_RTL)) \ { \ - emit_move_insn (gen_rtx (REG, DImode, 1), \ + emit_move_insn (gen_rtx_REG (DImode, 1), \ virtual_incoming_args_rtx); \ emit_insn (gen_arg_home ()); \ } \ @@ -251,6 +241,10 @@ extern struct rtx_def *alpha_arg_info_reg_val (); } \ } +/* ABI has stack checking, but it's broken. */ +#undef STACK_CHECK_BUILTIN +#define STACK_CHECK_BUILTIN 0 + #undef ASM_FILE_START #define ASM_FILE_START(FILE) \ { \ @@ -260,33 +254,14 @@ extern struct rtx_def *alpha_arg_info_reg_val (); ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ } -#undef ASM_OUTPUT_FLOAT -#define ASM_OUTPUT_FLOAT(FILE,VALUE) \ - { \ - if (REAL_VALUE_ISINF (VALUE) \ - || REAL_VALUE_ISNAN (VALUE) \ - || REAL_VALUE_MINUS_ZERO (VALUE)) \ - { \ - long t; \ - REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t); \ - fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff); \ - } \ - else \ - { \ - char str[30]; \ - REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str); \ - fprintf (FILE, "\t.%c_floating %s\n", (TARGET_FLOAT_VAX)?'f':'s', str); \ - } \ - } - -#define LINK_SECTION_ASM_OP ".link" -#define READONLY_SECTION_ASM_OP ".rdata" -#define LITERALS_SECTION_ASM_OP ".literals" -#define CTORS_SECTION_ASM_OP ".ctors" -#define DTORS_SECTION_ASM_OP ".dtors" +#define LINK_SECTION_ASM_OP "\t.link" +#define READONLY_SECTION_ASM_OP "\t.rdata" +#define LITERALS_SECTION_ASM_OP "\t.literals" +#define CTORS_SECTION_ASM_OP "\t.ctors" +#define DTORS_SECTION_ASM_OP "\t.dtors" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_link, in_rdata, in_literals, in_ctors, in_dtors +#define EXTRA_SECTIONS in_link, in_rdata, in_literals #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ @@ -316,26 +291,12 @@ literals_section () \ fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \ in_section = in_literals; \ } \ -} \ -void \ -ctors_section () \ -{ \ - if (in_section != in_ctors) \ - { \ - fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ - in_section = in_ctors; \ - } \ -} \ -void \ -dtors_section () \ -{ \ - if (in_section != in_dtors) \ - { \ - fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ - in_section = in_dtors; \ - } \ } +extern void readonly_section PARAMS ((void)); +extern void link_section PARAMS ((void)); +extern void literals_section PARAMS ((void)); + #undef ASM_OUTPUT_ADDR_DIFF_ELT #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) abort () @@ -359,17 +320,16 @@ dtors_section () \ /* This says how to output assembler code to declare an uninitialized external linkage data object. */ -#define COMMON_ASM_OP ".comm" +#define COMMON_ASM_OP "\t.comm\t" #undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ do { \ - fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ + fprintf ((FILE), "%s", COMMON_ASM_OP); \ assemble_name ((FILE), (NAME)); \ fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ } while (0) -#define NO_MD_PROTOTYPES /* Output assembler code for a block containing the constant parts of a trampoline, leaving space for the variable parts. @@ -377,8 +337,7 @@ do { \ The trampoline should set the static chain pointer to value placed into the trampoline and should branch to the specified routine. Note that $27 has been set to the address of the trampoline, so we can - use it for addressability of the two data items. Trampolines are always - aligned to FUNCTION_BOUNDARY, which is 64 bits. */ + use it for addressability of the two data items. */ #undef TRAMPOLINE_TEMPLATE #define TRAMPOLINE_TEMPLATE(FILE) \ @@ -393,6 +352,11 @@ do { \ #undef TRAMPOLINE_SIZE #define TRAMPOLINE_SIZE 32 +/* The alignment of a trampoline, in bits. */ + +#undef TRAMPOLINE_ALIGNMENT +#define TRAMPOLINE_ALIGNMENT 64 + /* Emit RTL insns to initialize the variable parts of a trampoline. FNADDR is an RTX for the address of the function's pure code. CXT is an RTX for the static chain value for the function. */ @@ -401,35 +365,69 @@ do { \ #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 24, -1) -/* A C statement (sans semicolon) to output an element in the table of - global constructors. */ -#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ - do { \ - ctors_section (); \ - fprintf (FILE, "\t.quad "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -/* A C statement (sans semicolon) to output an element in the table of - global destructors. */ -#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ - do { \ - dtors_section (); \ - fprintf (FILE, "\t.quad "); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, "\n"); \ - } while (0) - -#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \ - (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS)) -extern int vms_valid_decl_attribute_p (); +/* Control how constructors and destructors are emitted. */ +#define TARGET_ASM_CONSTRUCTOR vms_asm_out_constructor +#define TARGET_ASM_DESTRUCTOR vms_asm_out_destructor #undef SDB_DEBUGGING_INFO #undef MIPS_DEBUGGING_INFO #undef DBX_DEBUGGING_INFO #define DWARF2_DEBUGGING_INFO +#define VMS_DEBUGGING_INFO + +#define DWARF2_UNWIND_INFO 1 + +#undef EH_RETURN_HANDLER_RTX +#define EH_RETURN_HANDLER_RTX \ + gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8)) + +#define LINK_EH_SPEC "vms-dwarf2eh.o%s " + +#ifdef IN_LIBGCC2 +#include <libicb.h> +#include <pdscdef.h> + +#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ + do { \ + unsigned long handle; \ + PDSCDEF *pv; \ + INVO_CONTEXT_BLK invo; \ + \ + memset (&invo, 0, sizeof (INVO_CONTEXT_BLK)); \ + \ + invo.libicb$q_ireg [29] = *((long long *) (CONTEXT)->reg [29]); \ + invo.libicb$q_ireg [30] = (long long) (CONTEXT)->cfa; \ + handle = LIB$GET_INVO_HANDLE (&invo); \ + LIB$GET_INVO_CONTEXT (handle, &invo); \ + pv = (PDSCDEF *) invo.libicb$ph_procedure_descriptor; \ + \ + if (pv && ((pv->pdsc$w_flags & 0xf) == PDSC$K_KIND_FP_STACK)) \ + { \ + int i, j; \ + \ + (FS)->cfa_offset = pv->pdsc$l_size; \ + (FS)->cfa_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30; \ + (FS)->retaddr_column = 26; \ + (FS)->cfa_how = CFA_REG_OFFSET; \ + (FS)->regs.reg[27].loc.offset = -pv->pdsc$l_size; \ + (FS)->regs.reg[27].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[26].loc.offset \ + = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset); \ + (FS)->regs.reg[26].how = REG_SAVED_OFFSET; \ + \ + for (i = 0, j = 0; i < 32; i++) \ + if (1<<i & pv->pdsc$l_ireg_mask) \ + { \ + (FS)->regs.reg[i].loc.offset \ + = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset - 8 * ++j); \ + (FS)->regs.reg[i].how = REG_SAVED_OFFSET; \ + } \ + \ + goto SUCCESS; \ + } \ +} while (0) +#endif /* This is how to output an assembler line that says to advance the location counter @@ -439,30 +437,8 @@ extern int vms_valid_decl_attribute_p (); #define ASM_OUTPUT_ALIGN(FILE,LOG) \ fprintf (FILE, "\t.align %d\n", LOG); -#define ASM_OUTPUT_SECTION(FILE,SECTION) \ - (strcmp (SECTION, ".text") == 0) \ - ? text_section () \ - : named_section (NULL_TREE, SECTION, 0), \ - ASM_OUTPUT_ALIGN (FILE, 0) \ - -#define ASM_OUTPUT_SECTION_NAME(FILE,DECL,NAME,RELOC) \ - do \ - { \ - char *flags; \ - int ovr = 0; \ - if (DECL && DECL_MACHINE_ATTRIBUTES (DECL) \ - && lookup_attribute \ - ("overlaid", DECL_MACHINE_ATTRIBUTES (DECL))) \ - flags = ",OVR", ovr = 1; \ - else if (strncmp (NAME,".debug", 6) == 0) \ - flags = ",NOWRT"; \ - else \ - flags = ""; \ - fputc ('\n', (FILE)); \ - fprintf (FILE, ".section\t%s%s\n", NAME, flags); \ - if (ovr) \ - (NAME) = ""; \ - } while (0) +/* Switch into a generic section. */ +#define TARGET_ASM_NAMED_SECTION vms_asm_named_section #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ do { literals_section(); \ @@ -474,7 +450,7 @@ extern int vms_valid_decl_attribute_p (); } while (0) #undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG #undef ASM_FORMAT_PRIVATE_NAME #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ @@ -486,10 +462,38 @@ extern int vms_valid_decl_attribute_p (); #undef ASM_SPEC #undef ASM_FINAL_SPEC + +/* The VMS convention is to always provide minimal debug info + for a traceback unless specifically overridden. Defaulting this here + is a kludge. */ + +#define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \ +{ \ + write_symbols = VMS_DEBUG; \ + debug_info_level = (enum debug_info_level) 1; \ +} + +/* Override traceback debug info on -g0. */ +#undef OVERRIDE_OPTIONS +#define OVERRIDE_OPTIONS \ +{ \ + if (write_symbols == NO_DEBUG) \ + debug_info_level = (enum debug_info_level) 0; \ + override_options (); \ +} + +/* Link with vms-dwarf2.o if -g (except -g0). This causes the + VMS link to pull all the dwarf2 debug sections together. */ #undef LINK_SPEC +#define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \ +%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}" + #undef STARTFILE_SPEC -#define ASM_SPEC "-nocpp %{pg}" -#define LINK_SPEC "%{g3:-g3} %{g0:-g0} %{shared:-shared} %{v:-v}" +#define STARTFILE_SPEC "%{!shared:%{mvms-return-codes:vcrt0.o%s} \ +%{!mvms-return-codes:pcrt0.o%s}}" + +#undef LIB_SPEC +#define LIB_SPEC "-lc" /* Define the names of the division and modulus functions. */ #define DIVSI3_LIBCALL "OTS$DIV_I" @@ -501,6 +505,14 @@ extern int vms_valid_decl_attribute_p (); #define UMODSI3_LIBCALL "OTS$REM_UI" #define UMODDI3_LIBCALL "OTS$REM_UL" -#define DIR_SEPARATOR ']' +#define NAME__MAIN "__gccmain" +#define SYMBOL__MAIN __gccmain -#define PREFIX "GNU_ROOT:" +/* Specify the list of include file directories. */ +#define INCLUDE_DEFAULTS \ +{ \ + { "/gnu_gxx_include", 0, 1, 1 }, \ + { "/gnu_cc_include", 0, 0, 0 }, \ + { "/gnu/include", 0, 0, 0 }, \ + { 0, 0, 0, 0 } \ +} |