public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, spu] Fix sched_emit_insn after scheduler changes
@ 2011-04-27 14:15 Ulrich Weigand
  2011-05-02  8:51 ` Bernd Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2011-04-27 14:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: bernds, law

Hello,

since recent changes to haifa-sched.c, the SPU back-end runs into
internal errors due to its use of the sched_emit_insn routine to
emit instruction prefetch instructions during final scheduling.

Now that scheduled instructions aren't placed into the instruction
stream directly, sched_emit_insn needs to change as well.  The
patch below emits the instruction before nonscheduled_insns_begin
(so that it isn't considered for future scheduling), and adds it
to scheduled_insns so that it will be placed into the output
instruction stream at the correct location.

The patch also adds calls to the add_remove_insn and begin_schedule_ready
callbacks to make sure the back-end accounting stays up to date.

This patch gets the SPU target back to build its run-time libraries
without internal errors.

Tested on spu-elf.   OK for mainline?

Bye,
Ulrich


ChangeLog:

	* haifa-sched.c (sched_emit_insn): Emit insn before first
	non-scheduled insn.  Inform back-end about new insn.  Add
	new insn to scheduled_insns list.

Index: gcc/haifa-sched.c
===================================================================
*** gcc/haifa-sched.c	(revision 172953)
--- gcc/haifa-sched.c	(working copy)
*************** sched_create_empty_bb_1 (basic_block aft
*** 5654,5662 ****
  rtx
  sched_emit_insn (rtx pat)
  {
!   rtx insn = emit_insn_after (pat, last_scheduled_insn);
!   last_scheduled_insn = insn;
    haifa_init_insn (insn);
    return insn;
  }
  
--- 5654,5669 ----
  rtx
  sched_emit_insn (rtx pat)
  {
!   rtx insn = emit_insn_before (pat, nonscheduled_insns_begin);
    haifa_init_insn (insn);
+ 
+   if (current_sched_info->add_remove_insn)
+     current_sched_info->add_remove_insn (insn, 0);
+ 
+   (*current_sched_info->begin_schedule_ready) (insn);
+   VEC_safe_push (rtx, heap, scheduled_insns, insn);
+ 
+   last_scheduled_insn = insn;
    return insn;
  }
  
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

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

* Re: [patch, spu] Fix sched_emit_insn after scheduler changes
  2011-04-27 14:15 [patch, spu] Fix sched_emit_insn after scheduler changes Ulrich Weigand
@ 2011-05-02  8:51 ` Bernd Schmidt
  2011-05-02 13:56   ` Ulrich Weigand
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Schmidt @ 2011-05-02  8:51 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gcc-patches, law

On 04/27/2011 03:22 PM, Ulrich Weigand wrote:
> 	* haifa-sched.c (sched_emit_insn): Emit insn before first
> 	non-scheduled insn.  Inform back-end about new insn.  Add
> 	new insn to scheduled_insns list.

Seems like this function is only used from spu.c. OK.


Bernd

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

* Re: [patch, spu] Fix sched_emit_insn after scheduler changes
  2011-05-02  8:51 ` Bernd Schmidt
@ 2011-05-02 13:56   ` Ulrich Weigand
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Weigand @ 2011-05-02 13:56 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: gcc-patches, law

Bernd Schmidt wrote:
> On 04/27/2011 03:22 PM, Ulrich Weigand wrote:
> > 	* haifa-sched.c (sched_emit_insn): Emit insn before first
> > 	non-scheduled insn.  Inform back-end about new insn.  Add
> > 	new insn to scheduled_insns list.
> 
> Seems like this function is only used from spu.c. OK.

Thanks for the review; I've checked this in now.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

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

end of thread, other threads:[~2011-05-02 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 14:15 [patch, spu] Fix sched_emit_insn after scheduler changes Ulrich Weigand
2011-05-02  8:51 ` Bernd Schmidt
2011-05-02 13:56   ` Ulrich Weigand

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