From 18fd56217002bffa01650080d60271b4d0d3ef27 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 11 Aug 2009 05:00:51 +0000 Subject: [PATCH] alpha.c (common_object_handler): New function. * config/alpha/alpha.c (common_object_handler): New function. (vms_attribute_table): Declare a single attribute "common_object". (vms_output_aligned_decl_common): New global function. (SECTION_VMS_OVERLAY): Delete. (SECTION_VMS_GLOBAL): Likewise. (SECTION_VMS_INITIALIZE): Likewise. (vms_asm_named_section): Remove support for above flags. (vms_section_type_flags): Delete. (TARGET_SECTION_TYPE_FLAGS): Likewise. * config/alpha/alpha-protos.h (vms_output_aligned_decl_common): New. * config/alpha/vms.h (ASM_OUTPUT_ALIGNED_COMMON): Delete. (ASM_OUTPUT_ALIGNED_DECL_COMMON): New macro. Co-Authored-By: Douglas B Rupp From-SVN: r150645 --- gcc/ChangeLog | 16 +++++++++ gcc/config/alpha/alpha-protos.h | 4 +++ gcc/config/alpha/alpha.c | 75 +++++++++++++++++++++-------------------- gcc/config/alpha/vms.h | 11 ++---- 4 files changed, 61 insertions(+), 45 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9418b2..17d7f63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2009-08-10 Eric Botcazou + Douglas B Rupp + + * config/alpha/alpha.c (common_object_handler): New function. + (vms_attribute_table): Declare a single attribute "common_object". + (vms_output_aligned_decl_common): New global function. + (SECTION_VMS_OVERLAY): Delete. + (SECTION_VMS_GLOBAL): Likewise. + (SECTION_VMS_INITIALIZE): Likewise. + (vms_asm_named_section): Remove support for above flags. + (vms_section_type_flags): Delete. + (TARGET_SECTION_TYPE_FLAGS): Likewise. + * config/alpha/alpha-protos.h (vms_output_aligned_decl_common): New. + * config/alpha/vms.h (ASM_OUTPUT_ALIGNED_COMMON): Delete. + (ASM_OUTPUT_ALIGNED_DECL_COMMON): New macro. + 2009-08-10 SUGIOKA Toshinobu PR target/41015 diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index a4cbc09..39091b7 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -113,6 +113,10 @@ extern rtx alpha_use_linkage (rtx, tree, int, int); 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 *); +extern void vms_output_aligned_decl_common (FILE *, tree, const char *, + unsigned HOST_WIDE_INT, + unsigned int); + #endif extern rtx unicosmk_add_call_info_word (rtx); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 0bf5294..84c2b7c 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7461,16 +7461,50 @@ alpha_using_fp (void) } #if TARGET_ABI_OPEN_VMS +#define COMMON_OBJECT "common_object" + +static tree +common_object_handler (tree *node, tree name ATTRIBUTE_UNUSED, + tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs ATTRIBUTE_UNUSED) +{ + tree decl = *node; + gcc_assert (DECL_P (decl)); + + DECL_COMMON (decl) = 1; + return NULL_TREE; +} static const struct attribute_spec vms_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ - { "overlaid", 0, 0, true, false, false, NULL }, - { "global", 0, 0, true, false, false, NULL }, - { "initialize", 0, 0, true, false, false, NULL }, - { NULL, 0, 0, false, false, false, NULL } + { COMMON_OBJECT, 0, 1, true, false, false, common_object_handler }, + { NULL, 0, 0, false, false, false, NULL } }; +void +vms_output_aligned_decl_common(FILE *file, tree decl, const char *name, + unsigned HOST_WIDE_INT size, + unsigned int align) +{ + tree attr = DECL_ATTRIBUTES (decl); + fprintf (file, "%s", COMMON_ASM_OP); + assemble_name (file, name); + fprintf (file, "," HOST_WIDE_INT_PRINT_UNSIGNED, size); + /* ??? Unlike on OSF/1, the alignment factor is not in log units. */ + fprintf (file, ",%u", align / BITS_PER_UNIT); + if (attr) + { + attr = lookup_attribute (COMMON_OBJECT, attr); + if (attr) + fprintf (file, ",%s", + IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (attr)))); + } + fputc ('\n', file); +} + +#undef COMMON_OBJECT + #endif static int @@ -9971,31 +10005,6 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl) } } -/* Given a decl, a section name, and whether the decl initializer - has relocs, choose attributes for the section. */ - -#define SECTION_VMS_OVERLAY SECTION_FORGET -#define SECTION_VMS_GLOBAL SECTION_MACH_DEP -#define SECTION_VMS_INITIALIZE (SECTION_VMS_GLOBAL << 1) - -static unsigned int -vms_section_type_flags (tree decl, const char *name, int reloc) -{ - unsigned int flags = default_section_type_flags (decl, name, reloc); - - if (decl && DECL_ATTRIBUTES (decl) - && lookup_attribute ("overlaid", DECL_ATTRIBUTES (decl))) - flags |= SECTION_VMS_OVERLAY; - if (decl && DECL_ATTRIBUTES (decl) - && lookup_attribute ("global", DECL_ATTRIBUTES (decl))) - flags |= SECTION_VMS_GLOBAL; - if (decl && DECL_ATTRIBUTES (decl) - && lookup_attribute ("initialize", DECL_ATTRIBUTES (decl))) - flags |= SECTION_VMS_INITIALIZE; - - return flags; -} - /* Switch to an arbitrary section NAME with attributes as specified by FLAGS. ALIGN specifies any known alignment requirements for the section; 0 if the default should be used. */ @@ -10007,12 +10016,6 @@ vms_asm_named_section (const char *name, unsigned int flags, fputc ('\n', asm_out_file); fprintf (asm_out_file, ".section\t%s", name); - if (flags & SECTION_VMS_OVERLAY) - fprintf (asm_out_file, ",OVR"); - if (flags & SECTION_VMS_GLOBAL) - fprintf (asm_out_file, ",GBL"); - if (flags & SECTION_VMS_INITIALIZE) - fprintf (asm_out_file, ",NOMOD"); if (flags & SECTION_DEBUG) fprintf (asm_out_file, ",NOWRT"); @@ -10876,8 +10879,6 @@ alpha_init_libfuncs (void) #if TARGET_ABI_OPEN_VMS # undef TARGET_ATTRIBUTE_TABLE # define TARGET_ATTRIBUTE_TABLE vms_attribute_table -# undef TARGET_SECTION_TYPE_FLAGS -# define TARGET_SECTION_TYPE_FLAGS vms_section_type_flags #endif #undef TARGET_IN_SMALL_DATA_P diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index fd7e03b..fa7e3c2 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -242,14 +242,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) #undef TRAMPOLINE_TEMPLATE -- 2.7.4