On 10/13/2016 08:57 AM, Senthil Kumar Selvaraj wrote:


2016-10-13  Senthil Kumar Selvaraj  <senthil_kumar.selva...@atmel.com>

        * reload.c (find_valid_class_1): Allow regclass if atleast one
        regno in class is ok. Compute and use rclass size based on
        actually available regnos for mode in rclass.

gcc/testsuite/ChangeLog:

2016-10-13  Senthil Kumar Selvaraj  <senthil_kumar.selva...@atmel.com>
        
        * gcc.target/avr/pr71627.c: New.


Index: gcc/reload.c
===================================================================
--- gcc/reload.c        (revision 240989)
+++ gcc/reload.c        (working copy)
@@ -711,31 +711,36 @@
   enum reg_class best_class = NO_REGS;
   unsigned int best_size = 0;
   int cost;
+  unsigned int computed_rclass_sizes[N_REG_CLASSES] = { 0 };

As far as I can tell you're only accessing this as computed_rclass_size[rclass], i.e. with the current class in the loop. So I don't think you need the array at all, just a computed_size variable in the loop?

+      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+        {
+          if (in_hard_reg_set_p (reg_class_contents[rclass], mode, regno))
+            {
+              atleast_one_regno_ok = 1;
+              if (HARD_REGNO_MODE_OK (regno, mode))
+                computed_rclass_sizes[rclass]++;
+            }
+        }

Don't you want to also ensure HARD_REGNO_MODE_OK before claiming that atleast_one_regno_ok? Maybe I'm forgetting the motivation but this seems odd. If so, the variable becomes unnecessary, just check the computed size.


Bernd

Reply via email to