alpha.c: Include libfuncs.h
authorDouglas B Rupp <rupp@gnat.com>
Mon, 10 Aug 2009 04:50:23 +0000 (04:50 +0000)
committerDouglas Rupp <rupp@gcc.gnu.org>
Mon, 10 Aug 2009 04:50:23 +0000 (04:50 +0000)
* config/alpha/alpha.c: Include libfuncs.h
(avms_asm_output_extern): New function.
(alpha_init_libfuncs): Init some decc libfuncs.
* config/alpha/alpha-protos.h (avms_asm_output_external): Declare.
* config/alpha/vms.h (ASM_OUTPUT_EXTERNAL): Define.
(DO_CRTL_NAMES): Define.
(LIB_SPEC): Remove.
* config/alpha/vms64.h: (POINTERS_EXTEND_UNSIGNED): Remove undef.
(LONG_TYPE_SIZE): Define.
(TARGET_OS_CPP_BUILTINS): Define with __LONG_POINTERS=1
(SUBTARGET_SWITCHES): Define malloc64 switch.
(TARGET_DEFAULT): Default MASK_MALLOC64 set.
(MASK_RETURN_ADDR): Define.
doc/invoke.texi (mmalloc64): Document switch.

From-SVN: r150614

gcc/ChangeLog
gcc/config/alpha/alpha-protos.h
gcc/config/alpha/alpha.c
gcc/config/alpha/vms.h
gcc/config/alpha/vms64.h
gcc/doc/invoke.texi

index f9f6ac7..c6c25de 100644 (file)
@@ -1,3 +1,20 @@
+2009-08-09  Douglas B Rupp  <rupp@gnat.com>
+
+       * config/alpha/alpha.c: Include libfuncs.h
+       (avms_asm_output_extern): New function.
+       (alpha_init_libfuncs): Init some decc libfuncs.
+       * config/alpha/alpha-protos.h (avms_asm_output_external): Declare.
+       * config/alpha/vms.h (ASM_OUTPUT_EXTERNAL): Define.
+       (DO_CRTL_NAMES): Define.
+       (LIB_SPEC): Remove.
+       * config/alpha/vms64.h: (POINTERS_EXTEND_UNSIGNED): Remove undef.
+       (LONG_TYPE_SIZE): Define.
+       (TARGET_OS_CPP_BUILTINS): Define with __LONG_POINTERS=1
+       (SUBTARGET_SWITCHES): Define malloc64 switch.
+       (TARGET_DEFAULT): Default MASK_MALLOC64 set.
+       (MASK_RETURN_ADDR): Define.
+       doc/invoke.texi (mmalloc64): Document switch.
+
 2009-08-09  Olivier Hainque  <hainque@adacore.com>
             Douglas B Rupp  <rupp@gnat.com>
 
index 244ff71..a4cbc09 100644 (file)
@@ -1,5 +1,5 @@
 /* Prototypes for alpha.c functions used in the md file & elsewhere.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -112,6 +112,7 @@ extern rtx alpha_use_linkage (rtx, tree, int, int);
 #if TARGET_ABI_OPEN_VMS
 extern enum avms_arg_type alpha_arg_type (enum machine_mode);
 extern rtx alpha_arg_info_reg_val (CUMULATIVE_ARGS);
+extern void avms_asm_output_external (FILE *, tree, const char *);
 #endif
 
 extern rtx unicosmk_add_call_info_word (rtx);
index 3857909..0bf5294 100644 (file)
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-stdarg.h"
 #include "tm-constrs.h"
 #include "df.h"
+#include "libfuncs.h"
 
 /* Specify which cpu to schedule for.  */
 enum processor_type alpha_tune;
@@ -8494,6 +8495,15 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
     }
 }
 
+#if TARGET_ABI_OPEN_VMS
+void avms_asm_output_external (FILE *file, tree decl ATTRIBUTE_UNUSED, const char *name)
+{
+#ifdef DO_CRTL_NAMES
+  DO_CRTL_NAMES;
+#endif
+}
+#endif
+
 #if TARGET_ABI_OSF
 /* Emit a tail call to FUNCTION after adjusting THIS by DELTA.
 
@@ -10853,6 +10863,11 @@ alpha_init_libfuncs (void)
       set_optab_libfunc (smod_optab, DImode, "OTS$REM_L");
       set_optab_libfunc (umod_optab, SImode, "OTS$REM_UI");
       set_optab_libfunc (umod_optab, DImode, "OTS$REM_UL");
+      abort_libfunc = init_one_libfunc ("decc$abort");
+      memcmp_libfunc = init_one_libfunc ("decc$memcmp");
+#ifdef MEM_LIBFUNCS_INIT
+      MEM_LIBFUNCS_INIT;
+#endif
     }
 }
 
index 7b149f1..fd7e03b 100644 (file)
@@ -73,6 +73,10 @@ along with GCC; see the file COPYING3.  If not see
 
 #define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada Test CD40VRA */
 
