]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vax.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
authorRichard Henderson <rth@redhat.com>
Tue, 22 Sep 2009 15:16:34 +0000 (08:16 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 22 Sep 2009 15:16:34 +0000 (08:16 -0700)
        * 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

gcc/ChangeLog
gcc/config/vax/vax.c
gcc/config/vax/vax.h

index ce3b1c0f121dc0d8e9fe9c556143896e54be69aa..7a6e7a8b2bcc0963320aeb16ffc5ed895b220ef7 100644 (file)
        (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
index 4dfaa2e9dd106a52a6c2dac9cf5d869cd0450dc0..d75d11f9a519971af69bbba9178262583214bad9 100644 (file)
@@ -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);
 \f
 /* 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;
 \f
 /* 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 ());
+}
+
index 0ac7ba58b57163d7f534c0423574a58b54b43d0a..e85ce01f82077e224068c78a0b3944862b53f8ff 100644 (file)
@@ -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.  */