diff options
Diffstat (limited to 'gcc/config/alpha')
-rw-r--r-- | gcc/config/alpha/alpha-interix.h | 252 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.md | 1 | ||||
-rw-r--r-- | gcc/config/alpha/alpha32.h | 104 | ||||
-rw-r--r-- | gcc/config/alpha/t-interix | 10 | ||||
-rw-r--r-- | gcc/config/alpha/win-nt.h | 67 | ||||
-rw-r--r-- | gcc/config/alpha/xm-alpha-interix.h | 45 |
6 files changed, 412 insertions, 67 deletions
diff --git a/gcc/config/alpha/alpha-interix.h b/gcc/config/alpha/alpha-interix.h new file mode 100644 index 00000000000..668fe9397af --- /dev/null +++ b/gcc/config/alpha/alpha-interix.h @@ -0,0 +1,252 @@ +/* Definitions of target machine for GNU compiler, for DEC Alpha + running Windows/NT. + Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc. + + Donn Terry, Softway Systems, Inc. + From code + Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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. */ + +/* cpp handles __STDC__ */ +/* The three "Alpha" defines on the first such line are from the CLAXP spec */ +#undef CPP_PREDEFINES +#define CPP_PREDEFINES " \ + -D__INTERIX \ + -D__OPENNT \ + -D__Alpha_AXP -D_M_ALPHA -D_ALPHA_ \ + -D__alpha -D__alpha__\ + -D__stdcall= \ + -D__cdecl= \ + -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(alpha) -Amachine(alpha)" + +#undef CPP_SUBTARGET_SPEC +#define CPP_SUBTARGET_SPEC "\ +-remap \ +%{posix:-D_POSIX_SOURCE} \ +-idirafter %$INTERIX_ROOT/usr/include" + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (alpha Interix)"); + +/* alpha.h sets this, but it doesn't apply to us */ +#undef OBJECT_FORMAT_ECOFF +#undef OBJECT_FORMAT_COFF + +/* LINK_SPEC */ + +/* MD_STARTFILE_PREFIX */ + +/* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */ + +/* Codegen macro overrides for NT internal conventions */ + +/* the below are ecoff specific... we don't need them, so + undef them (they'll get a default later) */ + +#undef PUT_SDB_BLOCK_START +#undef PUT_SDB_BLOCK_END + +/* the following are OSF linker (not gld) specific... we don't want them */ +#undef HAS_INIT_SECTION +#undef LD_INIT_SWITCH +#undef LD_FINI_SWITCH + + +/* The following are needed for C++, but also needed for profiling */ + +/* Support const sections and the ctors and dtors sections for g++. + Note that there appears to be two different ways to support const + sections at the moment. You can either #define the symbol + READONLY_DATA_SECTION (giving it some code which switches to the + readonly data section) or else you can #define the symbols + EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and + SELECT_RTX_SECTION. We do both here just to be on the safe side. */ + +#define USE_CONST_SECTION 1 + +#define CONST_SECTION_ASM_OP ".rdata" + +/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. + + Note that we want to give these sections the SHF_WRITE attribute + because these sections will actually contain data (i.e. tables of + addresses of functions in the current root executable or shared library + file) and, in the case of a shared library, the relocatable addresses + will have to be properly resolved/relocated (and then written into) by + the dynamic linker when it actually attaches the given shared library + to the executing process. (Note that on SVR4, you may wish to use the + `-z text' option to the ELF linker, when building a shared library, as + an additional check that you are doing everything right. But if you do + use the `-z text' option when building a shared library, you will get + errors unless the .ctors and .dtors sections are marked as writable + via the SHF_WRITE attribute.) */ + +#define CTORS_SECTION_ASM_OP ".ctors" +#define DTORS_SECTION_ASM_OP ".dtors" + +/* A default list of other sections which we might be "in" at any given + time. For targets that use additional sections (e.g. .tdesc) you + should override this definition in the target-specific file which + includes this file. */ + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_const, in_ctors, in_dtors + +/* A default list of extra section function definitions. For targets + that use additional sections (e.g. .tdesc) you should override this + definition in the target-specific file which includes this file. */ + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CONST_SECTION_FUNCTION \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION + +#undef READONLY_DATA_SECTION +#define READONLY_DATA_SECTION() const_section () + +extern void text_section (); + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section(); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} + +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} + +#define INT_ASM_OP ".long" + +/* 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%s\t ", INT_ASM_OP); \ + 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%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* The linker will take care of this, and having them causes problems with + ld -r (specifically -rU). */ +#define CTOR_LISTS_DEFINED_EXTERNALLY 1 + +#define SET_ASM_OP ".set" +/* Output a definition (implements alias) */ +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ +do \ +{ \ + fprintf ((FILE), "\t"); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, "="); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, "\n"); \ + } \ +while (0) + +/* We use the defaults, so undef the null definitions */ +#undef PUT_SDB_FUNCTION_START +#undef PUT_SDB_FUNCTION_END +#undef PUT_SDB_EPILOGUE_END + +#define HOST_PTR_PRINTF "%p" +#define HOST_PTR_AS_INT unsigned long + +#define PCC_BITFIELD_TYPE_MATTERS 1 +#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec) +#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) + +/* DWARF2 Unwinding doesn't work with exception handling yet. */ +#undef DWARF2_UNWIND_INFO + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +/* The definition of this macro implies that there are cases where + a scalar value cannot be returned in registers. + + On NT (according to the spec) anything except strings/array that fits + in 64 bits is returned in the registers (this appears to differ from + the rest of the Alpha family). */ + +#undef RETURN_IN_MEMORY +#define RETURN_IN_MEMORY(TYPE) \ + (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8) + +#define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n" + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ +{ \ + alpha_write_verstamp (FILE); \ + fprintf (FILE, "\t.set noreorder\n"); \ + fprintf (FILE, "\t.set volatile\n"); \ + fprintf (FILE, "\t.set noat\n"); \ + fprintf (FILE, "\t.globl\t__fltused\n"); \ + ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ +} + +/* The current Interix assembler (consistent with the DEC documentation) + uses a=b NOT .set a,b; .set is for assembler options. */ +#undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL +#define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO) \ + do { \ + assemble_name (FILE, SY); \ + fputc ('=', FILE); \ + assemble_name (FILE, HI); \ + fputc ('-', FILE); \ + assemble_name (FILE, LO); \ + } while (0) diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 7a2ce2fd032..5c4971737c0 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -850,6 +850,7 @@ ;; do the right thing if the inputs are not properly sign-extended. ;; But Linux, for instance, does not have this problem. Is it worth ;; the complication here to eliminate the sign extension? +;; Interix/NT has the same sign-extension problem. (define_expand "divsi3" [(set (reg:DI 24) diff --git a/gcc/config/alpha/alpha32.h b/gcc/config/alpha/alpha32.h new file mode 100644 index 00000000000..b8447985270 --- /dev/null +++ b/gcc/config/alpha/alpha32.h @@ -0,0 +1,104 @@ +/* Definitions of target machine for GNU compiler, for DEC Alpha + running Windows/NT. + Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. + + Derived from code + Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) + + Donn Terry, Softway Systems, Inc. + + This file contains the code-generation stuff common to the 32-bit + versions of the DEC/Compaq Alpha architecture. It is shared by + Interix and NT/Win32 ports. It should not contain compile-time + or run-time dependent environment values (such as compiler options + or anything containing a file or pathname.) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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. */ + +#undef TARGET_WINDOWS_NT +#define TARGET_WINDOWS_NT 1 + +/* WinNT (and thus Interix) use unsigned int */ +#define SIZE_TYPE "unsigned int" + +/* 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 + +/* We don't change Pmode to the "obvious" SI mode... the above appears + to affect the in-memory size; we want the registers to stay DImode + to match the md file */ + +/* "long" is 32 bits. */ +#undef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE 32 + + +/* Output assembler code for a block containing the constant parts + of a trampoline, leaving space for the variable parts. + + The trampoline should set the static chain pointer to value placed + into the trampoline and should branch to the specified routine. */ + +#undef TRAMPOLINE_TEMPLATE +#define TRAMPOLINE_TEMPLATE(FILE) \ +{ \ + fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \ + fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \ + fprintf (FILE, "\tldl $27,16($27)\n"); \ + fprintf (FILE, "\tjmp $31,($27),0\n"); \ + fprintf (FILE, "\t.long 0,0\n"); \ +} + +/* Length in units of the trampoline for entering a nested function. */ + +#undef TRAMPOLINE_SIZE +#define TRAMPOLINE_SIZE 24 + +/* 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. */ + +#undef INITIALIZE_TRAMPOLINE +#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ + alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 20, 12) + +/* Output code to add DELTA to the first argument, and then jump to FUNCTION. + Used for C++ multiple inheritance. */ + +#undef ASM_OUTPUT_MI_THUNK +#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ +do { \ + char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ + int reg; \ + \ + /* Mark end of prologue. */ \ + output_end_prologue (FILE); \ + \ + /* Rely on the assembler to macro expand a large delta. */ \ + reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \ + fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg); \ + \ + op = "jsr"; \ + if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ + op = "br"; \ + fprintf (FILE, "\t%s $31,", op); \ + assemble_name (FILE, fn_name); \ + fputc ('\n', FILE); \ +} while (0) diff --git a/gcc/config/alpha/t-interix b/gcc/config/alpha/t-interix new file mode 100644 index 00000000000..57ca4f4781e --- /dev/null +++ b/gcc/config/alpha/t-interix @@ -0,0 +1,10 @@ +# t-interix + +# System headers will track gcc's needs. +# Even LANG_EXTRA_HEADERS may be temporary. +USER_H=$(LANG_EXTRA_HEADERS) + +# We don't want this one either. +INSTALL_ASSERT_H= + + diff --git a/gcc/config/alpha/win-nt.h b/gcc/config/alpha/win-nt.h index a3aa27519b6..518580a9530 100644 --- a/gcc/config/alpha/win-nt.h +++ b/gcc/config/alpha/win-nt.h @@ -23,9 +23,6 @@ Boston, MA 02111-1307, USA. */ #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_FP | MASK_FPREGS) -#undef TARGET_WINDOWS_NT -#define TARGET_WINDOWS_NT 1 - /* Names to predefine in the preprocessor for this target machine. */ #undef CPP_PREDEFINES @@ -36,15 +33,6 @@ Boston, MA 02111-1307, USA. */ #undef ASM_FINAL_SPEC #define ASM_SPEC "-nopp -nologo %{g:-Zi}" -/* 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 - -/* "long" is 32 bits. */ -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 32 - #undef WCHAR_TYPE #define WCHAR_TYPE "short unsigned int" #undef WCHAR_TYPE_SIZE @@ -55,8 +43,6 @@ Boston, MA 02111-1307, USA. */ #undef DBX_DEBUGGING_INFO #undef MIPS_DEBUGGING_INFO -#include "winnt/win-nt.h" - #undef ASM_FILE_START #define ASM_FILE_START(FILE) \ { \ @@ -74,56 +60,3 @@ Boston, MA 02111-1307, USA. */ %{!mwindows:-subsystem console -e _mainCRTStartup} \ %{mcrtmt:LIBCMT.LIB%s KERNEL32.LIB%s} %{!mcrtmt:LIBC.LIB%s KERNEL32.LIB%s} \ %{v}" - - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. */ - -#undef TRAMPOLINE_TEMPLATE -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \ - fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \ - fprintf (FILE, "\tldl $27,16($27)\n"); \ - fprintf (FILE, "\tjmp $31,($27),0\n"); \ - fprintf (FILE, "\t.long 0,0\n"); \ -} - -/* Length in units of the trampoline for entering a nested function. */ - -#undef TRAMPOLINE_SIZE -#define TRAMPOLINE_SIZE 24 - -/* 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. */ - -#undef INITIALIZE_TRAMPOLINE -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 16, 20, 12) - -/* Output code to add DELTA to the first argument, and then jump to FUNCTION. - Used for C++ multiple inheritance. */ - -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - char *op, *fn_name = XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0); \ - int reg; \ - \ - /* Mark end of prologue. */ \ - output_end_prologue (FILE); \ - \ - /* Rely on the assembler to macro expand a large delta. */ \ - reg = aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) ? 17 : 16; \ - fprintf (FILE, "\tlda $%d,%ld($%d)\n", reg, (long)(DELTA), reg); \ - \ - op = "jsr"; \ - if (current_file_function_operand (XEXP (DECL_RTL (FUNCTION), 0))) \ - op = "br"; \ - fprintf (FILE, "\t%s $31,", op); \ - assemble_name (FILE, fn_name); \ - fputc ('\n', FILE); \ -} while (0) diff --git a/gcc/config/alpha/xm-alpha-interix.h b/gcc/config/alpha/xm-alpha-interix.h new file mode 100644 index 00000000000..02c53b81412 --- /dev/null +++ b/gcc/config/alpha/xm-alpha-interix.h @@ -0,0 +1,45 @@ +/* Configuration for GNU compiler + for an DEC/Compaq Alpha + Copyright (C) 1999 Free Software Foundation, Inc. + Donn Terry, Softway Systems, Inc. + derived from code by Douglas B. Rupp (drupp@cs.washington.edu) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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. */ + +#include <alpha/xm-alpha.h> + +#undef HOST_BITS_PER_LONG +#define HOST_BITS_PER_LONG 32 + +#define HOST_BITS_PER_WIDE_INT 64 +#ifdef __GNUC__ +# define HOST_WIDE_INT long long +#else +# define HOST_WIDE_INT __int64 +#endif + + +#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG +#ifdef __GNUC__ +# define HOST_WIDEST_INT long long +#else +# define HOST_WIDEST_INT __int64 +#endif +#define HOST_WIDEST_INT_PRINT_DEC "%lld" +#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" +#define HOST_WIDEST_INT_PRINT_HEX "0x%llx" |