Lines Matching refs:ctx

76 emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction* instr)
80 ctx.constaddrs[instr->operands[0].constantValue()].getpc_end = out.size() + 1;
85 ctx.constaddrs[instr->operands[2].constantValue()].add_literal = out.size() + 1;
94 uint32_t opcode = ctx.opcode[(int)instr->opcode];
106 aco_err(ctx.program, outmem);
126 assert(ctx.gfx_level >= GFX10);
127 assert(ctx.subvector_begin_pos == -1);
128 ctx.subvector_begin_pos = out.size();
130 assert(ctx.gfx_level >= GFX10);
131 assert(ctx.subvector_begin_pos != -1);
133 out[ctx.subvector_begin_pos] |= (out.size() - ctx.subvector_begin_pos);
135 sopk.imm = (uint16_t)(ctx.subvector_begin_pos - (int)out.size());
136 ctx.subvector_begin_pos = -1;
173 ctx.branches.emplace_back(out.size(), &sopp);
184 if (ctx.gfx_level <= GFX7) {
207 if (ctx.gfx_level <= GFX9) {
220 if (ctx.gfx_level <= GFX9) {
224 if (ctx.gfx_level == GFX9) {
240 uint32_t soffset = ctx.gfx_level >= GFX10
246 if (ctx.gfx_level <= GFX9) {
261 assert(ctx.gfx_level >= GFX9); /* GFX8 and below don't support specifying a constant
308 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
310 } else if (ctx.gfx_level >= GFX10) {
331 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
353 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
385 assert(!mubuf.addr64 || ctx.gfx_level <= GFX7);
386 if (ctx.gfx_level == GFX6 || ctx.gfx_level == GFX7)
389 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
392 } else if (ctx.gfx_level >= GFX10) {
398 if (ctx.gfx_level <= GFX7 || ctx.gfx_level >= GFX10) {
414 uint32_t img_format = ac_get_tbuffer_format(ctx.gfx_level, mtbuf.dfmt, mtbuf.nfmt);
417 assert(!mtbuf.dlc || ctx.gfx_level >= GFX10);
425 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
443 if (ctx.gfx_level >= GFX10) {
452 assert(!nsa_dwords || ctx.gfx_level >= GFX10);
463 if (ctx.gfx_level <= GFX9) {
487 assert(!mimg.d16 || ctx.gfx_level >= GFX9);
489 if (ctx.gfx_level >= GFX10) {
510 if (ctx.gfx_level == GFX9 || ctx.gfx_level >= GFX11) {
516 } else if (ctx.gfx_level <= GFX8 || instr->isFlat()) {
532 if (ctx.gfx_level >= GFX10) {
545 assert(ctx.gfx_level >= GFX10 || instr->operands[1].physReg() != 0x7F);
549 ctx.gfx_level >= GFX10) { /* SADDR is actually used with FLAT on GFX10 */
553 if (ctx.gfx_level <= GFX9 ||
566 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9) {
597 if (ctx.gfx_level == GFX8 || ctx.gfx_level == GFX9)
608 if (ctx.gfx_level <= GFX9) {
610 } else if (ctx.gfx_level >= GFX10) {
616 if (ctx.gfx_level <= GFX7) {
650 if (ctx.gfx_level == GFX9) {
652 } else if (ctx.gfx_level >= GFX10) {
675 assert(ctx.gfx_level >= GFX8);
682 emit_instruction(ctx, out, instr);
689 if (ctx.gfx_level >= GFX10)
697 assert(ctx.gfx_level >= GFX10);
704 emit_instruction(ctx, out, instr);
711 assert(ctx.gfx_level >= GFX8 && ctx.gfx_level < GFX11);
718 emit_instruction(ctx, out, instr);
771 emit_block(asm_context& ctx, std::vector<uint32_t>& out, Block& block)
780 emit_instruction(ctx, out, instr.get());
789 fix_exports(asm_context& ctx, std::vector<uint32_t>& out, Program* program)
837 insert_code(asm_context& ctx, std::vector<uint32_t>& out, unsigned insert_before,
843 for (Block& block : ctx.program->blocks) {
849 auto branch_it = std::find_if(ctx.branches.begin(), ctx.branches.end(),
854 for (; branch_it != ctx.branches.end(); ++branch_it)
858 for (auto& constaddr : ctx.constaddrs) {
868 fix_branches_gfx10(asm_context& ctx, std::vector<uint32_t>& out)
877 ctx.branches.begin(), ctx.branches.end(),
878 [&ctx](const auto& branch) -> bool {
879 return ((int)ctx.program->blocks[branch.second->block].offset - branch.first - 1) ==
883 gfx10_3f_bug = buggy_branch_it != ctx.branches.end();
888 insert_code(ctx, out, buggy_branch_it->first + 1, 1, &s_nop_0);
894 emit_long_jump(asm_context& ctx, SOPP_instruction* branch, bool backwards,
897 Builder bld(ctx.program);
919 emit_instruction(ctx, out, instr.get());
924 emit_instruction(ctx, out, instr.get());
928 emit_instruction(ctx, out, instr.get());
935 emit_instruction(ctx, out, instr.get());
937 emit_instruction(ctx, out, instr.get());
942 emit_instruction(ctx, out, instr.get());
946 fix_branches(asm_context& ctx, std::vector<uint32_t>& out)
952 if (ctx.gfx_level == GFX10)
953 fix_branches_gfx10(ctx, out);
955 for (std::pair<int, SOPP_instruction*>& branch : ctx.branches) {
956 int offset = (int)ctx.program->blocks[branch.second->block].offset - branch.first - 1;
960 ctx.program->blocks[branch.second->block].offset < (unsigned)branch.first;
961 emit_long_jump(ctx, branch.second, backwards, long_jump);
964 insert_code(ctx, out, branch.first + 1, long_jump.size() - 1, long_jump.data() + 1);
972 offset = (int)ctx.program->blocks[branch.second->block].offset - after_getpc;
983 fix_constaddrs(asm_context& ctx, std::vector<uint32_t>& out)
985 for (auto& constaddr : ctx.constaddrs) {
994 asm_context ctx(program);
998 fix_exports(ctx, code, program);
1002 emit_block(ctx, code, block);
1005 fix_branches(ctx, code);
1017 fix_constaddrs(ctx, code);