nir: Add nir_address_format_32bit_offset

This is a simple 32-bit address which is not a global address.  Gives
us a format that don't use 0 as its null pointer value.  We will need
this in anv to represent nir_var_mem_shared addresses.
Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen's avatarBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
parent bdaf4110
......@@ -3113,6 +3113,11 @@ typedef enum {
*/
nir_address_format_32bit_index_offset,
/**
* An address format which is a simple 32-bit offset.
*/
nir_address_format_32bit_offset,
/**
* An address format representing a purely logical addressing model. In
* this model, all deref chains must be complete from the dereference
......@@ -3131,6 +3136,7 @@ nir_address_format_bit_size(nir_address_format addr_format)
case nir_address_format_64bit_global: return 64;
case nir_address_format_64bit_bounded_global: return 32;
case nir_address_format_32bit_index_offset: return 32;
case nir_address_format_32bit_offset: return 32;
case nir_address_format_logical: return 32;
}
unreachable("Invalid address format");
......@@ -3144,6 +3150,7 @@ nir_address_format_num_components(nir_address_format addr_format)
case nir_address_format_64bit_global: return 1;
case nir_address_format_64bit_bounded_global: return 4;
case nir_address_format_32bit_index_offset: return 2;
case nir_address_format_32bit_offset: return 1;
case nir_address_format_logical: return 1;
}
unreachable("Invalid address format");
......
......@@ -604,6 +604,7 @@ build_addr_iadd(nir_builder *b, nir_ssa_def *addr,
switch (addr_format) {
case nir_address_format_32bit_global:
case nir_address_format_64bit_global:
case nir_address_format_32bit_offset:
assert(addr->num_components == 1);
return nir_iadd(b, addr, offset);
......@@ -675,6 +676,7 @@ addr_to_global(nir_builder *b, nir_ssa_def *addr,
nir_u2u64(b, nir_channel(b, addr, 3)));
case nir_address_format_32bit_index_offset:
case nir_address_format_32bit_offset:
case nir_address_format_logical:
unreachable("Cannot get a 64-bit address with this address format");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment