Lines Matching defs:instr
246 get_vmem_type(Instruction* instr)
248 if (instr->opcode == aco_opcode::image_bvh64_intersect_ray)
250 else if (instr->isMIMG() && !instr->operands[1].isUndefined() &&
251 instr->operands[1].regClass() == s4)
253 else if (instr->isVMEM() || instr->isScratch() || instr->isGlobal())
259 check_instr(wait_ctx& ctx, wait_imm& wait, Instruction* instr)
261 for (const Operand op : instr->operands) {
276 for (const Definition& def : instr->definitions) {
286 uint8_t vmem_type = get_vmem_type(instr);
292 if (instr->isDS() &&
293 (it->second.events & lgkm_events) == (instr->ds().gds ? event_gds : event_lds))
302 parse_wait_instr(wait_ctx& ctx, wait_imm& imm, Instruction* instr)
304 if (instr->opcode == aco_opcode::s_waitcnt_vscnt &&
305 instr->definitions[0].physReg() == sgpr_null) {
306 imm.vs = std::min<uint8_t>(imm.vs, instr->sopk().imm);
308 } else if (instr->opcode == aco_opcode::s_waitcnt) {
309 imm.combine(wait_imm(ctx.gfx_level, instr->sopp().imm));
360 kill(wait_imm& imm, Instruction* instr, wait_ctx& ctx, memory_sync_info sync_info)
362 if (instr->opcode == aco_opcode::s_setpc_b64 || (debug_flags & DEBUG_FORCE_WAITCNT)) {
371 check_instr(ctx, imm, instr);
376 if (ctx.lgkm_cnt && instr->opcode == aco_opcode::s_dcache_wb) {
381 if (ctx.gfx_level >= GFX10 && instr->isSMEM()) {
388 if (ctx.pending_s_buffer_store && !instr->smem().definitions.empty() &&
389 !instr->smem().sync.can_reorder()) {
394 if (ctx.program->early_rast && instr->opcode == aco_opcode::exp) {
395 if (instr->exp().dest >= V_008DFC_SQ_EXP_POS && instr->exp().dest < V_008DFC_SQ_EXP_PRIM) {
409 if (instr->opcode == aco_opcode::p_barrier)
410 perform_barrier(ctx, imm, instr->barrier().sync, semantic_acqrel);
620 gen(Instruction* instr, wait_ctx& ctx)
622 switch (instr->format) {
624 Export_instruction& exp_instr = instr->exp();
647 FLAT_instruction& flat = instr->flat();
648 if (ctx.gfx_level < GFX10 && !instr->definitions.empty())
653 if (!instr->definitions.empty())
654 insert_wait_entry(ctx, instr->definitions[0], event_flat);
658 SMEM_instruction& smem = instr->smem();
661 if (!instr->definitions.empty())
662 insert_wait_entry(ctx, instr->definitions[0], event_smem);
669 DS_instruction& ds = instr->ds();
674 if (!instr->definitions.empty())
675 insert_wait_entry(ctx, instr->definitions[0], ds.gds ? event_gds : event_lds);
678 for (const Operand& op : instr->operands)
690 !instr->definitions.empty() || ctx.gfx_level < GFX10 ? event_vmem : event_vmem_store;
691 update_counters(ctx, ev, get_sync_info(instr));
693 if (!instr->definitions.empty())
694 insert_wait_entry(ctx, instr->definitions[0], ev, get_vmem_type(instr));
696 if (ctx.gfx_level == GFX6 && instr->format != Format::MIMG && instr->operands.size() == 4) {
698 insert_wait_entry(ctx, instr->operands[3], event_vmem_gpr_lock);
699 } else if (ctx.gfx_level == GFX6 && instr->isMIMG() && !instr->operands[2].isUndefined()) {
701 insert_wait_entry(ctx, instr->operands[2], event_vmem_gpr_lock);
707 if (instr->opcode == aco_opcode::s_sendmsg || instr->opcode == aco_opcode::s_sendmsghalt)
744 for (aco_ptr<Instruction>& instr : block.instructions) {
745 bool is_wait = parse_wait_instr(ctx, queued_imm, instr.get());
747 memory_sync_info sync_info = get_sync_info(instr.get());
748 kill(queued_imm, instr.get(), ctx, sync_info);
750 gen(instr.get(), ctx);
752 if (instr->format != Format::PSEUDO_BARRIER && !is_wait) {
756 new_instructions.emplace_back(std::move(instr));