public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: bob.wilson@acm.org
Subject: [patch 35/36][xtensa] Hookize static chain and trampoline macros
Date: Mon, 21 Sep 2009 23:35:00 -0000	[thread overview]
Message-ID: <4AB80CDD.6000902@redhat.com> (raw)
In-Reply-To: <4AB7F353.3060707@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]

A straight-forward conversion to hooks.


r~

[-- Attachment #2: d-tramp-35-xtensa --]
[-- Type: text/plain, Size: 4785 bytes --]

	* config/xtensa/xtensa.c (TARGET_ASM_TRAMPOLINE_TEMPLATE): New.
	(TARGET_TRAMPOLINE_INIT): New.
	(xtensa_asm_trampoline_template): Rename from
	xtensa_trampoline_template; make static.
	(xtensa_trampoline_init): Rename from xtensa_initialize_trampoline;
	make static; update for hook parameters.
	* config/xtensa/xtensa-protos.h: Remove trampoline decls.
	* config/xtensa/xtensa.h (TRAMPOLINE_TEMPLATE): Remove.
	(INITIALIZE_TRAMPOLINE): Remove.


diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 73176f6..6bd1e56 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -70,7 +70,6 @@ struct secondary_reload_info;
 extern enum reg_class xtensa_secondary_reload (bool, rtx, enum reg_class,
 					       enum machine_mode,
 					       struct secondary_reload_info *);
-extern void xtensa_initialize_trampoline (rtx, rtx, rtx);
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE
@@ -86,6 +85,5 @@ extern void override_options (void);
 extern long compute_frame_size (int);
 extern void xtensa_expand_prologue (void);
 extern void order_regs_for_local_alloc (void);
-extern void xtensa_trampoline_template (FILE *);
 
 #endif /* !__XTENSA_PROTOS_H__ */
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 77ba2d9..0264868 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -146,6 +146,8 @@ static tree xtensa_fold_builtin (tree, tree, bool);
 static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 static void xtensa_va_start (tree, rtx);
 static bool xtensa_frame_pointer_required (void);
+static void xtensa_asm_trampoline_template (FILE *);
+static void xtensa_trampoline_init (rtx, tree, rtx);
 
 static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
   REG_ALLOC_ORDER;
@@ -229,6 +231,11 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
 #undef TARGET_FRAME_POINTER_REQUIRED
 #define TARGET_FRAME_POINTER_REQUIRED xtensa_frame_pointer_required
 
+#undef TARGET_ASM_TRAMPOLINE_TEMPLATE
+#define TARGET_ASM_TRAMPOLINE_TEMPLATE xtensa_asm_trampoline_template
+#undef TARGET_TRAMPOLINE_INIT
+#define TARGET_TRAMPOLINE_INIT xtensa_trampoline_init
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
@@ -3435,8 +3442,8 @@ xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
    control to the instruction following the ENTRY at the target.  Note:
    this assumes that the target begins with an ENTRY instruction.  */
 
-void
-xtensa_trampoline_template (FILE *stream)
+static void
+xtensa_asm_trampoline_template (FILE *stream)
 {
   bool use_call0 = (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS);
 
@@ -3503,17 +3510,21 @@ xtensa_trampoline_template (FILE *stream)
   fprintf (stream, "\t.end no-transform\n");
 }
 
-
-void
-xtensa_initialize_trampoline (rtx addr, rtx func, rtx chain)
+static void
+xtensa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain)
 {
+  rtx func = XEXP (DECL_RTL (fndecl), 0);
   bool use_call0 = (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS);
   int chain_off = use_call0 ? 12 : 8;
   int func_off = use_call0 ? 16 : 12;
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, chain_off)), chain);
-  emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, func_off)), func);
+
+  emit_block_move (m_tramp, assemble_trampoline_template (),
+		   GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
+
+  emit_move_insn (adjust_address (m_tramp, SImode, chain_off), chain);
+  emit_move_insn (adjust_address (m_tramp, SImode, func_off), func);
   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_sync_caches"),
-		     0, VOIDmode, 1, addr, Pmode);
+		     0, VOIDmode, 1, XEXP (m_tramp, 0), Pmode);
 }
 
 
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 84d320b..4fefbfd 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -677,8 +677,6 @@ typedef struct xtensa_args
 /* Stack pointer value doesn't matter at exit.  */
 #define EXIT_IGNORE_STACK 1
 
-#define TRAMPOLINE_TEMPLATE(STREAM) xtensa_trampoline_template (STREAM)
-
 /* Size in bytes of the trampoline, as an integer.  Make sure this is
    a multiple of TRAMPOLINE_ALIGNMENT to avoid -Wpadded warnings.  */
 #define TRAMPOLINE_SIZE (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS ? 60 : 52)
