- if (!n->child_count) {
- /* The color read needs to be scheduled late, to avoid locking
- * the scoreboard early. This is our best tool for
- * encouraging that. The other scoreboard locking ops will
- * have this happen by default, since they are generally the
- * DAG heads or close to them.
- */
- if (n->inst->op == QOP_TLB_COLOR_READ)
- n->delay = 1000;
- else
- n->delay = 1;
- } else {
- for (int i = 0; i < n->child_count; i++) {
- if (!n->children[i]->delay)
- compute_delay(n->children[i]);
- n->delay = MAX2(n->delay,
- n->children[i]->delay +
- latency_between(n, n->children[i]));
- }
+ struct schedule_node *n = (struct schedule_node *)node;
+
+ /* The color read needs to be scheduled late, to avoid locking the
+ * scoreboard early. This is our best tool for encouraging that. The
+ * other scoreboard locking ops will have this happen by default,
+ * since they are generally the DAG heads or close to them.
+ */
+ if (n->inst->op == QOP_TLB_COLOR_READ)
+ n->delay = 1000;
+ else
+ n->delay = 1;
+
+ util_dynarray_foreach(&n->dag.edges, struct dag_edge, edge) {
+ struct schedule_node *child =
+ (struct schedule_node *)edge->child;
+
+ n->delay = MAX2(n->delay, (child->delay +
+ latency_between(child, n)));