public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Holsgrove <david.holsgrove@xilinx.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "Michael Eager (eager@eagercon.com)" <eager@eagercon.com>,
	John Williams	<jwilliams@xilinx.com>,
	"Edgar E. Iglesias (edgar.iglesias@gmail.com)"
	<edgar.iglesias@gmail.com>, Vinod Kathail <vinodk@xilinx.com>,
	Vidhumouli Hunsigida <vidhum@xilinx.com>,
	Nagaraju Mekala <nmekala@xilinx.com>, Tom Shui	<tshui@xilinx.com>
Subject: [Patch, microblaze]: Add support for nested functions
Date: Mon, 11 Feb 2013 06:37:00 -0000	[thread overview]
Message-ID: <880d27b8-84f8-4d92-8c3e-786ff937d7f4@CO9EHSMHS017.ehs.local> (raw)

[-- 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


             reply	other threads:[~2013-02-11  6:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-11  6:37 David Holsgrove [this message]
2013-02-16 17:43 ` Michael Eager

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=880d27b8-84f8-4d92-8c3e-786ff937d7f4@CO9EHSMHS017.ehs.local \
    --to=david.holsgrove@xilinx.com \
    --cc=eager@eagercon.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwilliams@xilinx.com \
    --cc=nmekala@xilinx.com \
    --cc=tshui@xilinx.com \
    --cc=vidhum@xilinx.com \
    --cc=vinodk@xilinx.com \
    /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).