public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A question about sched_analyze_insn in sched-deps.c
@ 2011-08-10 14:25 Revital Eres
  2011-08-10 15:57 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Revital Eres @ 2011-08-10 14:25 UTC (permalink / raw)
  To: gcc

Hello,

I appriciate explanation regarding the following piece of code in
sched_analyze_insn function (sched-deps.c): When handling jump instruction
dependence edges are created between the jump instruction and memory
writes and volatile reads and I'm not quite sure the reason why.

Thanks,
Revital

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

* Re: A question about sched_analyze_insn in sched-deps.c
  2011-08-10 14:25 A question about sched_analyze_insn in sched-deps.c Revital Eres
@ 2011-08-10 15:57 ` Ian Lance Taylor
  2011-08-11  6:37   ` Revital Eres
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2011-08-10 15:57 UTC (permalink / raw)
  To: Revital Eres; +Cc: gcc

Revital Eres <revital.eres@linaro.org> writes:

> I appriciate explanation regarding the following piece of code in
> sched_analyze_insn function (sched-deps.c): When handling jump instruction
> dependence edges are created between the jump instruction and memory
> writes and volatile reads and I'm not quite sure the reason why.

Jump instructions can be conditional.  Note the check for whether the
next instruction is a barrier.

Ian

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

* Re: A question about sched_analyze_insn in sched-deps.c
  2011-08-10 15:57 ` Ian Lance Taylor
@ 2011-08-11  6:37   ` Revital Eres
  2011-08-16  0:39     ` Ayal Zaks
  0 siblings, 1 reply; 4+ messages in thread
From: Revital Eres @ 2011-08-11  6:37 UTC (permalink / raw)
  To: Ian Lance Taylor, ayal.zaks; +Cc: gcc

Hello,

>> I appriciate explanation regarding the following piece of code in
>> sched_analyze_insn function (sched-deps.c): When handling jump instruction
>> dependence edges are created between the jump instruction and memory
>> writes and volatile reads and I'm not quite sure the reason why.
>
> Jump instructions can be conditional.  Note the check for whether the
> next instruction is a barrier.

Thanks for the answer. I'm asking that in the context of SMS --- I'm
not sure if this dependence is needed when SMS is applied. AFAIK SMS
will not do speculative memory access.  If that's indeed the case I'll
submit the following patch.

Thanks,
Revital

Index: sched-deps.c
===================================================================
--- sched-deps.c	(revision 177556)
+++ sched-deps.c	(working copy)
@@ -2777,32 +2777,36 @@ sched_analyze_insn (struct deps_desc *de
             }

 	  /* All memory writes and volatile reads must happen before the
-	     jump.  Non-volatile reads must happen before the jump iff
-	     the result is needed by the above register used mask.  */
+	     jump unless the analysis is done for the SMS pass.
+	     Non-volatile reads must happen before the jump iff the
+	     result is needed by the above register used mask.	*/

-	  pending = deps->pending_write_insns;
-	  pending_mem = deps->pending_write_mems;
-	  while (pending)
+	  if (common_sched_info->sched_pass_id != SCHED_SMS_PASS)
 	    {
-	      if (! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
-		add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
-	      pending = XEXP (pending, 1);
-	      pending_mem = XEXP (pending_mem, 1);
-	    }
-
-	  pending = deps->pending_read_insns;
-	  pending_mem = deps->pending_read_mems;
-	  while (pending)
-	    {
-	      if (MEM_VOLATILE_P (XEXP (pending_mem, 0))
-		  && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
-		add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
-	      pending = XEXP (pending, 1);
-	      pending_mem = XEXP (pending_mem, 1);
+	      pending = deps->pending_write_insns;
+	      pending_mem = deps->pending_write_mems;
+	      while (pending)
+		{
+		  if (! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
+		    add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
+		  pending = XEXP (pending, 1);
+		  pending_mem = XEXP (pending_mem, 1);
+		}
+	
+	      pending = deps->pending_read_insns;
+	      pending_mem = deps->pending_read_mems;
+	      while (pending)
+		{
+		  if (MEM_VOLATILE_P (XEXP (pending_mem, 0))
+		      && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
+		    add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
+		  pending = XEXP (pending, 1);
+		  pending_mem = XEXP (pending_mem, 1);
+		}
+	
+	      add_dependence_list (insn, deps->last_pending_memory_flush, 1,
+				   REG_DEP_ANTI);
 	    }
-
-	  add_dependence_list (insn, deps->last_pending_memory_flush, 1,
-			       REG_DEP_ANTI);
 	}
     }

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

* Re: A question about sched_analyze_insn in sched-deps.c
  2011-08-11  6:37   ` Revital Eres
