local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing.
authorJan Hubicka <jh@suse.cz>
Sat, 30 Mar 2002 13:26:19 +0000 (14:26 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 30 Mar 2002 13:26:19 +0000 (13:26 +0000)
* local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing.

* toplev.c (rest_of_compilation): Cann mark_constant_function
only when optimizing.

* flow.c (calculate_global_regs_live): Ensure that all AUX fields are NULL.

* cfgcleanup.c (bb_flags): Add BB_NONTHREADABLE_BLOCK.
(thread_jump): Set BB_NONTHREADABLE_BLOCK, check it.
(try_optimize_cfg): clear all AUX fields.

* i386.c (aligned_operand): Be prepared for SUBREGed registers.
(ix86_decompose_address): Use REG_P instead of GET_CODE (...) == REG.
(ix86_address_cost): Be prepared for SUBREGed registers.
(legitimate_address_p): Accept SUBREGed registers.

From-SVN: r51604

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/config/i386/i386.c
gcc/flow.c
gcc/local-alloc.c
gcc/toplev.c

index 288d75bc3f262664630ebe06785b798c4388efed..a320e7a90fe73a16e917943dcc7709b59cf7e767 100644 (file)
@@ -1,3 +1,21 @@
+Sat Mar 30 14:08:55 CET 2002  Jan Hubicka  <jh@suse.cz>
+
+       * local-alloc.c (local_alloc): Avoid call of update_equiv_regs when not optimizing.
+
+       * toplev.c (rest_of_compilation): Cann mark_constant_function
+       only when optimizing.
+
+       * flow.c (calculate_global_regs_live): Ensure that all AUX fields are NULL.
+
+       * cfgcleanup.c (bb_flags): Add BB_NONTHREADABLE_BLOCK.
+       (thread_jump): Set BB_NONTHREADABLE_BLOCK, check it.
+       (try_optimize_cfg): clear all AUX fields.
+
+       * i386.c (aligned_operand): Be prepared for SUBREGed registers.
+       (ix86_decompose_address): Use REG_P instead of GET_CODE (...) == REG.
+       (ix86_address_cost): Be prepared for SUBREGed registers.
+       (legitimate_address_p): Accept SUBREGed registers.
+
 2002-03-29  Richard Henderson  <rth@redhat.com>
 
        PR target/5672
index f31f168f7b51736ed9b520d382273394fef8caa1..b6a7f0cc4eabc0c758b6840e7ad35c31f8026be1 100644 (file)
@@ -54,7 +54,8 @@ enum bb_flags
 {
     /* Set if BB is the forwarder block to avoid too many
        forwarder_block_p calls.  */
-    BB_FORWARDER_BLOCK = 1
+    BB_FORWARDER_BLOCK = 1,
+    BB_NONTHREADABLE_BLOCK = 2
 };
 
 #define BB_FLAGS(BB) (enum bb_flags) (BB)->aux
@@ -279,17 +280,28 @@ thread_jump (mode, e, b)
   regset nonequal;
   bool failed = false;
 
+  if (BB_FLAGS (b) & BB_NONTHREADABLE_BLOCK)
+    return NULL;
+
   /* At the moment, we do handle only conditional jumps, but later we may
      want to extend this code to tablejumps and others.  */
   if (!e->src->succ->succ_next || e->src->succ->succ_next->succ_next)
     return NULL;
   if (!b->succ || !b->succ->succ_next || b->succ->succ_next->succ_next)
-    return NULL;
+    {
+      BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK);
+      return NULL;
+    }
 
   /* Second branch must end with onlyjump, as we will eliminate the jump.  */
-  if (!any_condjump_p (e->src->end) || !any_condjump_p (b->end)
-      || !onlyjump_p (b->end))
+  if (!any_condjump_p (e->src->end))
     return NULL;
+  
+  if (!any_condjump_p (b->end) || !onlyjump_p (b->end))
+    {
+      BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK);
+      return NULL;
+    }
 
   set1 = pc_set (e->src->end);
   set2 = pc_set (b->end);
@@ -324,7 +336,10 @@ thread_jump (mode, e, b)
   for (insn = NEXT_INSN (b->head); insn != NEXT_INSN (b->end);
        insn = NEXT_INSN (insn))
     if (INSN_P (insn) && side_effects_p (PATTERN (insn)))
-      return NULL;
+      {
+       BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK);
+       return NULL;
+      }
 
   cselib_init ();
 
@@ -363,7 +378,10 @@ thread_jump (mode, e, b)
   /* Later we should clear nonequal of dead registers.  So far we don't
      have life information in cfg_cleanup.  */
   if (failed)
-    goto failed_exit;
+    {
+      BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK);
+      goto failed_exit;
+    }
 
   /* cond2 must not mention any register that is not equal to the
      former block.  */
@@ -1723,8 +1741,7 @@ try_optimize_cfg (mode)
   if (mode & CLEANUP_CROSSJUMP)
     remove_fake_edges ();
 
-  for (i = 0; i < n_basic_blocks; i++)
-    BASIC_BLOCK (i)->aux = NULL;
+  clear_aux_for_blocks ();
 
   return changed_overall;
 }
