diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-16 18:23:00 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-16 18:23:00 +0000 |
commit | 805e22b2051e9c6a75377ea6599654d7415da483 (patch) | |
tree | c259697c448b0c6f548f153c48c46a8d7a75970f /gcc/config/vax/vax.c | |
parent | 2c27ce73ee2229b0871c4ccad2342d8a4be85eff (diff) | |
download | gcc-805e22b2051e9c6a75377ea6599654d7415da483.tar.gz |
Merge basic-improvements-branch to trunk
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/vax/vax.c')
-rw-r--r-- | gcc/config/vax/vax.c | 290 |
1 files changed, 2 insertions, 288 deletions
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 7db62115683..69b175fd818 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -21,6 +21,8 @@ Boston, MA 02111-1307, USA. */ #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tree.h" #include "regs.h" @@ -41,13 +43,6 @@ Boston, MA 02111-1307, USA. */ static int follows_p PARAMS ((rtx, rtx)); static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); -#if VMS_TARGET -static void vms_asm_out_constructor PARAMS ((rtx, int)); -static void vms_asm_out_destructor PARAMS ((rtx, int)); -static void vms_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); -static void vms_encode_section_info PARAMS ((tree, int)); -static void vms_globalize_label PARAMS ((FILE *, const char *)); -#endif static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); @@ -58,15 +53,6 @@ static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE vax_output_function_prologue -#if VMS_TARGET -#undef TARGET_ASM_SELECT_SECTION -#define TARGET_ASM_SELECT_SECTION vms_select_section -#undef TARGET_ENCODE_SECTION_INFO -#define TARGET_ENCODE_SECTION_INFO vms_encode_section_info -#undef TARGET_ASM_GLOBALIZE_LABEL -#define TARGET_ASM_GLOBALIZE_LABEL vms_globalize_label -#endif - #undef TARGET_ASM_OUTPUT_MI_THUNK #define TARGET_ASM_OUTPUT_MI_THUNK vax_output_mi_thunk #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK @@ -124,19 +110,6 @@ vax_output_function_prologue (file, size) dwarf2out_def_cfa (label, FRAME_POINTER_REGNUM, -(offset - 4)); } - if (VMS_TARGET) - { - /* Adjusting the stack pointer by 4 before calling C$MAIN_ARGS - is required when linking with the VMS POSIX version of the C - run-time library; using `subl2 $4,r0' is adequate but we use - `clrl -(sp)' instead. The extra 4 bytes could be removed - after the call because STARTING_FRAME_OFFSET's setting of -4 - will end up adding them right back again, but don't bother. */ - - if (MAIN_NAME_P (DECL_NAME (current_function_decl))) - asm_fprintf (file, "\tclrl -(%Rsp)\n\tjsb _C$MAIN_ARGS\n"); - } - size -= STARTING_FRAME_OFFSET; if (size >= 64) asm_fprintf (file, "\tmovab %d(%Rsp),%Rsp\n", -size); @@ -706,265 +679,6 @@ vax_rtx_cost (x) return c; } -#if VMS_TARGET -/* Additional support code for VMS target. */ - -/* Linked list of all externals that are to be emitted when optimizing - for the global pointer if they haven't been declared by the end of - the program with an appropriate .comm or initialization. */ - -static -struct extern_list { - struct extern_list *next; /* next external */ - const char *name; /* name of the external */ - int size; /* external's actual size */ - int in_const; /* section type flag */ -} *extern_head = 0, *pending_head = 0; - -/* Check whether NAME is already on the external definition list. If not, - add it to either that list or the pending definition list. */ - -void -vms_check_external (decl, name, pending) - tree decl; - const char *name; - int pending; -{ - register struct extern_list *p, *p0; - - for (p = extern_head; p; p = p->next) - if (!strcmp (p->name, name)) - return; - - for (p = pending_head, p0 = 0; p; p0 = p, p = p->next) - if (!strcmp (p->name, name)) - { - if (pending) - return; - - /* Was pending, but has now been defined; move it to other list. */ - if (p == pending_head) - pending_head = p->next; - else - p0->next = p->next; - p->next = extern_head; - extern_head = p; - return; - } - - /* Not previously seen; create a new list entry. */ - p = (struct extern_list *) xmalloc (sizeof (struct extern_list)); - p->name = name; - - if (pending) - { - /* Save the size and section type and link to `pending' list. */ - p->size = (DECL_SIZE (decl) == 0) ? 0 : - TREE_INT_CST_LOW (size_binop (CEIL_DIV_EXPR, DECL_SIZE (decl), - size_int (BITS_PER_UNIT))); - p->in_const = (TREE_READONLY (decl) && ! TREE_THIS_VOLATILE (decl)); - - p->next = pending_head; - pending_head = p; - } - else - { - /* Size and section type don't matter; link to `declared' list. */ - p->size = p->in_const = 0; /* arbitrary init */ - - p->next = extern_head; - extern_head = p; - } - return; -} - -void -vms_flush_pending_externals (file) - FILE *file; -{ - register struct extern_list *p; - - while (pending_head) - { - /* Move next pending declaration to the "done" list. */ - p = pending_head; - pending_head = p->next; - p->next = extern_head; - extern_head = p; - - /* Now output the actual declaration. */ - if (p->in_const) - const_section (); - else - data_section (); - fputs (".comm ", file); - assemble_name (file, p->name); - fprintf (file, ",%d\n", p->size); - } -} - -static void -vms_asm_out_constructor (symbol, priority) - rtx symbol; - int priority ATTRIBUTE_UNUSED; -{ - fprintf (asm_out_file,".globl $$PsectAttributes_NOOVR$$__gxx_init_1\n"); - data_section(); - fprintf (asm_out_file,"$$PsectAttributes_NOOVR$$__gxx_init_1:\n\t.long\t"); - assemble_name (asm_out_file, XSTR (symbol, 0)); - fputc ('\n', asm_out_file); -} - -static void -vms_asm_out_destructor (symbol, priority) - rtx symbol; - int priority ATTRIBUTE_UNUSED; -{ - fprintf (asm_out_file,".globl $$PsectAttributes_NOOVR$$__gxx_clean_1\n"); - data_section(); - fprintf (asm_out_file,"$$PsectAttributes_NOOVR$$__gxx_clean_1:\n\t.long\t"); - assemble_name (asm_out_file, XSTR (symbol, 0)); - fputc ('\n', asm_out_file); -} - -static void -vms_select_section (exp, reloc, align) - tree exp; - int reloc ATTRIBUTE_UNUSED; - unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; -{ - if (TREE_CODE (exp) == VAR_DECL) - { - if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp) - && DECL_INITIAL (exp) - && (DECL_INITIAL (exp) == error_mark_node - || TREE_CONSTANT (DECL_INITIAL (exp)))) - { - if (TREE_PUBLIC (exp)) - const_section (); - else - text_section (); - } - else - data_section (); - } - if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c') - { - if (TREE_CODE (exp) == STRING_CST && flag_writable_strings) - data_section (); - else - text_section (); - } -} - -/* Make sure that external variables are correctly addressed. Under VMS - there is some brain damage in the linker that requires us to do this. */ - -static void -vms_encode_section_info (decl, first) - tree decl; - int first ATTRIBUTE_UNUSED; -{ - if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) - SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; -} - -/* This is how to output a command to make the user-level label named NAME - defined for reference from other files. */ -static void -vms_globalize_label (stream, name) - FILE *stream; - const char *name; -{ - default_globalize_label (stream, name); - vms_check_external (NULL_TREE, name, 0); -} -#endif /* VMS_TARGET */ - -/* Additional support code for VMS host. */ -/* ??? This should really be in libiberty; vax.c is a target file. */ -#ifdef QSORT_WORKAROUND - /* - Do not use VAXCRTL's qsort() due to a severe bug: once you've - sorted something which has a size that's an exact multiple of 4 - and is longword aligned, you cannot safely sort anything which - is either not a multiple of 4 in size or not longword aligned. - A static "move-by-longword" optimization flag inside qsort() is - never reset. This is known to affect VMS V4.6 through VMS V5.5-1, - and was finally fixed in VMS V5.5-2. - - In this work-around an insertion sort is used for simplicity. - The qsort code from glibc should probably be used instead. - */ -void -not_qsort (array, count, size, compare) - void *array; - unsigned count, size; - int (*compare)(); -{ - - if (size == sizeof (short)) - { - register int i; - register short *next, *prev; - short tmp, *base = array; - - for (next = base, i = count - 1; i > 0; i--) - { - prev = next++; - if ((*compare)(next, prev) < 0) - { - tmp = *next; - do *(prev + 1) = *prev; - while (--prev >= base ? (*compare)(&tmp, prev) < 0 : 0); - *(prev + 1) = tmp; - } - } - } - else if (size == sizeof (long)) - { - register int i; - register long *next, *prev; - long tmp, *base = array; - - for (next = base, i = count - 1; i > 0; i--) - { - prev = next++; - if ((*compare)(next, prev) < 0) - { - tmp = *next; - do *(prev + 1) = *prev; - while (--prev >= base ? (*compare)(&tmp, prev) < 0 : 0); - *(prev + 1) = tmp; - } - } - } - else /* arbitrary size */ - { - register int i; - register char *next, *prev, *tmp = alloca (size), *base = array; - - for (next = base, i = count - 1; i > 0; i--) - { /* count-1 forward iterations */ - prev = next, next += size; /* increment front pointer */ - if ((*compare)(next, prev) < 0) - { /* found element out of order; move others up then re-insert */ - memcpy (tmp, next, size); /* save smaller element */ - do { memcpy (prev + size, prev, size); /* move larger elem. up */ - prev -= size; /* decrement back pointer */ - } while (prev >= base ? (*compare)(tmp, prev) < 0 : 0); - memcpy (prev + size, tmp, size); /* restore small element */ - } - } -#ifdef USE_C_ALLOCA - alloca (0); -#endif - } - - return; -} -#endif /* QSORT_WORKAROUND */ - /* Return 1 if insn A follows B. */ static int |