@@ -686,11 +684,6 @@ typedef struct xtensa_args
 /* Alignment required for trampolines, in bits.  */
 #define TRAMPOLINE_ALIGNMENT 32
 
-/* A C statement to initialize the variable parts of a trampoline.  */
-#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN)			\
-  xtensa_initialize_trampoline (ADDR, FUNC, CHAIN)
-
-
 /* If defined, a C expression that produces the machine-specific code
    to setup the stack so that arbitrary frames can be accessed.
 

  parent reply	other threads:[~2009-09-21 23:31 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 21:57 [patch 01/36] " Richard Henderson
2009-09-21 22:14 ` [patch 02/36][alpha] " Richard Henderson
2009-09-21 22:17 ` [patch 03/36][arc] " Richard Henderson
2009-09-21 22:19 ` [patch 04/36][ARM] " Richard Henderson
2009-09-21 22:26 ` [patch 05/36][AVR] " Richard Henderson
2009-09-21 22:28 ` [patch 06/36][bfin] " Richard Henderson
2009-09-21 22:29 ` [patch 07/36][cris] " Richard Henderson
2009-09-22  2:31   ` Hans-Peter Nilsson
2009-09-21 22:30 ` [patch 08/36][crx] " Richard Henderson
2009-09-21 22:32 ` [patch 09/36][fr30] " Richard Henderson
2009-09-21 22:34 ` [patch 10/36][frv] " Richard Henderson
2009-09-21 22:35 ` [patch 11/36][h8] " Richard Henderson
2009-09-21 22:36 ` [patch 12/36][ia64] " Richard Henderson
2009-09-21 22:40 ` [patch 13/36][iq2000] " Richard Henderson
2009-09-21 22:41 ` [patch 14/36][m32c] " Richard Henderson
2009-09-21 22:49   ` DJ Delorie
2009-09-21 22:57     ` Richard Henderson
2009-09-21 23:00       ` DJ Delorie
2009-09-21 23:13         ` Richard Henderson
2009-09-21 23:18           ` DJ Delorie
2009-09-21 22:42 ` [patch 15/36][m68hc11] " Richard Henderson
2009-09-21 22:47 ` [patch 16/36][m68k] " Richard Henderson
2009-09-22 15:53   ` Richard Henderson
2009-09-21 22:50 ` [patch 17/36][mcore] " Richard Henderson
2009-09-21 22:52 ` [patch 18/36][mep] " Richard Henderson
2009-09-21 22:59 ` [patch 19/36][mips] " Richard Henderson
2009-09-22 18:19   ` Richard Sandiford
2009-09-21 23:01 ` [patch 20/36][mmix] " Richard Henderson
2009-09-22  2:03   ` Hans-Peter Nilsson
2009-09-21 23:04 ` [patch 21/36][mn10300] " Richard Henderson
2009-09-21 23:11   ` Richard Henderson
2009-09-22 20:53     ` Alexandre Oliva
2009-09-21 23:06 ` [patch 22/36][moxie] " Richard Henderson
2009-09-21 23:08 ` [patch 23/36][parisc] " Richard Henderson
2009-09-22  2:03   ` John David Anglin
2009-09-21 23:09 ` [patch 24/36][pdp11] " Richard Henderson
2009-09-22 18:31   ` Paul Koning
2009-09-21 23:10 ` [patch 25/36][picochip] " Richard Henderson
2009-09-21 23:14 ` [patch 26/36][rs6000] " Richard Henderson
2009-09-22  2:16   ` David Edelsohn
2009-09-21 23:16 ` [patch 27/36][s390] " Richard Henderson
2009-09-22 14:55   ` Andreas Krebbel
2009-09-21 23:21 ` [patch 28/36][score] " Richard Henderson
2009-09-22 11:02   ` 答复: " liqin
2009-09-22 13:58     ` Richard Henderson
2009-09-22 11:25   ` Paolo Bonzini
2009-09-21 23:22 ` [patch 29/36][sh] " Richard Henderson
2009-09-22 20:47   ` Alexandre Oliva
2009-09-21 23:22 ` [patch 30/36][sparc] " Richard Henderson
2009-09-22 13:09   ` Eric Botcazou
2009-09-21 23:26 ` [patch 31/36][spu] " Richard Henderson
2009-09-21 23:44   ` Andrew Pinski
2009-09-21 23:27 ` [patch 32/36][stormy16] " Richard Henderson
2009-09-21 23:30 ` [patch 33/36][v850] " Richard Henderson
2009-09-21 23:31 ` [patch 34/36][vax] " Richard Henderson
2009-09-21 23:35 ` Richard Henderson [this message]
2009-09-21 23:41 ` [patch 36/36][i386] " Richard Henderson
2009-09-23  0:37   ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB80CDD.6000902@redhat.com \
    --to=rth@redhat.com \
    --cc=bob.wilson@acm.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).