Commit fe2786f5 by Douglas B Rupp Committed by Douglas Rupp

alpha.c (alpha_initialize_trampoline): Initialize VMS trampoline IAW ABI for…

alpha.c (alpha_initialize_trampoline): Initialize VMS trampoline IAW ABI for bounded procedure calls.


	* 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.

From-SVN: r150609
parent c889a16f
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.
......
......@@ -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)
......
......@@ -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).
......
......@@ -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. */
......
/* 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment