Hi, this patch extract common definitions from alpha/vms.h and ia64/vms.h into vms/vms.h to reduce code duplication. It replaces alpha/vms64.h and ia64/vms64.h by vms/vms.h for the same purpose.
Applied on trunk. Tristan. 2011-11-07 Tristan Gingold <ging...@adacore.com> * config/alpha/vms.h (TARGET_OBJECT_SUFFIX, TARGET_EXECUTABLE_SUFFIX, TARGET_OS_CPP_BUILTINS, TARGET_ABI_OPEN_VMS, LONG_TYPE_SIZE, ADA_LONG_TYPE_SIZE, POINTER_SIZE, POINTERS_EXTEND_UNSIGNED): Move to config/vms/vms.h (SUBTARGET_OS_CPP_BUILTINS): Define. (TARGET_DEFAULT): Tune according to POINTER_SIZE. (MASK_RETURN_ADDR): Define in 64 bit mode. * config/ia64/vms.h: Likewise. * config/vms/vms.h: New file. * config/vms/vms64.h: New file. * config/alpha/vms64.h: Removed. * config/ia64/vms64.h: Removed. * config.gcc (alpha64-dec-*vms*, alpha*-dec-*vms*, ia64-hp-*vms*): Adjust for above change. Index: config.gcc =================================================================== --- config.gcc (revision 181074) +++ config.gcc (working copy) @@ -790,12 +790,12 @@ esac ;; alpha64-dec-*vms*) - tm_file="${tm_file} alpha/vms.h alpha/vms64.h" + tm_file="${tm_file} vms/vms.h vms/vms64.h alpha/vms.h" xm_file="alpha/xm-vms.h vms/xm-vms64.h" tmake_file="${tmake_file} vms/t-vms64 alpha/t-vms" ;; alpha*-dec-*vms*) - tm_file="${tm_file} alpha/vms.h" + tm_file="${tm_file} vms/vms.h alpha/vms.h" xm_file="alpha/xm-vms.h" tmake_file="${tmake_file} alpha/t-vms" ;; @@ -1528,7 +1528,7 @@ esac ;; ia64-hp-*vms*) - tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h ia64/vms.h ia64/vms64.h" + tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h vms/vms.h vms/vms64.h ia64/vms.h" xm_file="vms/xm-vms.h vms/xm-vms64.h" tmake_file="${tmake_file} vms/t-vms64 ia64/t-ia64" target_cpu_default="0" Index: config/alpha/vms.h =================================================================== --- config/alpha/vms.h (revision 181074) +++ config/alpha/vms.h (working copy) @@ -19,9 +19,6 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -#define TARGET_OBJECT_SUFFIX ".obj" -#define TARGET_EXECUTABLE_SUFFIX ".exe" - /* Alpha/VMS object format is not really Elf, but this makes compiling crtstuff.c and dealing with shared library initialization much easier. */ #define OBJECT_FORMAT_ELF @@ -33,37 +30,26 @@ #define NO_EXTERNAL_INDIRECT_ADDRESS -#define TARGET_OS_CPP_BUILTINS() \ +#define SUBTARGET_OS_CPP_BUILTINS() \ do { \ - builtin_define_std ("vms"); \ - builtin_define_std ("VMS"); \ - builtin_define ("__ALPHA"); \ - builtin_assert ("system=vms"); \ - if (TARGET_FLOAT_VAX) \ - builtin_define ("__G_FLOAT"); \ - else \ - builtin_define ("__IEEE_FLOAT"); \ + builtin_define ("__ALPHA"); \ + if (TARGET_FLOAT_VAX) \ + builtin_define ("__G_FLOAT"); \ + else \ + builtin_define ("__IEEE_FLOAT"); \ } while (0) #undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_FPREGS|MASK_GAS) -#undef TARGET_ABI_OPEN_VMS -#define TARGET_ABI_OPEN_VMS 1 +#if POINTER_SIZE == 64 +#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64) +#else +#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS) +#endif #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO" #undef PCC_STATIC_STRUCT_RETURN -/* "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. */ -#undef POINTER_SIZE -#define POINTER_SIZE 32 -#define POINTERS_EXTEND_UNSIGNED 0 - #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */ /* The maximum alignment 'malloc' honors. */ @@ -170,6 +156,12 @@ #define DEFAULT_PCC_STRUCT_RETURN 0 +#if POINTER_SIZE == 64 +/* Eventhough pointers are 64bits, only 32bit ever remain significant in code + addresses. */ +#define MASK_RETURN_ADDR (GEN_INT (0xffffffff)) +#endif + #undef ASM_WEAKEN_LABEL #define ASM_WEAKEN_LABEL(FILE, NAME) \ do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ Index: config/alpha/vms64.h =================================================================== --- config/alpha/vms64.h (revision 181074) +++ config/alpha/vms64.h (working copy) @@ -1,51 +0,0 @@ -/* Output variables, constants and external declarations, for GNU compiler. - Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc. - Contributed by Douglas Rupp (r...@gnat.com). - -This file is part of GCC. - -GCC 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 3, or (at your option) -any later version. - -GCC 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 GCC; see the file COPYING3. If not see -<http://www.gnu.org/licenses/>. */ - -#undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define_std ("vms"); \ - builtin_define_std ("VMS"); \ - builtin_define ("__ALPHA"); \ - builtin_assert ("system=vms"); \ - builtin_define ("__IEEE_FLOAT"); \ - builtin_define ("__LONG_POINTERS=1"); \ - } while (0) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "malloc64", MASK_MALLOC64, "Malloc data into P2 space" }, - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64) - -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 64 - -#undef POINTER_SIZE -#define POINTER_SIZE 64 - -/* Eventhough pointers are 64bits, only 32bit ever remain significant in code - addresses. */ -#define MASK_RETURN_ADDR (GEN_INT (0xffffffff)) - -/* Defaults to "long int" */ -#undef SIZE_TYPE -#undef PTRDIFF_TYPE Index: config/vms/vms64.h =================================================================== --- config/vms/vms64.h (revision 0) +++ config/vms/vms64.h (revision 0) @@ -0,0 +1,29 @@ +/* Output variables, constants and external declarations, for GNU compiler. + Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc. + Contributed by Douglas Rupp (r...@gnat.com). + +This file is part of GCC. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#undef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE 64 + +#undef POINTER_SIZE +#define POINTER_SIZE 64 + +/* Defaults to "long int" */ +#undef SIZE_TYPE +#undef PTRDIFF_TYPE Index: config/vms/vms.h =================================================================== --- config/vms/vms.h (revision 0) +++ config/vms/vms.h (revision 0) @@ -0,0 +1,57 @@ +/* Definitions of target machine GNU compiler. VMS common version. + Copyright (C) 2003-2009,2011 Free Software Foundation, Inc. + Contributed by Douglas B Rupp (r...@gnat.com). + +This file is part of GCC. + +GCC 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 3, or (at your option) +any later version. + +GCC 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 GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#define TARGET_OBJECT_SUFFIX ".obj" +#define TARGET_EXECUTABLE_SUFFIX ".exe" + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define_std ("vms"); \ + builtin_define_std ("VMS"); \ + builtin_assert ("system=vms"); \ + SUBTARGET_OS_CPP_BUILTINS(); \ + if (POINTER_SIZE == 64) \ + { \ + builtin_define ("__LONG_POINTERS=1"); \ + builtin_define ("__int64=long long"); \ + } \ + } while (0) + +/* By default, allow $ to be part of an identifier. */ +#define DOLLARS_IN_IDENTIFIERS 2 + +#undef TARGET_ABI_OPEN_VMS +#define TARGET_ABI_OPEN_VMS 1 + +/* "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. */ +#undef POINTER_SIZE +#define POINTER_SIZE 32 +#define POINTERS_EXTEND_UNSIGNED 0 + +/* Always 32 bits. */ +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" Index: config/ia64/vms.h =================================================================== --- config/ia64/vms.h (revision 181074) +++ config/ia64/vms.h (working copy) @@ -18,42 +18,24 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ -#define TARGET_OBJECT_SUFFIX ".obj" -#define TARGET_EXECUTABLE_SUFFIX ".exe" - #define OBJECT_FORMAT_ELF -#define TARGET_OS_CPP_BUILTINS() \ +#define SUBTARGET_OS_CPP_BUILTINS() \ do { \ - builtin_define_std ("vms"); \ - builtin_define_std ("VMS"); \ builtin_define ("__IA64"); \ - builtin_assert ("system=vms"); \ builtin_define ("__IEEE_FLOAT"); \ } while (0) -/* By default, allow $ to be part of an identifier. */ -#define DOLLARS_IN_IDENTIFIERS 2 - -#undef TARGET_ABI_OPEN_VMS -#define TARGET_ABI_OPEN_VMS 1 - /* Need .debug_line info generated from gcc and gas. */ #undef TARGET_DEFAULT +#if POINTER_SIZE == 64 +#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64) +#else #define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS) +#endif #define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO" -/* "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. */ -#undef POINTER_SIZE -#define POINTER_SIZE 32 -#define POINTERS_EXTEND_UNSIGNED 0 - #undef MAX_OFILE_ALIGNMENT #define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */ Index: config/ia64/vms64.h =================================================================== --- config/ia64/vms64.h (revision 181074) +++ config/ia64/vms64.h (working copy) @@ -1,39 +0,0 @@ -/* Definitions of target machine GNU compiler. 64bit IA64-VMS version. - Copyright (C) 2004-2009 Free Software Foundation, Inc. - Contributed by Douglas B Rupp (r...@gnat.com). - -This file is part of GCC. - -GCC 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 3, or (at your option) -any later version. - -GCC 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 GCC; see the file COPYING3. If not see -<http://www.gnu.org/licenses/>. */ - -#undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define_std ("vms"); \ - builtin_define_std ("VMS"); \ - builtin_define ("__IA64"); \ - builtin_assert ("system=vms"); \ - builtin_define ("__IEEE_FLOAT"); \ - builtin_define ("__LONG_POINTERS=1"); \ - } while (0) - -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 64 - -#undef POINTER_SIZE -#define POINTER_SIZE 64 - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64)