Lines Matching defs:fence

82    A fence is a point through which code motion is prohibited.  On each step,
83 we gather a parallel group of insns at a fence. It is possible to have
84 multiple fences. A fence is represented via fence_t.
86 A boundary is the border between the fence group and the rest of the code.
87 Currently, we never have more than one boundary per fence, as we finalize
88 the fence group when a jump is scheduled. A boundary is represented
103 scheduling on each fence and updating fences. For each fence,
127 and moving to another fence. The first two restrictions are lifted during
210 Also, we try to minimize the dependence context used on each fence to check
213 tick_check_p checks are also cached in a vector on each fence.
463 we haven't scheduled anything on the previous fence.
503 fence. See comment near the call to update_and_record_unavailable_insns
507 /* This vector has vinsns which are scheduled with renaming on the first fence
566 advance_one_cycle (fence_t fence)
572 advance_state (FENCE_STATE (fence));
573 cycle = ++FENCE_CYCLE (fence);
574 FENCE_ISSUED_INSNS (fence) = 0;
575 FENCE_STARTS_CYCLE_P (fence) = 1;
577 FENCE_ISSUE_MORE (fence) = can_issue_more;
579 for (i = 0; vec_safe_iterate (FENCE_EXECUTING_INSNS (fence), i, &insn); )
583 remove_from_deps (FENCE_DC (fence), insn);
584 FENCE_EXECUTING_INSNS (fence)->unordered_remove (i);
591 sel_print ("Finished a cycle. Current cycle = %d\n", FENCE_CYCLE (fence));
592 debug_state (FENCE_STATE (fence));
620 When a successor will continue a ebb, transfer all parameters of a fence
621 to the new fence. ORIG_MAX_SEQNO is the maximal seqno before this round
632 fence_t fence = FLIST_FENCE (old_fences);
635 /* Get the only element of FENCE_BNDS (fence). */
636 FOR_EACH_INSN (insn, ii, FENCE_BNDS (fence))
643 /* When in the "middle" of the block, just move this fence
660 FENCE_INSN (fence) = succ;
670 /* Otherwise copy fence's structures to (possibly) multiple successors. */
687 add_dirty_fence_to_fences (new_fences, succ, fence);
692 add_clean_fence_to_fences (new_fences, succ, fence);
1547 /* Check only if we haven't scheduled something on the previous fence,
1549 and having more than one fence, we may end having targ_un in a block
2711 /* We can reach another fence here and still seqno of insn
2715 whether insn is in current fence too. */
2720 /* An insn from another fence could also be
2722 a fence list right now. Check INSN_SCHED_CYCLE instead. */
3615 created while scheduling on another fence. */
3691 boundaries and fence, respectively. If we need to stall for some cycles
3695 fill_vec_av_set (av_set_t av, blist_t bnds, fence_t fence,
3732 if (FENCE_STARTS_CYCLE_P (fence))
3745 bool fence_insn_p = INSN_UID (insn) == INSN_UID (FENCE_INSN (fence));
3748 if (FENCE_SCHED_NEXT (fence) && insn != FENCE_SCHED_NEXT (fence))
3756 if (FENCE_SCHED_NEXT (fence))
3763 /* If insn was already scheduled on the current fence,
3802 /* A fence insn should not get here. */
3807 /* At this point a fence insn should always be available. */
3809 || INSN_UID (FENCE_INSN (fence)) == INSN_UID (EXPR_INSN_RTX (expr)));
3863 if (INSN_UID (insn) < FENCE_READY_TICKS_SIZE (fence))
3865 need_cycles = (FENCE_READY_TICKS (fence)[INSN_UID (insn)]
3866 - FENCE_CYCLE (fence));
3882 FENCE_READY_TICKS (fence)[INSN_UID (insn)]);
3889 need_cycles = tick_check_p (expr, dc, fence);
3898 if (INSN_UID (insn) >= FENCE_READY_TICKS_SIZE (fence))
3902 FENCE_READY_TICKS (fence)
3903 = (int *) xrecalloc (FENCE_READY_TICKS (fence),
3904 new_size, FENCE_READY_TICKS_SIZE (fence),
3907 FENCE_READY_TICKS (fence)[INSN_UID (insn)]
3908 = FENCE_CYCLE (fence) + need_cycles;
3920 FENCE_READY_TICKS (fence)[INSN_UID (insn)]);
3930 if (FENCE_SCHED_NEXT (fence))
3933 FENCE_SCHED_NEXT (fence) = NULL;
3999 max_issue). BND and FENCE are current boundary and fence,
4003 fill_ready_list (av_set_t *av_ptr, blist_t bnds, fence_t fence,
4008 /* We do not support multiple boundaries per fence. */
4025 if (! fill_vec_av_set (*av_ptr, bnds, fence, pneed_stall))
4038 sel_dfa_new_cycle (insn_t insn, fence_t fence)
4040 int last_scheduled_cycle = FENCE_LAST_SCHEDULED_INSN (fence)
4041 ? INSN_SCHED_CYCLE (FENCE_LAST_SCHEDULED_INSN (fence))
4042 : FENCE_CYCLE (fence) - 1;
4049 memcpy (curr_state, FENCE_STATE (fence), dfa_state_size);
4053 FENCE_CYCLE (fence), &sort_p))
4055 memcpy (FENCE_STATE (fence), curr_state, dfa_state_size);
4056 advance_one_cycle (fence);
4057 memcpy (curr_state, FENCE_STATE (fence), dfa_state_size);
4065 we can issue. FENCE is the current fence. */
4067 invoke_reorder_hooks (fence_t fence)
4074 if (FENCE_ISSUED_INSNS (fence) == 0)
4088 &ready.n_ready, FENCE_CYCLE (fence));
4106 &ready.n_ready, FENCE_CYCLE (fence));
4116 &ready.n_ready, FENCE_CYCLE (fence));
4125 issue_more = FENCE_ISSUE_MORE (fence);
4252 number is ISSUE_MORE. FENCE and BEST_INSN are the current fence
4255 invoke_aftermath_hooks (fence_t fence, rtx_insn *best_insn, int issue_more)
4260 sel_dfa_new_cycle (best_insn, fence);
4264 memcpy (curr_state, FENCE_STATE (fence), dfa_state_size);
4268 memcpy (FENCE_STATE (fence), curr_state, dfa_state_size);
4301 get_expr_cost (expr_t expr, fence_t fence)
4307 if (!FENCE_STARTS_CYCLE_P (fence)
4320 return estimate_insn_cost (insn, FENCE_STATE (fence));
4326 choose_best_insn (fence_t fence, int privileged_n, int *index)
4332 cycle_issued_insns = FENCE_ISSUED_INSNS (fence);
4335 FENCE_STATE (fence), true, index);
4338 can_issue, FENCE_ISSUED_INSNS (fence));
4349 if (get_expr_cost (expr, fence) < 1)
4372 BNDS and FENCE are current boundaries and scheduling fence respectively.
4376 find_best_expr (av_set_t *av_vliw_ptr, blist_t bnds, fence_t fence,
4385 best = fill_ready_list (av_vliw_ptr, bnds, fence, pneed_stall);
4390 can_issue_more = invoke_reorder_hooks (fence);
4399 can_issue_more = choose_best_insn (fence, privileged_n, &index);
4414 can_issue_more = invoke_aftermath_hooks (fence, EXPR_INSN_RTX (best),
4427 sel_print ("; cycle %d\n", FENCE_CYCLE (fence));
4666 precedes a fence, assign that fence to *FENCE_TO_REWIND. */
4712 Notice if we are crossing a fence when taking PREV_INSN. */
4748 fence movement. Never mind because we pick up such pieces for
4827 remove_insns_that_need_bookkeeping (fence_t fence, av_set_t *av_ptr)
4848 BLOCK_FOR_INSN (FENCE_INSN (fence)))))
5031 /* Compute available instructions on BNDS. FENCE is the current fence. Write
5034 compute_av_set_on_boundaries (fence_t fence, blist_t bnds, av_set_t *av_vliw_p)
5064 gcc_assert (FENCE_INSN (fence) == BND_TO (bnd));
5065 FENCE_INSN (fence) = bnd_to;
5284 advance_state_on_fence (fence_t fence, insn_t insn)
5296 memcpy (temp_state, FENCE_STATE (fence), dfa_state_size);
5297 res = state_transition (FENCE_STATE (fence), insn);
5300 if (memcmp (temp_state, FENCE_STATE (fence), dfa_state_size))
5302 FENCE_ISSUED_INSNS (fence)++;
5305 if (FENCE_ISSUED_INSNS (fence) > issue_rate)
5314 if (!FENCE_STARTS_CYCLE_P (fence) && asm_p)
5315 advance_one_cycle (fence);
5319 debug_state (FENCE_STATE (fence));
5321 FENCE_STARTS_CYCLE_P (fence) = 0;
5322 FENCE_ISSUE_MORE (fence) = can_issue_more;
5329 update_fence_and_insn (fence_t fence, insn_t insn, int need_stall)
5333 /* First, reflect that something is scheduled on this fence. */
5334 asm_p = advance_state_on_fence (fence, insn);
5335 FENCE_LAST_SCHEDULED_INSN (fence) = insn;
5336 vec_safe_push (FENCE_EXECUTING_INSNS (fence), insn);
5339 FENCE_SCHED_NEXT (fence) = INSN_SCHED_NEXT (insn);
5343 FENCE_SCHED_NEXT (fence) = NULL;
5344 if (INSN_UID (insn) < FENCE_READY_TICKS_SIZE (fence))
5345 FENCE_READY_TICKS (fence) [INSN_UID (insn)] = 0;
5351 EXPR_ORIG_SCHED_CYCLE (INSN_EXPR (insn)) = FENCE_CYCLE (fence);
5352 INSN_AFTER_STALL_P (insn) = FENCE_AFTER_STALL_P (fence);
5353 INSN_SCHED_CYCLE (insn) = FENCE_CYCLE (fence);
5364 FENCE_AFTER_STALL_P (fence) = 0;
5366 advance_one_cycle (fence);
5368 /* Indicate that we've scheduled something on this fence. */
5369 FENCE_SCHEDULED_P (fence) = true;
5385 update_boundaries (fence_t fence, bnd_t bnd, insn_t insn, blist_t *bndsp,
5406 if (FENCE_INSN (fence) == insn && !sel_bb_end_p (insn))
5409 sel_print ("Updating fence insn from %i to %i\n",
5411 FENCE_INSN (fence) = succ;
5478 meet it later on the same fence. */
5492 stall_for_cycles (fence_t fence, int n)
5496 could_more = n > 1 || FENCE_ISSUED_INSNS (fence) < issue_rate;
5498 advance_one_cycle (fence);
5500 FENCE_AFTER_STALL_P (fence) = 1;
5507 fill_insns (fence_t fence, int seqno, ilist_t **scheduled_insns_tailpp)
5511 insn_t insn = FENCE_INSN (fence);
5515 INSN_UID (insn), FENCE_CYCLE (fence));
5517 blist_add (&bnds, insn, NULL, FENCE_DC (fence));
5519 set_target_context (FENCE_TC (fence));
5520 can_issue_more = FENCE_ISSUE_MORE (fence);
5535 compute_av_set_on_boundaries (fence, bnds, &av_vliw);
5536 remove_insns_that_need_bookkeeping (fence, &av_vliw);
5547 expr_vliw = find_best_expr (&av_vliw, bnds, fence, &need_stall);
5552 the fence and its boundary, which will not be available for
5558 stall_for_cycles (fence, need_stall);
5561 stall_for_cycles (fence, 1);
5580 boundaries per fence. */
5594 update_fence_and_insn (fence, insn, need_stall);
5595 bnds_tailp = update_boundaries (fence, bnd, insn, bndsp, bnds_tailp);
5619 gcc_assert (!FENCE_BNDS (fence));
5630 if (!ilist_is_in_p (FENCE_BNDS (fence), insn))
5631 ilist_add (&FENCE_BNDS (fence), insn);
5637 /* Update target context on the fence. */
5638 reset_target_context (FENCE_TC (fence), false);
5686 fence above, where we may choose to schedule an insn which is
6087 bookkeeping block scheduling fence
6098 scheduling fence. Also, note that av set of bookkeeping block
6103 bookkeeping block scheduling fence
6396 bookkeeping generated for another fence or for another path in current
7332 fence_t fence = NULL;
7337 /* Choose the next fence group to schedule.
7354 fence = f;
7363 gcc_assert (fence);
7367 fill_insns (fence, seqno, scheduled_insns_tailpp);
7368 FENCE_PROCESSED_P (fence) = true;
7407 fence_t fence = FLIST_FENCE (fences);
7410 if (!FENCE_BNDS (fence))
7412 /* This fence doesn't have any successors. */
7413 if (!FENCE_SCHEDULED_P (fence))
7415 /* Nothing was scheduled on this fence. */
7418 insn = FENCE_INSN (fence);
7431 max_time = MAX (max_time, FENCE_CYCLE (fence));