% endfor
% for state_id, state_xforms in enumerate(automaton.state_patterns):
+% if state_xforms: # avoid emitting a 0-length array for MSVC
static const struct transform ${pass_name}_state${state_id}_xforms[] = {
% for i in state_xforms:
{ ${xforms[i].search.c_ptr(cache)}, ${xforms[i].replace.c_value_ptr(cache)}, ${xforms[i].condition_index} },
% endfor
};
+% endif
% endfor
static const struct per_op_table ${pass_name}_table[nir_num_search_ops] = {
switch (states[alu->dest.dest.ssa.index]) {
% for i in range(len(automaton.state_patterns)):
case ${i}:
+ % if automaton.state_patterns[i]:
for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_state${i}_xforms); i++) {
const struct transform *xform = &${pass_name}_state${i}_xforms[i];
if (condition_flags[xform->condition_offset] &&
break;
}
}
+ % endif
break;
% endfor
default: assert(0);