Lines Matching refs:ready
42 all the ready insns, and sorted according to priority number, we
48 or add it to the ready list. As the instructions are scheduled or
50 the ready list. When all insns down to the lowest priority have
56 among insns in the ready list:
210 N=2: bb's probabilities, detailed ready list info, unit/insn info.
239 /* Original order of insns in the ready list.
243 /* The deciding reason for INSN's place in the ready list. */
282 /* An instruction is ready to be scheduled when all insns preceding it
291 (R) the "Ready" list of unscheduled, uncommitted insns.
294 Initially, all insns are either "Pending" or "Ready" depending on
297 Insns move from the "Ready" list to the "Scheduled" list as they
300 the "Ready" list or the "Queued" set depending on whether
301 sufficient time has passed to make them ready. As time passes,
302 insns move from the "Queued" set to the "Ready" list.
305 unscheduled insns, i.e., those that are ready, queued, and pending.
307 The "Ready" list (R) is implemented by the variables `ready' and
314 insns move from the ready list to the scheduled list.
336 queue or ready list.
337 QUEUE_READY - INSN is in ready list.
350 /* The following array is used to find the best insn from ready when
354 /* The ready list. */
355 struct ready_list ready = {NULL, 0, 0, 0, 0};
357 /* The pointer to the ready list (to be removed). */
358 static struct ready_list *readyp = &ready;
424 /* Return the number of cycles until INSN is expected to be ready.
863 static rtx_insn *ready_remove_first_dispatch (struct ready_list *ready);
1789 - Instructions are added to the ready queue even if they require
1797 - Before sorting the ready queue, model_set_excess_costs assigns
1798 a pressure-based cost to each ready instruction in the queue.
2516 fprintf (sched_dump, ";;\t\t| Pressure costs for ready queue\n");
2584 /* Sorting predicate to move DEBUG_INSNs to the top of ready list, while
2646 the case, we sort ready list firstly by fusion priority, then
2900 /* Return a pointer to the bottom of the ready list, i.e. the insn
2904 ready_lastpos (struct ready_list *ready)
2906 gcc_assert (ready->n_ready >= 1);
2907 return ready->vec + ready->first - ready->n_ready + 1;
2910 /* Add an element INSN to the ready list so that it ends up with the
2914 ready_add (struct ready_list *ready, rtx_insn *insn, bool first_p)
2918 if (ready->first == ready->n_ready)
2920 memmove (ready->vec + ready->veclen - ready->n_ready,
2921 ready_lastpos (ready),
2922 ready->n_ready * sizeof (rtx));
2923 ready->first = ready->veclen - 1;
2925 ready->vec[ready->first - ready->n_ready] = insn;
2929 if (ready->first == ready->veclen - 1)
2931 if (ready->n_ready)
2932 /* ready_lastpos() fails when called with (ready->n_ready == 0). */
2933 memmove (ready->vec + ready->veclen - ready->n_ready - 1,
2934 ready_lastpos (ready),
2935 ready->n_ready * sizeof (rtx));
2936 ready->first = ready->veclen - 2;
2938 ready->vec[++(ready->first)] = insn;
2941 ready->n_ready++;
2943 ready->n_debug++;
2955 /* Remove the element with the highest priority from the ready list and
2959 ready_remove_first (struct ready_list *ready)
2963 gcc_assert (ready->n_ready);
2964 t = ready->vec[ready->first--];
2965 ready->n_ready--;
2967 ready->n_debug--;
2969 if (ready->n_ready == 0)
2970 ready->first = ready->veclen - 1;
2979 cycle. In other words, we will try to choose ready insn which
2982 /* Return a pointer to the element INDEX from the ready. INDEX for
2987 ready_element (struct ready_list *ready, int index)
2989 gcc_assert (ready->n_ready && index < ready->n_ready);
2991 return ready->vec[ready->first - index];
2994 /* Remove the element INDEX from the ready list and return it. INDEX
2999 ready_remove (struct ready_list *ready, int index)
3005 return ready_remove_first (ready);
3006 gcc_assert (ready->n_ready && index < ready->n_ready);
3007 t = ready->vec[ready->first - index];
3008 ready->n_ready--;
3010 ready->n_debug--;
3011 for (i = index; i < ready->n_ready; i++)
3012 ready->vec[ready->first - i] = ready->vec[ready->first - i - 1];
3017 /* Remove INSN from the ready list. */
3046 struct ready_list *ready)
3053 if (ready != NULL)
3056 rtx_insn **p = ready_lastpos (ready);
3060 for (int j = 1; j < ready->n_ready; ++j)
3072 ready)
3075 rtx_insn **first = ready_lastpos (ready);
3077 for (i = 0; i < ready->n_ready; ++i)
3081 qsort (first, ready->n_ready, sizeof (rtx), rank_for_schedule_debug);
3084 /* Sort non-debug insns in the ready list READY by ascending priority.
3087 ready_sort_real (struct ready_list *ready)
3090 rtx_insn **first = ready_lastpos (ready);
3091 int n_ready_real = ready->n_ready - ready->n_debug;
3112 print_rank_for_schedule_stats (";;\t\t", &stats1, ready);
3116 /* Sort the ready list READY by ascending priority. */
3118 ready_sort (struct ready_list *ready)
3120 if (ready->n_debug > 0)
3121 ready_sort_debug (ready);
3123 ready_sort_real (ready);
3126 /* PREV is an insn that is ready to execute. Adjust its priority if that
3288 for (i = 0; i < ready.n_ready; i++)
3290 rtx_insn *x = ready_element (&ready, i);
3499 MODEL_INSN_INFO (...) and model_num_insns accordingly. Add ready
3675 yet ready to issue. */
3768 /* Look for a ready instruction whose model_classify_priority is zero
3774 extant model_priority that is not yet ready, but which would reduce
3775 pressure if it became ready. This is designed to catch cases like:
3820 fprintf (sched_dump, ";;\t+--- promoting insn %d, which is ready\n",
3824 /* INSN isn't yet ready to issue. Give all its predecessors the
3829 /* INSN is ready. Add it to the end of model_schedule and
3987 waiting on INSN. READY is the ready list which contains the insns
3988 that are ready to fire. CLOCK is the current cycle. The function
4034 should have been removed from the ready list. */
4114 /* INSN has been prematurely moved from the queue to the ready list.
4156 /* Don't bother trying to mark next as ready if insn is a debug
4309 struct ready_list ready;
4367 save->ready.first = ready.first;
4368 save->ready.n_ready = ready.n_ready;
4369 save->ready.n_debug = ready.n_debug;
4370 save->ready.veclen = ready.veclen;
4371 save->ready.vec = XNEWVEC (rtx_insn *, ready.veclen);
4372 memcpy (save->ready.vec, ready.vec, ready.veclen * sizeof (rtx));
4422 /* Walk the ready list and all queues. If any insns have unresolved backwards
4433 if (ready.n_ready > 0)
4435 rtx_insn **first = ready_lastpos (&ready);
4436 for (i = 0; i < ready.n_ready; i++)
4528 /* A second pass, to update ready and speculation status for insns
4577 /* Clear the QUEUE_INDEX of everything in the ready list or one
4579 if (ready.n_ready > 0)
4581 rtx_insn **first = ready_lastpos (&ready);
4582 for (i = 0; i < ready.n_ready; i++)
4602 free (ready.vec);
4603 ready = save->ready;
4605 if (ready.n_ready > 0)
4607 rtx_insn **first = ready_lastpos (&ready);
4608 for (i = 0; i < ready.n_ready; i++)
4700 free (save->ready.vec);
5143 /* Move insns that became ready to fire from queue to ready list. */
5146 queue_to_ready (struct ready_list *ready)
5162 ready list. */
5169 fprintf (sched_dump, ";;\t\tQ-->Ready: insn %s: ",
5172 /* If the ready list is full, delay the insn for 1 cycle.
5175 && (ready->n_ready - ready->n_debug > param_max_sched_ready_insns
5189 fprintf (sched_dump, "keeping in queue, ready full\n");
5190 queue_insn (insn, 1, "ready full");
5194 ready_add (ready, insn, false);
5196 fprintf (sched_dump, "moving to ready without stalls\n");
5201 /* If there are no ready insns, stall until one is ready and add all
5202 of the pending insns at that point to the ready list. */
5203 if (ready->n_ready == 0)
5217 fprintf (sched_dump, ";;\t\tQ-->Ready: insn %s: ",
5220 ready_add (ready, insn, false);
5222 fprintf (sched_dump, "moving to ready with %d stalls\n", stalls);
5243 prematurely move INSN from the queue to the ready list. Currently,
5297 /* Remove insns from the queue, before they become "ready" with respect
5301 early_queue_to_ready (state_t state, struct ready_list *ready)
5347 /* non-negative to indicate that it's not ready
5364 ready_add (ready, insn, false);
5374 fprintf (sched_dump, ";;\t\tEarly Q-->Ready: insn %s\n",
5398 /* Print the ready list for debugging purposes.
5402 debug_ready_list_1 (struct ready_list *ready, signed char *ready_try)
5407 if (ready->n_ready == 0)
5413 p = ready_lastpos (ready);
5414 for (i = 0; i < ready->n_ready; i++)
5416 if (ready_try != NULL && ready_try[ready->n_ready - i - 1])
5437 /* Print the ready list. Callable from debugger. */
5439 debug_ready_list (struct ready_list *ready)
5441 debug_ready_list_1 (ready, NULL);
5604 insns in the ready list (or the queue) that have same memory base, but
5607 is "1", then we look at the ready list; if it is N>1, then we also look
5815 for (int i2 = 0; i2 < ready.n_ready; ++i2)
5836 the ready list. */
5867 && (ready_index == ready.n_ready - 1 || r < 0))
5885 ready queue. */
5917 insns is insns with the best rank (the first insn in READY). To
5918 make this function tries different samples of ready insns. READY
5919 is current queue `ready'. Global array READY_TRY reflects what
5922 INDEX will contain index of the best insn in READY. The following
5930 max_issue (struct ready_list *ready, int privileged_n, state_t state,
5941 n_ready = ready->n_ready;
5979 debug_ready_list_1 (ready, ready_try);
6029 /* Set ready-list index to point to the last insn
6048 insn = ready_element (ready, i);
6084 /* Increase ready-list index. */
6099 /* The following function chooses insn from READY and modifies
6100 READY. The following function is used only for first
6107 choose_ready (struct ready_list *ready, bool first_cycle_insn_p,
6125 /* INSN is in the queue. Advance cycle to move it to the ready list. */
6130 if (dfa_lookahead <= 0 || SCHED_GROUP_P (ready_element (ready, 0))
6131 || DEBUG_INSN_P (ready_element (ready, 0)))
6134 *insn_ptr = ready_remove_first_dispatch (ready);
6136 *insn_ptr = ready_remove_first (ready);
6146 insn = ready_element (ready, 0);
6149 *insn_ptr = ready_remove_first (ready);
6154 for (i = 0; i < ready->n_ready; i++)
6158 insn = ready_element (ready, i);
6183 the ready list. */
6204 if (max_issue (ready, 1, curr_state, first_cycle_insn_p, &index) == 0)
6206 *insn_ptr = ready_remove_first (ready);
6217 (ready_element (ready, index), 0));
6219 *insn_ptr = ready_remove (ready, index);
6271 /* Examine all insns on the ready list and queue those which can't be
6292 for (i = 0; i < ready.n_ready; i++)
6294 rtx_insn *insn = ready_element (&ready, i);
6307 int n = ready.n_ready;
6310 rtx_insn *insn = ready_element (&ready, i);
6390 ready_remove (&ready, i);
6394 some other insn ready to fire on the next cycle, then that
6435 ", not ready\n",
6546 /* Clear the ready list. */
6547 ready.first = ready.veclen - 1;
6548 ready.n_ready = 0;
6549 ready.n_debug = 0;
6555 targetm.sched.init (sched_dump, sched_verbose, ready.veclen);
6577 /* We need queue and ready lists and clock_var be initialized
6584 /* The algorithm is O(n^2) in the number of ready insns at any given
6588 && ready.n_ready - ready.n_debug > param_max_sched_ready_insns)
6590 ready_sort_debug (&ready);
6591 ready_sort_real (&ready);
6595 for (i = param_max_sched_ready_insns + ready.n_debug; i < ready.n_ready;
6597 if (!SCHED_GROUP_P (ready_element (&ready, i)))
6603 ";;\t\tReady list on entry: %d insns: ", ready.n_ready);
6604 debug_ready_list (&ready);
6620 while (i < ready.n_ready)
6624 insn = ready_remove (&ready, i);
6630 ready_add (&ready, skip_insn, true);
6661 /* Add to the ready list all pending insns that can be issued now.
6662 If there are no ready insns, increment clock until one
6663 is ready and add all pending insns at that point to the ready
6665 queue_to_ready (&ready);
6667 gcc_assert (ready.n_ready);
6672 debug_ready_list (&ready);
6713 if (ready.n_ready == 0)
6727 if (sort_p && ready.n_ready > 0)
6729 /* Sort the ready list based on priority. This must be
6733 ready_sort (&ready);
6739 debug_ready_list (&ready);
6745 if (ready.n_ready && DEBUG_INSN_P (ready_element (&ready, 0))
6748 while (ready.n_ready && DEBUG_INSN_P (ready_element (&ready, 0)))
6750 rtx_insn *insn = ready_remove_first (&ready);
6757 if (ready.n_ready > 0)
6758 ready_sort (&ready);
6762 if (ls.first_cycle_insn_p && !ready.n_ready)
6769 && (ready.n_ready == 0
6770 || !SCHED_GROUP_P (ready_element (&ready, 0))))
6775 ready_lastpos (&ready),
6776 &ready.n_ready, clock_var);
6780 ready.n_ready
6781 ? ready_lastpos (&ready) : NULL,
6782 &ready.n_ready, clock_var);
6790 debug_ready_list (&ready);
6795 if (ready.n_ready == 0
6800 there's nothing better to do (ready list is empty) but
6805 if (early_queue_to_ready (temp_state, &ready))
6806 ready_sort (&ready);
6809 if (ready.n_ready == 0
6815 /* Select and remove the insn from the ready list. */
6821 res = choose_ready (&ready, ls.first_cycle_insn_p, &insn);
6832 insn = ready_remove_first (&ready);
6837 ready_add (&ready, insn, true);
6847 of the ready list. This is needed when the target
6852 ready_add (&ready, insn, true).
6858 ready_add (&ready, insn, true);
6946 if (ready.n_ready > 0)
6953 for (i = 0; i < ready.n_ready; i++)
6955 rtx_insn *insn = ready_element (&ready, i);
6994 if (ready.n_ready > 0)
7014 /* Once again, debug insn suckiness: they can be on the ready list
7016 of the world consistent, remove such "ready" insns. */
7018 for (i = ready.n_ready - 1; i >= 0; i--)
7022 x = ready_element (&ready, i);
7026 ready_remove (&ready, i);
7030 for (i = ready.n_ready - 1; i >= 0; i--)
7034 x = ready_element (&ready, i);
7058 debug_ready_list (&ready);
7064 gcc_assert (!q_size && !ready.n_ready && !ready.n_debug);
7068 for (i = ready.n_ready - 1; i >= 0; i--)
7072 x = ready_element (&ready, i);
7111 ready) may be not correct for the insn in the subsequent
7501 basic block boundaries. Basically insns that are unconditionally ready
7564 /* Check if NEXT is ready to be added to the ready or queue list.
7567 -1 - is not ready yet,
7568 0 - added to the ready list,
7701 /* Calculate INSN_TICK of NEXT and add it to either ready or queue list. */
7749 or add it to the ready list (DELAY == QUEUE_READY),
7750 or remove it from ready and queue lists at all (DELAY == QUEUE_NOWHERE). */
7783 fprintf (sched_dump, " into ready\n");
7787 fprintf (sched_dump, " removed from ready or queue lists\n");
7810 ready.veclen = new_sched_ready_n_insns + issue_rate;
7811 ready.vec = XRESIZEVEC (rtx_insn *, ready.vec, ready.veclen);
7842 free (ready.vec);
7843 ready.vec = NULL;
7844 ready.veclen = 0;
7915 if (/* In try_ready we assert that if insn once became ready
7916 it can be removed from the ready (or queue) list only
8381 /* CHECK is being added to current region. Extend ready list. */
8566 /* If former check (INSN) already was moved to the ready (or queue)
8642 /* Try to add instructions to the ready or queue list. */
9211 the ready list. */
9214 ready_remove_first_dispatch (struct ready_list *ready)
9217 rtx_insn *insn = ready_element (ready, 0);
9219 if (ready->n_ready == 1
9224 return ready_remove_first (ready);
9226 for (i = 1; i < ready->n_ready; i++)
9228 insn = ready_element (ready, i);
9237 /* Return ith element of ready. */
9238 insn = ready_remove (ready, i);
9244 return ready_remove_first (ready);
9246 for (i = 1; i < ready->n_ready; i++)
9248 insn = ready_element (ready, i);
9255 /* Return i-th element of ready. */
9257 return ready_remove (ready, i);
9260 return ready_remove_first (ready);
9263 /* Get number of ready insn in the ready list. */
9268 return ready.n_ready;
9271 /* Get number of ready's in the ready list. */
9276 return ready_element (&ready, i);