index 8e9df35a9d69c5e027e1fae42ff568d0ced4c24e..f36495eeae5906e2a544d57446c4eedbe49da3b0 100644 (file)
@@ -3467,6 +3467,11 @@ aligned_operand (op, mode)
   if (! ix86_decompose_address (op, &parts))
     abort ();
 
+  if (parts.base && GET_CODE (parts.base) == SUBREG)
+    parts.base = SUBREG_REG (parts.base);
+  if (parts.index && GET_CODE (parts.index) == SUBREG)
+    parts.index = SUBREG_REG (parts.index);
+
   /* Look for some component that isn't known to be aligned.  */
   if (parts.index)
     {
@@ -4404,7 +4409,7 @@ ix86_decompose_address (addr, out)
   rtx scale_rtx = NULL_RTX;
   int retval = 1;
 
-  if (GET_CODE (addr) == REG || GET_CODE (addr) == SUBREG)
+  if (REG_P (addr) || GET_CODE (addr) == SUBREG)
     base = addr;
   else if (GET_CODE (addr) == PLUS)
     {
@@ -4531,6 +4536,11 @@ ix86_address_cost (x)
   if (!ix86_decompose_address (x, &parts))
     abort ();
 
+  if (parts.base && GET_CODE (parts.base) == SUBREG)
+    parts.base = SUBREG_REG (parts.base);
+  if (parts.index && GET_CODE (parts.index) == SUBREG)
+    parts.index = SUBREG_REG (parts.index);
+
   /* More complex memory references are better.  */
   if (parts.disp && parts.disp != const0_rtx)
     cost--;
@@ -4745,9 +4755,15 @@ legitimate_address_p (mode, addr, strict)
 
   if (base)
     {
+      rtx reg;
       reason_rtx = base;
 
-      if (GET_CODE (base) != REG)
+      if (GET_CODE (base) == SUBREG)
+       reg = SUBREG_REG (base);
+      else
+       reg = base;
+
+      if (GET_CODE (reg) != REG)
        {
          reason = "base is not a register";
          goto report_error;
@@ -4759,8 +4775,8 @@ legitimate_address_p (mode, addr, strict)
          goto report_error;
        }
 
-      if ((strict && ! REG_OK_FOR_BASE_STRICT_P (base))
-         || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (base)))
+      if ((strict && ! REG_OK_FOR_BASE_STRICT_P (reg))
+         || (! strict && ! REG_OK_FOR_BASE_NONSTRICT_P (reg)))
        {
          reason = "base is not valid";
          goto report_error;
@@ -4775,9 +4791,15 @@ legitimate_address_p (mode, addr, strict)
 
   if (index)
     {
+      rtx reg;
       reason_rtx = index;
 
-      if (GET_CODE (index) != REG)
+      if (GET_CODE (index) == SUBREG)
+       reg = SUBREG_REG (index);
+      else
+       reg = index;
+
+      if (GET_CODE (reg) != REG)
        {
          reason = "index is not a register";
          goto report_error;
@@ -4789,8 +4811,8 @@ legitimate_address_p (mode, addr, strict)
          goto report_error;
        }
 
-      if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (index))
-         || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (index)))
+      if ((strict && ! REG_OK_FOR_INDEX_STRICT_P (reg))
+         || (! strict && ! REG_OK_FOR_INDEX_NONSTRICT_P (reg)))
        {
          reason = "index is not valid";
          goto report_error;
index 61008e630e01642f1e6a27597dcc08eb8f238142..332d5434f682ac9132b913d8b67b80bf5cda65e3 100644 (file)
@@ -1071,6 +1071,16 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
   regset_head new_live_at_end_head;
   int i;
 
+  /* Some passes used to forget clear aux field of basic block causing
+     sick behaviour here.  */
+#ifdef ENABLE_CHECKING
+  if (ENTRY_BLOCK_PTR->aux || EXIT_BLOCK_PTR->aux)
+    abort ();
+  for (i = 0; i < n_basic_blocks; i++)
+    if (BASIC_BLOCK (i)->aux)
+      abort ();
+#endif
+
   tmp = INITIALIZE_REG_SET (tmp_head);
   new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head);
   call_used = INITIALIZE_REG_SET (call_used_head);
index c44f3686bb895de426686b8dbb0ed976693a2830..4da7eac849ad283b74ec4f9eb30e32573aedaf47 100644 (file)
@@ -352,7 +352,8 @@ local_alloc ()
 
   /* Promote REG_EQUAL notes to REG_EQUIV notes and adjust status of affected
      registers.  */
-  update_equiv_regs ();
+  if (optimize)
+    update_equiv_regs ();
 
   /* This sets the maximum number of quantities we can have.  Quantity
      numbers start at zero and we can have one for each pseudo.  */
index 86d4d60762334b1a6c44d31c98d5175d080b52ce..1baf772452bddc0178ee7a3b184a73fff77b941b 100644 (file)
@@ -2856,7 +2856,8 @@ rest_of_compilation (decl)
 
      life_analyzis rarely eliminates modification of external memory.
    */
-  mark_constant_function ();
+  if (optimize)
+    mark_constant_function ();
 
   close_dump_file (DFI_cfg, print_rtl_with_bb, insns);