OSDN Git Service

* config/alpha/alpha.c (vms_valid_pointer_mode): New function.
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / vms.h
index ff5e5d2..e3781b5 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, \
@@ -140,27 +144,12 @@ along with GCC; see the file COPYING3.  If not see
 
 #undef CAN_ELIMINATE
 #define CAN_ELIMINATE(FROM, TO)  \
-((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
+  (alpha_vms_can_eliminate ((FROM), (TO)))
 
 #undef INITIAL_ELIMINATION_OFFSET
 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                   \
-{ switch (FROM)                                                                \
-    {                                                                  \
-    case FRAME_POINTER_REGNUM:                                         \
-      (OFFSET) = alpha_sa_size () + alpha_pv_save_size ();             \
-      break;                                                           \
-    case ARG_POINTER_REGNUM:                                           \
-      (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size ()        \
-                              + get_frame_size ()                      \
-                              + crtl->args.pretend_args_size)  \
-                 - crtl->args.pretend_args_size);              \
-      break;                                                           \
-    default:                                                           \
-      gcc_unreachable ();                                              \
-    }                                                                  \
-  if ((TO) == STACK_POINTER_REGNUM)                                    \
-    (OFFSET) += ALPHA_ROUND (crtl->outgoing_args_size);        \
-}
+  ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
+
 \f
 /* Define a data type for recording info about an argument list
    during the scan of that argument list.  This data type should
@@ -202,9 +191,7 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
      (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED);             \
     }
 
-/* ABI has stack checking, but it's broken.  */
-#undef STACK_CHECK_BUILTIN
-#define STACK_CHECK_BUILTIN 0
+#define DEFAULT_PCC_STRUCT_RETURN 0
 
 #undef  ASM_WEAKEN_LABEL
 #define ASM_WEAKEN_LABEL(FILE, NAME)                            \
@@ -238,14 +225,9 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
 
 #define COMMON_ASM_OP "\t.comm\t"
 
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)             \
-do {                                                                   \
-  fprintf ((FILE), "%s", COMMON_ASM_OP);                               \
-  assemble_name ((FILE), (NAME));                                      \
-  fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
+#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
+  vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
 \f
 #undef TRAMPOLINE_TEMPLATE
 
@@ -287,7 +269,62 @@ do {                                                                       \
 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
 
+#ifdef IN_LIBGCC2
+/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
+   file. This avoids having to recompile the world instead of libgcc only
+   when changes to this macro are exercised.  */
+
 #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
@@ -322,22 +359,18 @@ do {                                                                      \
 #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;   \
-}
+   for a traceback unless specifically overridden.  */
 
-/* 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 ();                            \
+#define OVERRIDE_OPTIONS                            \
+{                                                   \
+  if (write_symbols == NO_DEBUG                     \
+      && debug_info_level == DINFO_LEVEL_NONE)      \
+    {                                               \
+      write_symbols = VMS_DEBUG;                    \
+      debug_info_level = DINFO_LEVEL_TERSE;         \
+    }                                               \
+   override_options ();                             \
 }
 
 /* Link with vms-dwarf2.o if -g (except -g0). This causes the
@@ -355,12 +388,12 @@ 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
 
 #define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
 
 #define LONGLONG_STANDALONE 1
+
+#undef TARGET_VALID_POINTER_MODE
+#define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode