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]

reordering bug


Targets that don't have epilogue as rtl (e.g. sparc)
must fall through off the end of the function.  

I'm not that familiar with the reordering code.  Does
this look to be sufficient, or is there other information
that must be properly initialized?


r~


	* bb-reorder.c (fixup_reorder_chain): Don't look up new block again.
	(reorder_basic_blocks): If no epilogue in rtl, force last block last.

Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/bb-reorder.c,v
retrieving revision 1.4
diff -c -p -d -r1.4 bb-reorder.c
*** bb-reorder.c	2000/04/03 23:25:06	1.4
--- bb-reorder.c	2000/04/17 19:11:08
*************** fixup_reorder_chain ()
*** 690,697 ****
  	      BASIC_BLOCK (nb->index)->local_set = 0;
  
  	      nb->aux = xcalloc (1, sizeof (struct reorder_block_def));
! 	      REORDER_BLOCK_INDEX (BASIC_BLOCK (n_basic_blocks - 1))
! 		= REORDER_BLOCK_INDEX (bbi) + 1;
  	      /* Relink to new block.  */
  	      nb->succ = bbi->succ;
  	      nb->succ->src = nb;
--- 690,696 ----
  	      BASIC_BLOCK (nb->index)->local_set = 0;
  
  	      nb->aux = xcalloc (1, sizeof (struct reorder_block_def));
! 	      REORDER_BLOCK_INDEX (nb) = REORDER_BLOCK_INDEX (bbi) + 1;
  	      /* Relink to new block.  */
  	      nb->succ = bbi->succ;
  	      nb->succ->src = nb;
*************** reorder_basic_blocks ()
*** 834,839 ****
--- 833,854 ----
  	  rtx prev_eff_end = REORDER_BLOCK_EFF_END (BASIC_BLOCK (i - 1));
  	  REORDER_BLOCK_EFF_HEAD (bbi) = NEXT_INSN (prev_eff_end);
  	}
+     }
+ 
+   /* If we've not got epilogue in RTL, we must fallthru to the exit.
+      Force the last block to be at the end.  */
+   /* ??? Some ABIs (e.g. MIPS) require the return insn to be at the
+      end of the function for stack unwinding purposes.  */
+ 
+ #ifndef HAVE_epilogue
+ #define HAVE_epilogue 0
+ #endif
+ 
+   if (! HAVE_epilogue)
+     {
+       basic_block last = BASIC_BLOCK (n_basic_blocks - 1);
+       REORDER_BLOCK_INDEX (last) = n_basic_blocks - 1;
+       REORDER_BLOCK_FLAGS (last) |= REORDER_BLOCK_VISITED;
      }
        
    make_reorder_chain (BASIC_BLOCK (0));

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