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);
        }
     }

Reply via email to