2
* Copyright (C) 2021 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>
27
#ifndef __VALHALL_COMPILER_H
28
#define __VALHALL_COMPILER_H
37
bool va_validate_fau(bi_instr *I);
38
void va_validate(FILE *fp, bi_context *ctx);
39
void va_repair_fau(bi_builder *b, bi_instr *I);
40
void va_fuse_add_imm(bi_instr *I);
41
void va_lower_constants(bi_context *ctx, bi_instr *I);
42
void va_lower_isel(bi_instr *I);
43
uint64_t va_pack_instr(const bi_instr *I);
45
static inline unsigned
46
va_fau_page(enum bir_fau value)
48
/* Uniform slots of FAU have a 7-bit index. The top 2-bits are the page; the
49
* bottom 5-bits are specified in the source.
51
if (value & BIR_FAU_UNIFORM) {
52
unsigned slot = value & ~BIR_FAU_UNIFORM;
53
unsigned page = slot >> 5;
59
/* Special indices are also paginated */
66
case BIR_FAU_PROGRAM_COUNTER:
73
static inline unsigned
74
va_select_fau_page(const bi_instr *I)
76
bi_foreach_src(I, s) {
77
if (I->src[s].type == BI_INDEX_FAU)
78
return va_fau_page((enum bir_fau) I->src[s].value);
84
/** Cycle model for Valhall. Results need to be normalized */
86
/** Counts per pipe */
87
unsigned fma, cvt, sfu, v, ls, t;
91
va_count_instr_stats(bi_instr *I, struct va_stats *stats);