nir/algebraic: Mark the automaton's filter tables as const.

Moves it to .rodata instead of .data.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13987>
This commit is contained in:
Emma Anholt 2021-12-01 14:20:55 -08:00 committed by Marge Bot
parent 45a8d11b6e
commit a29b54f014
2 changed files with 9 additions and 4 deletions

View file

@ -1085,16 +1085,20 @@ static const struct transform ${pass_name}_state${state_id}_xforms[] = {
static const struct per_op_table ${pass_name}_pass_op_table[nir_num_search_ops] = {
% for op in automaton.opcodes:
[${get_c_opcode(op)}] = {
.filter = (uint16_t []) {
% if all(e == 0 for e in automaton.filter[op]):
.filter = NULL,
% else:
.filter = (const uint16_t []) {
% for e in automaton.filter[op]:
${e},
% endfor
},
% endif
<%
num_filtered = len(automaton.rep[op])
%>
.num_filtered_states = ${num_filtered},
.table = (uint16_t []) {
.table = (const uint16_t []) {
<%
num_srcs = len(next(iter(automaton.table[op])))
%>

View file

@ -829,8 +829,9 @@ nir_algebraic_automaton(nir_instr *instr, struct util_dynarray *states,
unsigned index = 0;
for (unsigned i = 0; i < nir_op_infos[op].num_inputs; i++) {
index *= tbl->num_filtered_states;
index += tbl->filter[*util_dynarray_element(states, uint16_t,
alu->src[i].src.ssa->index)];
if (tbl->filter)
index += tbl->filter[*util_dynarray_element(states, uint16_t,
alu->src[i].src.ssa->index)];
}
uint16_t *state = util_dynarray_element(states, uint16_t,