This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] h8300.c: Clean up code aroundh8300_tiny_constant_address_p.


Hi,

Attached is a patch to clean up code around
h8300_tiny_constant_address_p.

Whenever h8300_tiny_constant_address_p is used, the following is
always ORed with the result of h8300_tiny_constant_address_p.

GET_CODE (addr) == SYMBOL_REF && TINY_DATA_NAME_P (XSTR (addr, 0))

The patch integrates this into h8300_tiny_constant_address_p.

Tested on h8300 port.  Committed.

Kazu Hirata

2002-11-23  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/h8300.c (print_operand): Update the use of
	h8300_tiny_constant_address_p.
	(h8300_adjust_insn_length): Likewise.
	(h8300_tiny_constant_address_p): Check if the given rtx is a
	variable declared with __attribute__ ((tiny_data)).

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.160
diff -u -r1.160 h8300.c
--- h8300.c	21 Nov 2002 14:09:31 -0000	1.160
+++ h8300.c	21 Nov 2002 14:20:54 -0000
@@ -1440,9 +1440,6 @@
 	case MEM:
 	  {
 	    rtx addr = XEXP (x, 0);
-	    int tiny_ok = ((GET_CODE (addr) == SYMBOL_REF
-			    && TINY_DATA_NAME_P (XSTR (addr, 0)))
-			   || h8300_tiny_constant_address_p (addr));
 
 	    fprintf (file, "@");
 	    output_address (addr);
@@ -1467,7 +1464,7 @@
 	      case 'T':
 	      case 'S':
 		/* Used for mov.w and mov.l.  */
-		if (tiny_ok)
+		if (h8300_tiny_constant_address_p (addr))
 		  fprintf (file, ":16");
 		break;
 	      default:
@@ -3755,9 +3752,7 @@
 	    return -6;
 
 	  /* @aa:16 is 4 bytes shorter than the longest.  */
-	  if ((GET_CODE (addr) == SYMBOL_REF
-	       && TINY_DATA_NAME_P (XSTR (addr, 0)))
-	      || h8300_tiny_constant_address_p (addr))
+	  if (h8300_tiny_constant_address_p (addr))
 	    return -4;
 
 	  /* @aa:24 is 2 bytes shorter than the longest.  */
@@ -3916,6 +3911,10 @@
   const unsigned HOST_WIDE_INT s4 = trunc_int_for_mode (0xffffffff, SImode);
 
   unsigned HOST_WIDE_INT addr;
+
+  /* We accept symbols declared with tiny_data.  */
+  if (GET_CODE (x) == SYMBOL_REF && TINY_DATA_NAME_P (XSTR (x, 0)))
+    return 1;
 
   if (GET_CODE (x) != CONST_INT)
     return 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]