Home | History | Annotate | Download | only in nir

Lines Matching defs:phi

31  * Implements a pass that lowers vector phi nodes to scalar phi nodes when
39 /* Hash table marking which phi nodes are scalarizable. The key is
40 * pointers to phi instructions and the entry is either NULL for not
47 should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state *state);
74 /* A phi is scalarizable if we're going to lower it */
110 * Determines if the given phi node should be lowered. The only phi nodes
114 * The reason for this comes down to coalescing. Since phi sources can't
116 * before the phi. The choice then becomes between movs to pick off
117 * components for a scalar phi or potentially movs to recombine components
118 * for a vector phi. The problem is that the movs generated to pick off
124 * phi, the situation is much better. In this case, if the SSA def is
125 * generated in the predecessor block to the corresponding phi source, the
131 should_lower_phi(nir_phi_instr *phi, struct lower_phis_to_scalar_state *state)
134 if (phi->dest.ssa.num_components == 1)
137 struct hash_entry *entry = _mesa_hash_table_search(state->phi_table, phi);
145 entry = _mesa_hash_table_insert(state->phi_table, phi, (void *)(intptr_t)1);
149 nir_foreach_phi_src(src, phi) {
155 /* The hash table entry for 'phi' may have changed while recursing the
157 entry = _mesa_hash_table_search(state->phi_table, phi);
171 /* Find the last phi node in the block */
180 /* We have to handle the phi nodes in their own pass due to the way
187 nir_phi_instr *phi = nir_instr_as_phi(instr);
189 if (!should_lower_phi(phi, state))
192 unsigned bit_size = phi->dest.ssa.bit_size;
199 switch (phi->dest.ssa.num_components) {
208 phi->dest.ssa.num_components,
210 vec->dest.write_mask = (1 << phi->dest.ssa.num_components) - 1;
212 for (unsigned i = 0; i < phi->dest.ssa.num_components; i++) {
215 phi->dest.ssa.bit_size, NULL);
219 nir_foreach_phi_src(src, phi) {
242 nir_instr_insert_before(&phi->instr, &new_phi->instr);
247 nir_ssa_def_rewrite_uses(&phi->dest.ssa,
250 ralloc_steal(state->dead_ctx, phi);
251 nir_instr_remove(&phi->instr);
256 * scalarized phi nodes before their non-scalarized version so that's
258 * the last phi node so once we get here, we can't trust even the
290 /** A pass that lowers vector phi nodes to scalar
292 * This pass loops through the blocks and lowers looks for vector phi nodes
293 * it can lower to scalar phi nodes. Not all phi nodes are lowered. For