public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, microblaze]: Add microblaze_legitimate_pic_operand method
@ 2013-02-11  6:40 David Holsgrove
  2013-03-04 15:33 ` Michael Eager
  0 siblings, 1 reply; 2+ messages in thread
From: David Holsgrove @ 2013-02-11  6:40 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: 435 bytes --]

Add microblaze_legitimate_pic_operand method

Prevents ICE where insn contains an invalid address

Changelog

2013-02-11  David Holsgrove <david.holsgrove@xilinx.com>

 * config/microblaze/microblaze.c
   (microblaze_valid_pic_const): New function
   (microblaze_legitimate_pic_operand): Likewise
 * config/microblaze/microblaze.h 
   (LEGITIMATE_PIC_OPERAND_P): calls new
   function microblaze_legitimate_pic_operand


[-- Attachment #2: 0012-Add-microblaze_legitimate_pic_operand-method.patch --]
[-- Type: application/octet-stream, Size: 2332 bytes --]

From 064c5079fa9a118b58db8b8c3652e67843c2c562 Mon Sep 17 00:00:00 2001
From: David Holsgrove <david.holsgrove@xilinx.com>
Date: Fri, 9 Dec 2011 14:40:10 +1000
Subject: [PATCH] Add microblaze_legitimate_pic_operand method

Prevents ICE where insn contains an invalid address

Changelog

2013-02-11  David Holsgrove <david.holsgrove@xilinx.com>

 * gcc/config/microblaze/microblaze.c
   (microblaze_valid_pic_const): New function
   (microblaze_legitimate_pic_operand): Likewise
 * gcc/config/microblaze/microblaze.h: LEGITIMATE_PIC_OPERAND_P
   calls new function microblaze_legitimate_pic_operand

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
---
 gcc/config/microblaze/microblaze.c |   26 ++++++++++++++++++++++++++
 gcc/config/microblaze/microblaze.h |    2 +-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index 1567203..af047f4 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -602,6 +602,32 @@ microblaze_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
   return microblaze_classify_address (&addr, x, mode, strict);
 }
 
+int
+microblaze_valid_pic_const (rtx x)
+{
+  switch (GET_CODE (x))
+    {
+    case CONST:
+    case CONST_INT:
+    case CONST_DOUBLE:
+      return true;
+    default:
+      return false;
+    }
+}
+
+int
+microblaze_legitimate_pic_operand (rtx x)
+{
+  struct microblaze_address_info addr;
+
+  if (pic_address_needs_scratch (x))
+    return 0;
+  if (!microblaze_valid_pic_const(x))
+    return 0;
+
+  return 1;
+}
 
 /* Try machine-dependent ways of modifying an illegitimate address
    to be legitimate.  If we find one, return the new, valid address.
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index 814e8ab..a9df0c6 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -545,7 +545,7 @@ typedef struct microblaze_args
 
 /* Define this, so that when PIC, reload won't try to reload invalid
    addresses which require two reload registers.  */
-#define LEGITIMATE_PIC_OPERAND_P(X)  (!pic_address_needs_scratch (X))
+#define LEGITIMATE_PIC_OPERAND_P(X)  microblaze_legitimate_pic_operand (X)
 
 #define CASE_VECTOR_MODE			(SImode)
 
-- 
1.7.3.2


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

* Re: [Patch, microblaze]: Add microblaze_legitimate_pic_operand method
  2013-02-11  6:40 [Patch, microblaze]: Add microblaze_legitimate_pic_operand method David Holsgrove
@ 2013-03-04 15:33 ` Michael Eager
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Eager @ 2013-03-04 15:33 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:40 PM, David Holsgrove wrote:
> Add microblaze_legitimate_pic_operand method
>
> Prevents ICE where insn contains an invalid address
>
> Changelog
>
> 2013-02-11  David Holsgrove <david.holsgrove@xilinx.com>
>
>   * config/microblaze/microblaze.c
>     (microblaze_valid_pic_const): New function
>     (microblaze_legitimate_pic_operand): Likewise
>   * config/microblaze/microblaze.h
>     (LEGITIMATE_PIC_OPERAND_P): calls new
>     function microblaze_legitimate_pic_operand

Committed revision 196434.

Added
	* config/microblaze/microblaze-protos.h
	(microblaze_legitimate_pic_operand): Declare.


Index: gcc/config/microblaze/microblaze-protos.h
===================================================================
--- gcc/config/microblaze/microblaze-protos.h	(revision 196431)
+++ gcc/config/microblaze/microblaze-protos.h	(working copy)
@@ -49,6 +49,7 @@
  extern void microblaze_declare_object (FILE *, const char *, const char *,
     const char *, int);
  extern void microblaze_asm_output_ident (const char *);
+extern int microblaze_legitimate_pic_operand (rtx);
  #endif  /* RTX_CODE */

  /* Declare functions in microblaze-c.c.  */

-- 
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-03-04 15:33 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:40 [Patch, microblaze]: Add microblaze_legitimate_pic_operand method David Holsgrove
2013-03-04 15:33 ` 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).