summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-10 03:56:39 +0000
committerrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-10 03:56:39 +0000
commitd2f33c43f072d9a834d37c24b1952892afeb2b6a (patch)
treeb448869639596c5864567fc6f5cdb61760df170f
parent75871697d9ebb4b669d8ddb1d8b9dfe5614d303f (diff)
downloadgcc-d2f33c43f072d9a834d37c24b1952892afeb2b6a.tar.gz
* config/alpha/alpha.c (alpha_initialize_trampoline):
Initialize VMS trampoline IAW ABI for bounded procedure calls. (alpha_start_function): Emit transfer address on nested functions for VMS trampoline call. * config/alpha/t-vms (LIB2FUNCS_EXTRA): Remove vms_tramp.asm since no longer used. * config/alpha/vms-tramp.asm: Remove. * config/alpha/vms.h (TRAMPOLINE_TEMPLATE): Leave undefined since now only data initialized at runtime. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150609 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/alpha/alpha.c44
-rw-r--r--gcc/config/alpha/t-vms2
-rw-r--r--gcc/config/alpha/vms.h14
-rw-r--r--gcc/config/alpha/vms_tramp.asm46
5 files changed, 56 insertions, 62 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b4b03b3fec2..d49ba9c81f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,17 @@
2009-08-09 Douglas B Rupp <rupp@gnat.com>
+ * config/alpha/alpha.c (alpha_initialize_trampoline):
+ Initialize VMS trampoline IAW ABI for bounded procedure calls.
+ (alpha_start_function): Emit transfer address on nested functions
+ for VMS trampoline call.
+ * config/alpha/t-vms (LIB2FUNCS_EXTRA): Remove vms_tramp.asm
+ since no longer used.
+ * config/alpha/vms-tramp.asm: Remove.
+ * config/alpha/vms.h (TRAMPOLINE_TEMPLATE): Leave undefined
+ since now only data initialized at runtime.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
* config/alpha/vms.h (HANDLE_SYSV_PRAGMA): Define.
(LINK_GCC_C_SEQUENCE_SPEC): Define.
(MD_EXEC_PREFIX): Remove, no longer used.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index fe515d4d0f2..7658a02c87f 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5491,6 +5491,35 @@ alpha_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt,
cxt = convert_memory_address (mode, cxt);
#endif
+ if (TARGET_ABI_OPEN_VMS)
+ {
+ rtx temp1, traddr;
+ const char *fnname;
+ char *trname;
+
+ /* Construct the name of the trampoline entry point. */
+ fnname = XSTR (fnaddr, 0);
+ trname = (char *) alloca (strlen (fnname) + 5);
+ strcpy (trname, fnname);
+ strcat (trname, "..tr");
+ traddr = gen_rtx_SYMBOL_REF
+ (mode, ggc_alloc_string (trname, strlen (trname) + 1));
+
+ /* Trampoline (or "bounded") procedure descriptor is constructed from
+ the function's procedure descriptor with certain fields zeroed IAW
+ the VMS calling standard. This is stored in the first quadword. */
+ temp1 = force_reg (DImode, gen_rtx_MEM (DImode, fnaddr));
+ temp1 = expand_and (DImode, temp1,
+ GEN_INT (0xffff0fff0000fff0), NULL_RTX);
+ addr = memory_address (mode, plus_constant (tramp, 0));
+ emit_move_insn (gen_rtx_MEM (DImode, addr), temp1);
+
+ /* Trampoline transfer address is stored in the second quadword
+ of the trampoline. */
+ addr = memory_address (mode, plus_constant (tramp, 8));
+ emit_move_insn (gen_rtx_MEM (mode, addr), traddr);
+ }
+
/* Store function address and CXT. */
addr = memory_address (mode, plus_constant (tramp, fnofs));
emit_move_insn (gen_rtx_MEM (mode, addr), fnaddr);
@@ -7838,6 +7867,7 @@ alpha_start_function (FILE *file, const char *fnname,
/* Offset from base reg to register save area. */
HOST_WIDE_INT reg_offset;
char *entry_label = (char *) alloca (strlen (fnname) + 6);
+ char *tramp_label = (char *) alloca (strlen (fnname) + 6);
int i;
/* Don't emit an extern directive for functions defined in the same file. */
@@ -7926,6 +7956,20 @@ alpha_start_function (FILE *file, const char *fnname,
fputs ("..ng:\n", file);
}
}
+ /* Nested functions on VMS that are potentially called via trampoline
+ get a special transfer entry point that loads the called functions
+ procedure descriptor and static chain. */
+ if (TARGET_ABI_OPEN_VMS
+ && !TREE_PUBLIC (decl)
+ && DECL_CONTEXT (decl)
+ && !TYPE_P (DECL_CONTEXT (decl)))
+ {
+ strcpy (tramp_label, fnname);
+ strcat (tramp_label, "..tr");
+ ASM_OUTPUT_LABEL (file, tramp_label);
+ fprintf (file, "\tldq $1,24($27)\n");
+ fprintf (file, "\tldq $27,16($27)\n");
+ }
strcpy (entry_label, fnname);
if (TARGET_ABI_OPEN_VMS)
diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms
index 540728de194..a323a646ff6 100644
--- a/gcc/config/alpha/t-vms
+++ b/gcc/config/alpha/t-vms
@@ -17,8 +17,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/vms_tramp.asm
-
# VMS_EXTRA_PARTS is defined in x-vms and represent object files that
# are only needed for VMS targets, but can only be compiled on a VMS host
# (because they need DEC C).
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index 596e60eac2a..8238fbb2031 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -235,21 +235,7 @@ do { \
} while (0)
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine.
- Note that $27 has been set to the address of the trampoline, so we can
- use it for addressability of the two data items. */
-
#undef TRAMPOLINE_TEMPLATE
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\t.quad 0\n"); \
- fprintf (FILE, "\t.linkage __tramp\n"); \
- fprintf (FILE, "\t.quad 0\n"); \
-}
/* Length in units of the trampoline for entering a nested function. */
diff --git a/gcc/config/alpha/vms_tramp.asm b/gcc/config/alpha/vms_tramp.asm
deleted file mode 100644
index 84a4e9cfab9..00000000000
--- a/gcc/config/alpha/vms_tramp.asm
+++ /dev/null
@@ -1,46 +0,0 @@
-/* VMS trampoline for nested functions
- Copyright (C) 2001, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (rupp@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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-;# Alpha OpenVMS trampoline
-;#
- .set noreorder
- .set volatile
- .set noat
-.text
- .align 3
- .globl __tramp
- .ent __tramp
-__tramp..en:
-
-.link
- .align 3
-__tramp:
- .pdesc __tramp..en,null
-.text
- ldq $1,24($27)
- ldq $27,16($27)
- ldq $28,8($27)
- jmp $31,($28),0
- .end __tramp