2 * Copyright (C) 2020 Collabora Ltd.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * Authors (Collabora):
24 * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
29 /* Eventually, we'll need a proper scheduling, grouping instructions
30 * into clauses and ordering/assigning grouped instructions to the
31 * appropriate FMA/ADD slots. Right now we do the dumbest possible
32 * thing just to have the scheduler stubbed out so we can focus on
36 bi_schedule(bi_context
*ctx
)
42 bi_foreach_block(ctx
, block
) {
43 list_inithead(&block
->clauses
);
45 bi_foreach_instr_in_block(block
, ins
) {
46 unsigned props
= bi_class_props
[ins
->type
];
48 bi_clause
*u
= rzalloc(ctx
, bi_clause
);
51 if (props
& BI_SCHED_FMA
)
52 u
->bundles
[0].fma
= ins
;
54 u
->bundles
[0].add
= ins
;
56 u
->scoreboard_id
= ids
++;
61 u
->dependencies
|= (1 << last_id
);
64 last_id
= u
->scoreboard_id
;
65 u
->back_to_back
= true;
66 u
->data_register_write_barrier
= true;
68 u
->constant_count
= 1;
69 u
->constants
[0] = ins
->constant
.u64
;
71 list_addtail(&u
->link
, &block
->clauses
);
74 block
->scheduled
= true;