public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix regrename compare-debug issue
@ 2016-05-04 15:21 Bernd Schmidt
  2016-05-05  7:02 ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Schmidt @ 2016-05-04 15:21 UTC (permalink / raw)
  To: GCC Patches, Uros Bizjak

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

When scanning addresses inside a debug insn, we shouldn't use normal 
base/index classes. This shows as a compare-debug issue on Alpha, where 
INDEX_REG_CLASS is NO_REGS, and this prevented a chain from being 
renamed with debugging turned on.

Uros has reported that this patch resolves the issues he was seeing on 
Alpha, and I've bootstrapped and tested it on x86_64-linux. Ok?


Bernd

[-- Attachment #2: rr-dbg.diff --]
[-- Type: text/x-patch, Size: 2644 bytes --]

	* regrename.c (base_reg_class_for_rename): New static function.
	(scan_rtx_address, scan_rtx): Use it instead of base_reg_class.

Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c	(revision 235808)
+++ gcc/regrename.c	(working copy)
@@ -1238,6 +1238,19 @@ scan_rtx_reg (rtx_insn *insn, rtx *loc,
     }
 }
 
+/* A wrapper around base_reg_class which returns ALL_REGS if INSN is a
+   DEBUG_INSN.  The arguments MODE, AS, CODE and INDEX_CODE are as for
+   base_reg_class.  */
+
+static reg_class
+base_reg_class_for_rename (rtx_insn *insn, machine_mode mode, addr_space_t as,
+			   rtx_code code, rtx_code index_code)
+{
+  if (DEBUG_INSN_P (insn))
+    return ALL_REGS;
+  return base_reg_class (mode, as, code, index_code);
+}
+
 /* Adapted from find_reloads_address_1.  CL is INDEX_REG_CLASS or
    BASE_REG_CLASS depending on how the register is being considered.  */
 
@@ -1343,12 +1356,16 @@ scan_rtx_address (rtx_insn *insn, rtx *l
 	  }
 
 	if (locI)
-	  scan_rtx_address (insn, locI, INDEX_REG_CLASS, action, mode, as);
+	  {
+	    reg_class iclass = DEBUG_INSN_P (insn) ? ALL_REGS : INDEX_REG_CLASS;
+	    scan_rtx_address (insn, locI, iclass, action, mode, as);
+	  }
 	if (locB)
-	  scan_rtx_address (insn, locB,
-			    base_reg_class (mode, as, PLUS, index_code),
-			    action, mode, as);
-
+	  {
+	    reg_class bclass = base_reg_class_for_rename (insn, mode, as, PLUS,
+							  index_code);
+	    scan_rtx_address (insn, locB, bclass, action, mode, as);
+	  }
 	return;
       }
 
@@ -1366,10 +1383,13 @@ scan_rtx_address (rtx_insn *insn, rtx *l
       break;
 
     case MEM:
-      scan_rtx_address (insn, &XEXP (x, 0),
-			base_reg_class (GET_MODE (x), MEM_ADDR_SPACE (x),
-					MEM, SCRATCH),
-			action, GET_MODE (x), MEM_ADDR_SPACE (x));
+      {
+	reg_class bclass = base_reg_class_for_rename (insn, GET_MODE (x),
+						      MEM_ADDR_SPACE (x),
+						      MEM, SCRATCH);
+	scan_rtx_address (insn, &XEXP (x, 0), bclass, action, GET_MODE (x),
+			  MEM_ADDR_SPACE (x));
+      }
       return;
 
     case REG:
@@ -1416,10 +1436,14 @@ scan_rtx (rtx_insn *insn, rtx *loc, enum
       return;
 
     case MEM:
-      scan_rtx_address (insn, &XEXP (x, 0),
-			base_reg_class (GET_MODE (x), MEM_ADDR_SPACE (x),
-					MEM, SCRATCH),
-			action, GET_MODE (x), MEM_ADDR_SPACE (x));
+      {
+	reg_class bclass = base_reg_class_for_rename (insn, GET_MODE (x),
+						      MEM_ADDR_SPACE (x),
+						      MEM, SCRATCH);
+
+	scan_rtx_address (insn, &XEXP (x, 0), bclass, action, GET_MODE (x),
+			  MEM_ADDR_SPACE (x));
+      }
       return;
 
     case SET:

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

* Re: Fix regrename compare-debug issue
  2016-05-04 15:21 Fix regrename compare-debug issue Bernd Schmidt
@ 2016-05-05  7:02 ` Eric Botcazou
  2016-05-09  9:44   ` Bernd Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2016-05-05  7:02 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc-patches, Uros Bizjak

> When scanning addresses inside a debug insn, we shouldn't use normal
> base/index classes. This shows as a compare-debug issue on Alpha, where
> INDEX_REG_CLASS is NO_REGS, and this prevented a chain from being
> renamed with debugging turned on.
> 
> Uros has reported that this patch resolves the issues he was seeing on
> Alpha, and I've bootstrapped and tested it on x86_64-linux. Ok?

OK, thanks.  It might worthwhile to add a sentence somewhere (maybe at the end 
of the head comment of the file) documenting the special treatment applied to 
debug insns during the pass.

-- 
Eric Botcazou

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

* Re: Fix regrename compare-debug issue
  2016-05-05  7:02 ` Eric Botcazou
@ 2016-05-09  9:44   ` Bernd Schmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Bernd Schmidt @ 2016-05-09  9:44 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches, Uros Bizjak



On 05/05/2016 09:02 AM, Eric Botcazou wrote:
>> When scanning addresses inside a debug insn, we shouldn't use normal
>> base/index classes. This shows as a compare-debug issue on Alpha, where
>> INDEX_REG_CLASS is NO_REGS, and this prevented a chain from being
>> renamed with debugging turned on.
>>
>> Uros has reported that this patch resolves the issues he was seeing on
>> Alpha, and I've bootstrapped and tested it on x86_64-linux. Ok?
>
> OK, thanks.  It might worthwhile to add a sentence somewhere (maybe at the end
> of the head comment of the file) documenting the special treatment applied to
> debug insns during the pass.

Committed with the extra hunk below.


Bernd

@@ -61,7 +61,10 @@
       5. If a renaming register has been found, it is substituted in 
the chain.

    Targets can parameterize the pass by specifying a preferred class 
for the
-  renaming register for a given (super)class of registers to be 
renamed.  */
+  renaming register for a given (super)class of registers to be renamed.
+
+  DEBUG_INSNs are treated specially, in particular registers occurring 
inside
+  them are treated as requiring ALL_REGS as a class.  */

  #if HOST_BITS_PER_WIDE_INT <= MAX_RECOG_OPERANDS
  #error "Use a different bitmap implementation for untracked_operands."

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

end of thread, other threads:[~2016-05-09  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 15:21 Fix regrename compare-debug issue Bernd Schmidt
2016-05-05  7:02 ` Eric Botcazou
2016-05-09  9:44   ` Bernd Schmidt

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