+/* The maximum alignment 'malloc' honors.  */
+#undef  MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
+
 #undef FIXED_REGISTERS
 #define FIXED_REGISTERS  \
  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
@@ -295,6 +299,55 @@ do {                                                                       \
 #define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
 #endif
 
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+  avms_asm_output_external (FILE, DECL, NAME)
+
+typedef struct crtl_name_spec
+{
+  const char *const name;
+  const char *deccname;
+  int referenced;
+} crtl_name_spec;
+
+#include "config/vms/vms-crtl.h"
+
+/* Alias CRTL names to 32/64bit DECCRTL functions. 
+   Fixme: This should do a binary search.  */
+#define DO_CRTL_NAMES                                                      \
+  do                                                                       \
+    {                                                                      \
+      int i;                                                               \
+      static crtl_name_spec vms_crtl_names[] = CRTL_NAMES;                 \
+      static int malloc64_init = 0;                                        \
+                                                                           \
+      if ((malloc64_init == 0) && TARGET_MALLOC64)                        \
+       {                                                                  \
+          for (i=0; vms_crtl_names [i].name; i++)                          \
+            {                                                              \
+             if (strcmp ("calloc", vms_crtl_names [i].name) == 0)         \
+                vms_crtl_names [i].deccname = "decc$_calloc64";            \
+              else                                                         \
+             if (strcmp ("malloc", vms_crtl_names [i].name) == 0)         \
+                vms_crtl_names [i].deccname = "decc$_malloc64";            \
+              else                                                         \
+             if (strcmp ("realloc", vms_crtl_names [i].name) == 0)        \
+                vms_crtl_names [i].deccname = "decc$_realloc64";           \
+              else                                                         \
+             if (strcmp ("strdup", vms_crtl_names [i].name) == 0)         \
+                vms_crtl_names [i].deccname = "decc$_strdup64";            \
+           }                                                              \
+            malloc64_init = 1;                                             \
+        }                                                                  \
+      for (i=0; vms_crtl_names [i].name; i++)                              \
+       if (!vms_crtl_names [i].referenced &&                              \
+           (strcmp (name, vms_crtl_names [i].name) == 0))                 \
+         {                                                                \
+           fprintf (file, "\t%s=%s\n",                        \
+                    name, vms_crtl_names [i].deccname);                   \
+           vms_crtl_names [i].referenced = 1;                             \
+         }                                                                \
+    } while (0)
+
 /* This is how to output an assembler line
    that says to advance the location counter
    to a multiple of 2**LOG bytes.  */
@@ -361,9 +414,6 @@ do {                                                                        \
 #define ENDFILE_SPEC \
 "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
 
-#undef LIB_SPEC
-#define LIB_SPEC "-lc"
-
 #define NAME__MAIN "__gccmain"
 #define SYMBOL__MAIN __gccmain
 
index 99b338a..07424d0 100644 (file)
@@ -1,5 +1,5 @@
 /* Output variables, constants and external declarations, for GNU compiler.
-   Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc.
    Contributed by Douglas Rupp (rupp@gnat.com).
 
 This file is part of GCC.
@@ -18,14 +18,36 @@ 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/>.  */
 
-/* Defaults to BITS_PER_WORD, e.g. 64 which is what is wanted.
-  This is incompatible with DEC C, but matches DEC Ada */
+#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
 
-#undef POINTERS_EXTEND_UNSIGNED
-#undef POINTER_SIZE
-#define POINTER_SIZE 64
+# include "config/vms/vms-crtl-64.h"
index 774e602..42601cd 100644 (file)
@@ -535,7 +535,7 @@ Objective-C and Objective-C++ Dialects}.
 -mmemory-latency=@var{time}}
 
 @emph{DEC Alpha/VMS Options}
-@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix}}
+@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
 
 @emph{FR30 Options}
 @gccoptlist{-msmall-model -mno-lsim}
@@ -10601,6 +10601,10 @@ style condition (e.g.@: error) codes.
 @opindex mdebug-main=@var{prefix}
 Flag the first routine whose name starts with @var{prefix} as the main
 routine for the debugger.
+
+@item -mmalloc64
+@opindex mmalloc64
+Default to 64bit memory allocation routines.
 @end table
 
 @node FR30 Options