arc.h (TRAMPOLINE_ALIGNMENT): New.

* config/arc/arc.h (TRAMPOLINE_ALIGNMENT): New.
	(TRAMPOLINE_TEMPLATE): Merge with ...
	(INITIALIZE_TRAMPOLINE): ... this and move ...
	* config/arc/arc.c (arc_trampoline_init): ... here.
	(TARGET_TRAMPOLINE_INIT): New.

From-SVN: r151985
This commit is contained in:
Richard Henderson 2009-09-22 08:11:53 -07:00 committed by Richard Henderson
parent 2d7b663adf
commit 672f0baaec
3 changed files with 55 additions and 39 deletions

View File

@ -35,14 +35,20 @@
targetm.asm_out.trampoline_template. Make the memory block const
and set its size.
* config/alpha/alpha.c (alpha_trampoline_init): Rename from
alpha_initialize_trampoline. Make static. Merge VMS parameter
differences into the TARGET_ABI_OPEN_VMS code block.
* config/alpha/alpha.c (alpha_trampoline_init): Rename from
alpha_initialize_trampoline. Make static. Merge VMS parameter
differences into the TARGET_ABI_OPEN_VMS code block.
(TARGET_TRAMPOLINE_INIT): New.
* config/alpha/alpha.h (TRAMPOLINE_TEMPLATE): Remove.
(TRAMPOLINE_SECTION, INITIALIZE_TRAMPOLINE): Remove.
* config/alpha/vms.h (TRAMPOLINE_SIZE, TRAMPOLINE_ALIGNMENT): Remove.
(INITIALIZE_TRAMPOLINE): Remove.
* config/arc/arc.h (TRAMPOLINE_ALIGNMENT): New.
(TRAMPOLINE_TEMPLATE): Merge with ...
(INITIALIZE_TRAMPOLINE): ... this and move ...
* config/arc/arc.c (arc_trampoline_init): ... here.
(TARGET_TRAMPOLINE_INIT): New.
* config/alpha/alpha.h (TRAMPOLINE_TEMPLATE): Remove.
(TRAMPOLINE_SECTION, INITIALIZE_TRAMPOLINE): Remove.
* config/alpha/vms.h (TRAMPOLINE_SIZE, TRAMPOLINE_ALIGNMENT): Remove.
(INITIALIZE_TRAMPOLINE): Remove.
2009-09-22 Richard Guenther <rguenther@suse.de>

View File

@ -94,6 +94,8 @@ static void arc_external_libcall (rtx);
static bool arc_return_in_memory (const_tree, const_tree);
static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static void arc_trampoline_init (rtx, tree, rtx);
/* ARC specific attributs. */
@ -151,6 +153,9 @@ static const struct attribute_spec arc_attribute_table[] =
#undef TARGET_EXPAND_BUILTIN_VA_START
#define TARGET_EXPAND_BUILTIN_VA_START arc_va_start
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT arc_trampoline_init
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@ -2343,3 +2348,39 @@ arc_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
return size > 8;
}
/* Trampolines. */
/* ??? This doesn't work yet because GCC will use as the address of a nested
function the address of the trampoline. We need to use that address
right shifted by 2. It looks like we'll need PSImode after all. :-(
??? The above comment sounds like it's doable via
TARGET_TRAMPOLINE_ADJUST_ADDRESS; no PSImode needed.
On the ARC, the trampoline is quite simple as we have 32-bit immediate
constants.
mov r24,STATIC
j.nd FUNCTION
*/
static void
arc_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
{
rtx fnaddr = XEXP (DECL_RTX (fndecl), 0);
rtx mem;
mem = adjust_address (m_tramp, SImode, 0);
emit_move_insn (mem, GEN_INT (0x631f7c00));
mem = adjust_address (m_tramp, SImode, 4);
emit_move_insn (mem, chain_value);
mem = adjust_address (m_tramp, SImode, 8);
emit_move_insn (mem, GEN_INT (0x381f0000));
mem = adjust_address (m_tramp, SImode, 12);
emit_move_insn (mem, fnaddr);
emit_insn (gen_flush_icache (m_tramp));
}

View File

@ -657,39 +657,8 @@ arc_eligible_for_epilogue_delay (TRIAL, SLOTS_FILLED)
for profiling a function entry. */
#define FUNCTION_PROFILER(FILE, LABELNO)
/* Trampolines. */
/* ??? This doesn't work yet because GCC will use as the address of a nested
function the address of the trampoline. We need to use that address
right shifted by 2. It looks like we'll need PSImode after all. :-( */
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts. */
/* On the ARC, the trampoline is quite simple as we have 32-bit immediate
constants.
mov r24,STATIC
j.nd FUNCTION
*/
#define TRAMPOLINE_TEMPLATE(FILE) \
do { \
assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x631f7c00)); \
assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
assemble_aligned_integer (UNITS_PER_WORD, GEN_INT (0x381f0000)); \
assemble_aligned_integer (UNITS_PER_WORD, const0_rtx); \
} while (0)
/* Length in units of the trampoline for entering a nested function. */
#define TRAMPOLINE_ALIGNMENT 32
#define TRAMPOLINE_SIZE 16
/* Emit RTL insns to initialize the variable parts of a trampoline.
FNADDR is an RTX for the address of the function's pure code.
CXT is an RTX for the static chain value for the function. */
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
do { \
emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT); \
emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 12)), FNADDR); \
emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
} while (0)
/* Addressing modes, and classification of registers for them. */