public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, microblaze]: Add support for nested functions
@ 2013-02-11  6:37 David Holsgrove
  2013-02-16 17:43 ` Michael Eager
  0 siblings, 1 reply; 2+ messages in thread
From: David Holsgrove @ 2013-02-11  6:37 UTC (permalink / raw)
  To: gcc-patches
  Cc: Michael Eager (eager@eagercon.com),
	John Williams, Edgar E. Iglesias (edgar.iglesias@gmail.com),
	Vinod Kathail, Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui

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

Add MicroBlaze support for nested functions.

Changelog

2013-02-11  Edgar E. Iglesias  <edgar.iglesias@gmail.com>

 * config/microblaze/microblaze.c
   (microblaze_asm_trampoline_template): Replace
   with a microblaze version.
   (microblaze_trampoline_init): Adapt for microblaze.
 * config/microblaze/microblaze.h
   (TRAMPOLINE_SIZE): Adapt for microblaze.


[-- Attachment #2: 0002-gcc-microblaze-Add-MicroBlaze-support-for-nested-fun.patch --]
[-- Type: application/octet-stream, Size: 2872 bytes --]

From 42d824b68ebe7d58d9a253aff0f73ecd0d0e6834 Mon Sep 17 00:00:00 2001
From: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Date: Sun, 21 Aug 2011 22:13:17 +0200
Subject: [PATCH] gcc-microblaze: Add MicroBlaze support for nested functions.

Changelog

2013-02-11  Edgar E. Iglesias  <edgar.iglesias@gmail.com>

 * config/microblaze/microblaze.c
   (microblaze_asm_trampoline_template): Replace
   with a microblaze version.
   (microblaze_trampoline_init): Adapt for microblaze.
 * gcc/config/microblaze/microblaze.h
   (TRAMPOLINE_SIZE): Adapt for microblaze.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
 gcc/config/microblaze/microblaze.c |   18 +++++++-----------
 gcc/config/microblaze/microblaze.h |    3 ++-
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index 5f8ed2f..449626b 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -2788,14 +2788,10 @@ microblaze_elf_asm_init_sections (void)
 static void
 microblaze_asm_trampoline_template (FILE *f)
 {
-  fprintf (f, "\t.word\t0x03e00821\t\t# move   $1,$31\n");
-  fprintf (f, "\t.word\t0x04110001\t\t# bgezal $0,.+8\n");
-  fprintf (f, "\t.word\t0x00000000\t\t# nop\n");
-  fprintf (f, "\t.word\t0x8fe30014\t\t# lw     $3,20($31)\n");
-  fprintf (f, "\t.word\t0x8fe20018\t\t# lw     $2,24($31)\n");
-  fprintf (f, "\t.word\t0x0060c821\t\t# move   $25,$3 (abicalls)\n");
-  fprintf (f, "\t.word\t0x00600008\t\t# jr     $3\n");
-  fprintf (f, "\t.word\t0x0020f821\t\t# move   $31,$1\n");
+  fprintf (f, "\tmfs r18, rpc\n");
+  fprintf (f, "\tlwi r3, r18, 16\n");
+  fprintf (f, "\tlwi r18, r18, 20\n");
+  fprintf (f, "\tbra r18\n");
   /* fprintf (f, "\t.word\t0x00000000\t\t# <function address>\n");  */
   /* fprintf (f, "\t.word\t0x00000000\t\t# <static chain value>\n");  */
 }
@@ -2809,11 +2805,11 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   rtx mem;
 
   emit_block_move (m_tramp, assemble_trampoline_template (),
-		   GEN_INT (8*UNITS_PER_WORD), BLOCK_OP_NORMAL);
+		   GEN_INT (6*UNITS_PER_WORD), BLOCK_OP_NORMAL);
 
-  mem = adjust_address (m_tramp, SImode, 8);
+  mem = adjust_address (m_tramp, SImode, 16);
   emit_move_insn (mem, chain_value);
-  mem = adjust_address (m_tramp, SImode, 12);
+  mem = adjust_address (m_tramp, SImode, 20);
   emit_move_insn (mem, fnaddr);
 }
 \f
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index 674ae5a..b552665 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -502,7 +502,8 @@ typedef struct microblaze_args
 
 #define EXIT_IGNORE_STACK			1
 
-#define TRAMPOLINE_SIZE				(32 + 8)
+/* 4 insns + 2 words of data.  */
+#define TRAMPOLINE_SIZE				(6 * 4)
 
 #define TRAMPOLINE_ALIGNMENT			32
 
-- 
1.7.3.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, microblaze]: Add support for nested functions
  2013-02-11  6:37 [Patch, microblaze]: Add support for nested functions David Holsgrove
@ 2013-02-16 17:43 ` Michael Eager
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Eager @ 2013-02-16 17:43 UTC (permalink / raw)
  To: David Holsgrove
  Cc: gcc-patches, Michael Eager (eager@eagercon.com),
	John Williams, Edgar E. Iglesias (edgar.iglesias@gmail.com),
	Vinod Kathail, Vidhumouli Hunsigida, Nagaraju Mekala, Tom Shui

On 02/10/2013 10:37 PM, David Holsgrove wrote:
> Add MicroBlaze support for nested functions.
>
> Changelog
>
> 2013-02-11  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
>
>   * config/microblaze/microblaze.c
>     (microblaze_asm_trampoline_template): Replace
>     with a microblaze version.
>     (microblaze_trampoline_init): Adapt for microblaze.
>   * config/microblaze/microblaze.h
>     (TRAMPOLINE_SIZE): Adapt for microblaze.

Committed revision 196103.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-16 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11  6:37 [Patch, microblaze]: Add support for nested functions David Holsgrove
2013-02-16 17:43 ` Michael Eager

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