pan/bi: Use canonical name for segments

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
This commit is contained in:
Alyssa Rosenzweig 2020-11-27 13:28:33 -05:00 committed by Marge Bot
parent f47ec85ef6
commit 876f37ed59
5 changed files with 19 additions and 19 deletions

View File

@ -28,13 +28,13 @@
#include "bi_print_common.h"
static const char *
bi_segment_name(enum bi_segment seg)
bi_seg_name(enum bi_seg seg)
{
switch (seg) {
case BI_SEGMENT_NONE: return "global";
case BI_SEGMENT_WLS: return "wls";
case BI_SEGMENT_UBO: return "ubo";
case BI_SEGMENT_TLS: return "tls";
case BI_SEG_NONE: return "global";
case BI_SEG_WLS: return "wls";
case BI_SEG_UBO: return "ubo";
case BI_SEG_TL: return "tls";
default: return "invalid";
}
}
@ -335,7 +335,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
fprintf(fp, ".v%u", ins->vector_channels);
if (ins->segment)
fprintf(fp, ".%s", bi_segment_name(ins->segment));
fprintf(fp, ".%s", bi_seg_name(ins->segment));
if (ins->dest)
pan_print_alu_type(ins->dest_type, fp);

View File

@ -193,7 +193,7 @@ bi_spill(unsigned node, uint64_t offset, unsigned channels)
{
bi_instruction store = {
.type = BI_STORE,
.segment = BI_SEGMENT_TLS,
.segment = BI_SEG_TL,
.vector_channels = channels,
.src = {
node,
@ -216,7 +216,7 @@ bi_fill(unsigned node, uint64_t offset, unsigned channels)
{
bi_instruction load = {
.type = BI_LOAD,
.segment = BI_SEGMENT_TLS,
.segment = BI_SEG_TL,
.vector_channels = channels,
.dest = node,
.dest_type = nir_type_uint32,
@ -329,7 +329,7 @@ bi_spill_register(bi_context *ctx, unsigned node, unsigned offset)
if (!bi_has_arg(ins, node)) continue;
/* Don't rewrite spills themselves */
if (ins->segment == BI_SEGMENT_TLS) continue;
if (ins->segment == BI_SEG_TL) continue;
unsigned index = bi_make_temp(ctx);

View File

@ -500,7 +500,7 @@ bi_emit_ld_ubo(bi_context *ctx, nir_intrinsic_instr *instr)
bi_instruction ld = {
.type = BI_LOAD_UNIFORM,
.segment = BI_SEGMENT_UBO,
.segment = BI_SEG_UBO,
.vector_channels = instr->num_components,
.src_types = { nir_type_uint32, nir_type_uint32 },
.dest = pan_dest_index(&instr->dest),
@ -541,7 +541,7 @@ bi_emit_sysval(bi_context *ctx, nir_instr *instr,
bi_instruction load = {
.type = BI_LOAD_UNIFORM,
.segment = BI_SEGMENT_UBO,
.segment = BI_SEG_UBO,
.vector_channels = nr_components,
.src = { BIR_INDEX_CONSTANT, BIR_INDEX_ZERO },
.src_types = { nir_type_uint32, nir_type_uint32 },

View File

@ -170,23 +170,23 @@ enum bi_cond {
* instructions for address calculation, and directly in SEG_ADD/SEG_SUB
* instructions. */
enum bi_segment {
enum bi_seg {
/* No segment (use global addressing, offset from GPU VA 0x0) */
BI_SEGMENT_NONE = 1,
BI_SEG_NONE = 1,
/* Within workgroup local memory (shared memory). Relative to
* wls_base_pointer in the draw's thread storage descriptor */
BI_SEGMENT_WLS = 2,
BI_SEG_WLS = 2,
/* Within one of the bound uniform buffers. Low 32-bits are the index
* within the uniform buffer; high 32-bits are the index of the uniform
* buffer itself. Relative to the uniform_array_pointer indexed within
* the draw's uniform remap table indexed by the high 32-bits. */
BI_SEGMENT_UBO = 4,
BI_SEG_UBO = 4,
/* Within thread local storage (for spilling). Relative to
* tls_base_pointer in the draw's thread storage descriptor */
BI_SEGMENT_TLS = 7
BI_SEG_TL = 7
};
/* Opcodes within a class */
@ -375,7 +375,7 @@ typedef struct {
enum bi_cond cond;
/* For memory ops, base address */
enum bi_segment segment;
enum bi_seg segment;
/* Can we spill the value written here? Used to prevent
* useless double fills */

View File

@ -204,8 +204,8 @@ def pack_seg(mod, opts, body, pack_exprs):
body.append('assert(ins->segment);')
return 'ins->segment'
elif opts == ['none', 'wls']:
body.append('assert(ins->segment == BI_SEGMENT_NONE || ins->segment == BI_SEGMENT_WLS);')
return 'ins->segment == BI_SEGMENT_WLS ? 1 : 0'
body.append('assert(ins->segment == BI_SEG_NONE || ins->segment == BI_SEG_WLS);')
return 'ins->segment == BI_SEG_WLS ? 1 : 0'
else:
assert(False)