diff mbox

[rl78] fix __far reg+addend addresses

Message ID 201210262311.q9QNBmZU013298@greed.delorie.com
State New
Headers show

Commit Message

DJ Delorie Oct. 26, 2012, 11:11 p.m. UTC
Commited.

	* config/rl78/rl78.c (rl78_as_legitimate_address): Do not allow
	reg+addend addresses for the _far namespace.
diff mbox

Patch

Index: gcc/config/rl78/rl78.c
===================================================================
--- gcc/config/rl78/rl78.c	(revision 192862)
+++ gcc/config/rl78/rl78.c	(working copy)
@@ -683,12 +683,19 @@  rl78_as_legitimate_address (enum machine
       && GET_MODE (x) == SImode)
     return false;
 
   if (! characterize_address (x, &base, &index, &addend))
     return false;
 
+  /* We can't extract the high/low portions of a PLUS address
+     involving a register during devirtualization, so make sure all
+     such __far addresses do not have addends.  This forces GCC to do
+     the sum separately.  */
+  if (addend && base && as == ADDR_SPACE_FAR)
+    return false;
+
   if (base && index)
     {
       int ir = REGNO (index);
       int br = REGNO (base);
 
 #define OK(test, debug) if (test) { /*fprintf(stderr, "%d: OK %s\n", __LINE__, debug);*/ return true; }