@ 2011-08-16  0:39     ` Ayal Zaks
  0 siblings, 0 replies; 4+ messages in thread
From: Ayal Zaks @ 2011-08-16  0:39 UTC (permalink / raw)
  To: Revital Eres; +Cc: Ian Lance Taylor, gcc

>AFAIK SMS will not do speculative memory access.

Right, SMS does no speculative memory access. Though that might not be
a bad idea...
Ayal.


2011/8/11 Revital Eres <revital.eres@linaro.org>
>
> Hello,
>
> >> I appriciate explanation regarding the following piece of code in
> >> sched_analyze_insn function (sched-deps.c): When handling jump instruction
> >> dependence edges are created between the jump instruction and memory
> >> writes and volatile reads and I'm not quite sure the reason why.
> >
> > Jump instructions can be conditional.  Note the check for whether the
> > next instruction is a barrier.
>
> Thanks for the answer. I'm asking that in the context of SMS --- I'm
> not sure if this dependence is needed when SMS is applied. AFAIK SMS
> will not do speculative memory access.  If that's indeed the case I'll
> submit the following patch.
>
> Thanks,
> Revital
>
> Index: sched-deps.c
> ===================================================================
> --- sched-deps.c        (revision 177556)
> +++ sched-deps.c        (working copy)
> @@ -2777,32 +2777,36 @@ sched_analyze_insn (struct deps_desc *de
>             }
>
>          /* All memory writes and volatile reads must happen before the
> -            jump.  Non-volatile reads must happen before the jump iff
> -            the result is needed by the above register used mask.  */
> +            jump unless the analysis is done for the SMS pass.
> +            Non-volatile reads must happen before the jump iff the
> +            result is needed by the above register used mask.  */
>
> -         pending = deps->pending_write_insns;
> -         pending_mem = deps->pending_write_mems;
> -         while (pending)
> +         if (common_sched_info->sched_pass_id != SCHED_SMS_PASS)
>            {
> -             if (! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
> -               add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
> -             pending = XEXP (pending, 1);
> -             pending_mem = XEXP (pending_mem, 1);
> -           }
> -
> -         pending = deps->pending_read_insns;
> -         pending_mem = deps->pending_read_mems;
> -         while (pending)
> -           {
> -             if (MEM_VOLATILE_P (XEXP (pending_mem, 0))
> -                 && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
> -               add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
> -             pending = XEXP (pending, 1);
> -             pending_mem = XEXP (pending_mem, 1);
> +             pending = deps->pending_write_insns;
> +             pending_mem = deps->pending_write_mems;
> +             while (pending)
> +               {
> +                 if (! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
> +                   add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
> +                 pending = XEXP (pending, 1);
> +                 pending_mem = XEXP (pending_mem, 1);
> +               }
> +
> +             pending = deps->pending_read_insns;
> +             pending_mem = deps->pending_read_mems;
> +             while (pending)
> +               {
> +                 if (MEM_VOLATILE_P (XEXP (pending_mem, 0))
> +                     && ! sched_insns_conditions_mutex_p (insn, XEXP (pending, 0)))
> +                   add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
> +                 pending = XEXP (pending, 1);
> +                 pending_mem = XEXP (pending_mem, 1);
> +               }
> +
> +             add_dependence_list (insn, deps->last_pending_memory_flush, 1,
> +                                  REG_DEP_ANTI);
>            }
> -
> -         add_dependence_list (insn, deps->last_pending_memory_flush, 1,
> -                              REG_DEP_ANTI);
>        }
>     }

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

end of thread, other threads:[~2011-08-16  0:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 14:25 A question about sched_analyze_insn in sched-deps.c Revital Eres
2011-08-10 15:57 ` Ian Lance Taylor
2011-08-11  6:37   ` Revital Eres
2011-08-16  0:39     ` Ayal Zaks

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