diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-22 08:16:34 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-22 08:16:34 -0700 |
commit | 3814318d559e5f13822e897a4316d72f92d6c0e5 (patch) | |
tree | b76c2efac90dd9a7c3a82f77fa6363d65d98e3b6 | |
parent | e0c6c273290d10461829e1aa888ca89fadfe0209 (diff) | |
download | gcc-3814318d559e5f13822e897a4316d72f92d6c0e5.zip gcc-3814318d559e5f13822e897a4316d72f92d6c0e5.tar.gz gcc-3814318d559e5f13822e897a4316d72f92d6c0e5.tar.bz2 |
vax.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
* config/vax/vax.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
(TARGET_TRAMPOLINE_INIT): New.
(vax_asm_trampoline_template, vax_trampoline_init): New.
* config/vax/vax.h (TRAMPOLINE_TEMPLATE): Move code to
vax_asm_trampoline_template.
(INITIALIZE_TRAMPOLINE): Move code to vax_trampoline_init.
From-SVN: r152016
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/vax/vax.c | 49 | ||||
-rw-r--r-- | gcc/config/vax/vax.h | 34 |
3 files changed, 56 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce3b1c0..7a6e7a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -285,6 +285,13 @@ (INITIALIZE_TRAMPOLINE): Move code to v850_trampoline_init and adjust for target hook parameters. + * config/vax/vax.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New. + (TARGET_TRAMPOLINE_INIT): New. + (vax_asm_trampoline_template, vax_trampoline_init): New. + * config/vax/vax.h (TRAMPOLINE_TEMPLATE): Move code to + vax_asm_trampoline_template. + (INITIALIZE_TRAMPOLINE): Move code to vax_trampoline_init. + 2009-09-22 Jakub Jelinek <jakub@redhat.com> * config/rs6000/rs6000.c (bdesc_2arg): Fix CODE_FOR_vector_gt* codes diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 4dfaa2e..d75d11f 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -57,6 +57,8 @@ static int vax_address_cost (rtx, bool); static bool vax_rtx_costs (rtx, int, int, int *, bool); static rtx vax_struct_value_rtx (tree, int); static rtx vax_builtin_setjmp_frame_value (void); +static void vax_asm_trampoline_template (FILE *); +static void vax_trampoline_init (rtx, tree, rtx); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -101,6 +103,11 @@ static rtx vax_builtin_setjmp_frame_value (void); #undef TARGET_FRAME_POINTER_REQUIRED #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true +#undef TARGET_ASM_TRAMPOLINE_TEMPLATE +#define TARGET_ASM_TRAMPOLINE_TEMPLATE vax_asm_trampoline_template +#undef TARGET_TRAMPOLINE_INIT +#define TARGET_TRAMPOLINE_INIT vax_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; /* Set global variables as needed for the options enabled. */ @@ -2020,3 +2027,45 @@ adjacent_operands_p (rtx lo, rtx hi, enum machine_mode mode) return rtx_equal_p (lo, hi) && hi_offset - lo_offset == GET_MODE_SIZE (mode); } + +/* Output assembler code for a block containing the constant parts + of a trampoline, leaving space for the variable parts. */ + +/* On the VAX, the trampoline contains an entry mask and two instructions: + .word NN + movl $STATIC,r0 (store the functions static chain) + jmp *$FUNCTION (jump to function code at address FUNCTION) */ + +static void +vax_asm_trampoline_template (FILE *f ATTRIBUTE_UNUSED) +{ + assemble_aligned_integer (2, const0_rtx); + assemble_aligned_integer (2, GEN_INT (0x8fd0)); + assemble_aligned_integer (4, const0_rtx); + assemble_aligned_integer (1, GEN_INT (0x50 + STATIC_CHAIN_REGNUM)); + assemble_aligned_integer (2, GEN_INT (0x9f17)); + assemble_aligned_integer (4, const0_rtx); +} + +/* We copy the register-mask from the function's pure code + to the start of the trampoline. */ + +static void +vax_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) +{ + rtx fnaddr = XEXP (DECL_RTL (fndecl), 0); + rtx mem; + + emit_block_move (m_tramp, assemble_trampoline_template (), + GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL); + + mem = adjust_address (m_tramp, HImode, 0); + emit_move_insn (mem, gen_const_mem (HImode, fnaddr)); + + mem = adjust_address (m_tramp, SImode, 4); + emit_move_insn (mem, cxt); + mem = adjust_address (m_tramp, SImode, 11); + emit_move_insn (mem, plus_constant (fnaddr, 2)); + emit_insn (gen_sync_istream ()); +} + diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 0ac7ba5..e85ce01 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -428,44 +428,10 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0; -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. */ - -/* On the VAX, the trampoline contains an entry mask and two instructions: - .word NN - movl $STATIC,r0 (store the functions static chain) - jmp *$FUNCTION (jump to function code at address FUNCTION) */ - -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - assemble_aligned_integer (2, const0_rtx); \ - assemble_aligned_integer (2, GEN_INT (0x8fd0)); \ - assemble_aligned_integer (4, const0_rtx); \ - assemble_aligned_integer (1, GEN_INT (0x50 + STATIC_CHAIN_REGNUM)); \ - assemble_aligned_integer (2, GEN_INT (0x9f17)); \ - assemble_aligned_integer (4, const0_rtx); \ -} - /* Length in units of the trampoline for entering a nested function. */ #define TRAMPOLINE_SIZE 15 -/* 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. */ - -/* We copy the register-mask from the function's pure code - to the start of the trampoline. */ -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ -{ \ - emit_move_insn (gen_rtx_MEM (HImode, TRAMP), \ - gen_rtx_MEM (HImode, FNADDR)); \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 4)), CXT); \ - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 11)), \ - plus_constant (FNADDR, 2)); \ - emit_insn (gen_sync_istream ()); \ -} - /* Byte offset of return address in a stack frame. The "saved PC" field is in element [4] when treating the frame as an array of longwords. */ |