🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #5990

Delay slot scheduling bug

#5990
From: Ken Rose
Date: Fri, 20 Dec 1996 00:00
45 lines
2244 bytes
I'm working on a port of gcc for a new microprocessor, and I encountered an abort during delay slot scheduling.  After considerable investigation, I found
a problem in the code that takes instructions from the target of a branch
to use in the slots.  In fill_slots_from_thread(), there are three places
that remove an instruction from the beginning of a basic block to take to
the delay slot.  The original insn is then marked deleted under certain
circumstances.  In only one of those places is the variable holding the basic
block advanced to the next insn in the block.  The problem with that is that
when the compiler tries to move ANOTHER instruction out of the block to the
second delay slot (an apparently unique feature of my target machine) the
deleted insn causes an abort in add_insn_before().  The fix is to advance over
the deleted instruction, as is done in one place.  I've included a patch to fix this, below.  It's for gcc 2.7.2.1

*** reorg.c.old	Thu Dec 19 16:55:36 1996
--- reorg.c	Thu Dec 19 17:01:36 1996
*************** fill_slots_from_thread (insn, condition,
*** 3422,3427 ****
--- 3422,3433 ----
  		  if (own_thread)
  		    {
  		      update_block (trial, thread);
+ 		      if (trial == thread)
+ 			{
+ 			  thread = next_active_insn (thread);
+ 			  if (new_thread == trial)
+ 			    new_thread = thread;
+ 			}
  		      delete_insn (trial);
  		    }
  		  else
*************** fill_slots_from_thread (insn, condition,
*** 3570,3575 ****
--- 3576,3587 ----
  	  if (own_thread)
  	    {
  	      update_block (trial, thread);
+ 	      if (trial == thread)
+ 		{
+ 		  thread = next_active_insn (thread);
+ 		  if (new_thread == trial)
+ 		    new_thread = thread;
+ 		}
  	      delete_insn (trial);
  	    }
  	  else
Technical Details
Message-ID: <199612201910.LAA27297@netcom.netcom.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,76dfdcc625ae1be4,start
X-Google-Attributes: gid113d02,public
From: rose@netcom.com (Ken Rose)
Subject: Delay slot scheduling bug
Date: 1996/12/20
Message-ID: <199612201910.LAA27297@netcom.netcom.com>
X-Deja-AN: 205147740
sender: bug-gcc-request@prep.ai.mit.edu
x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 20 Dec 1996 14:11:46 EST
newsgroups: gnu.gcc.bug