Lines Matching refs:ctx

11 void ir_print_proto(const ir_ctx *ctx, ir_ref func_proto, FILE *f)  in ir_print_proto()  argument
16 const ir_proto_t *proto = (const ir_proto_t *)ir_get_str(ctx, func_proto); in ir_print_proto()
41 static void ir_save_dessa_moves(const ir_ctx *ctx, int b, ir_block *bb, FILE *f) in ir_save_dessa_moves() argument
50 succ = ctx->cfg_edges[bb->successors]; in ir_save_dessa_moves()
51 succ_bb = &ctx->cfg_blocks[succ]; in ir_save_dessa_moves()
53 use_list = &ctx->use_lists[succ_bb->start]; in ir_save_dessa_moves()
54 k = ir_phi_input_number(ctx, succ_bb, b); in ir_save_dessa_moves()
56 for (i = 0, p = &ctx->use_edges[use_list->refs]; i < use_list->count; i++, p++) { in ir_save_dessa_moves()
58 use_insn = &ctx->ir_base[use_ref]; in ir_save_dessa_moves()
63 } else if (ctx->vregs[input] != ctx->vregs[use_ref]) { in ir_save_dessa_moves()
64 fprintf(f, "\t# DESSA MOV d_%d {R%d}", input, ctx->vregs[input]); in ir_save_dessa_moves()
68 if (ctx->regs) { in ir_save_dessa_moves()
69 int8_t *regs = ctx->regs[use_ref]; in ir_save_dessa_moves()
72 fprintf(f, " {%%%s%s}", ir_reg_name(IR_REG_NUM(reg), ctx->ir_base[input].type), in ir_save_dessa_moves()
76 fprintf(f, " -> d_%d {R%d}", use_ref, ctx->vregs[use_ref]); in ir_save_dessa_moves()
77 if (ctx->regs) { in ir_save_dessa_moves()
78 int8_t reg = ctx->regs[use_ref][0]; in ir_save_dessa_moves()
80 fprintf(f, " {%%%s%s}", ir_reg_name(IR_REG_NUM(reg), ctx->ir_base[use_ref].type), in ir_save_dessa_moves()
89 void ir_save(const ir_ctx *ctx, uint32_t save_flags, FILE *f) in ir_save() argument
97 for (i = IR_UNUSED + 1, insn = ctx->ir_base - i; i < ctx->consts_count; i++, insn--) { in ir_save()
100 fprintf(f, "func %s", ir_get_str(ctx, insn->val.name)); in ir_save()
101 ir_print_proto(ctx, insn->proto, f); in ir_save()
103 fprintf(f, "sym(%s)", ir_get_str(ctx, insn->val.name)); in ir_save()
106 ir_print_const(ctx, insn, f, true); in ir_save()
107 ir_print_proto(ctx, insn->proto, f); in ir_save()
109 ir_print_const(ctx, insn, f, true); in ir_save()
114 for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) { in ir_save()
118 && ctx->cfg_map in ir_save()
119 && (int32_t)ctx->cfg_map[i] > 0 /* the node may be scheduled incompletely */ in ir_save()
120 && ctx->cfg_blocks[ctx->cfg_map[i]].start == i) { in ir_save()
121 uint32_t b = ctx->cfg_map[i]; in ir_save()
122 ir_block *bb = &ctx->cfg_blocks[b]; in ir_save()
146 fprintf(f, ", pred(%d)=[BB%d", bb->predecessors_count, ctx->cfg_edges[bb->predecessors]); in ir_save()
148 fprintf(f, ", BB%d", ctx->cfg_edges[bb->predecessors + i]); in ir_save()
155 fprintf(f, ", succ(%d)=[BB%d", bb->successors_count, ctx->cfg_edges[bb->successors]); in ir_save()
157 fprintf(f, ", BB%d", ctx->cfg_edges[bb->successors + i]); in ir_save()
170 if (ctx->vregs && ctx->vregs[i]) { in ir_save()
171 fprintf(f, " {R%d}", ctx->vregs[i]); in ir_save()
173 if (ctx->regs) { in ir_save()
174 int8_t reg = ctx->regs[i][0]; in ir_save()
188 if (ctx->vregs && ctx->vregs[i]) { in ir_save()
189 fprintf(f, " {R%d}", ctx->vregs[i]); in ir_save()
191 if (ctx->regs) { in ir_save()
192 int8_t reg = ctx->regs[i][0]; in ir_save()
203 n = ir_operands_count(ctx, insn); in ir_save()
227 if (ctx->vregs && ref > 0 && ctx->vregs[ref]) { in ir_save()
228 fprintf(f, " {R%d}", ctx->vregs[ref]); in ir_save()
230 if (ctx->regs) { in ir_save()
231 int8_t *regs = ctx->regs[i]; in ir_save()
234 fprintf(f, " {%%%s%s}", ir_reg_name(IR_REG_NUM(reg), ctx->ir_base[ref].type), in ir_save()
248 fprintf(f, "%s\"%s\"", first ? "(" : ", ", ir_get_str(ctx, ref)); in ir_save()
253 ir_print_proto(ctx, ref, f); in ir_save()
280 …if (((flags & IR_OP_FLAG_DATA) || ((flags & IR_OP_FLAG_MEM) && insn->type != IR_VOID)) && ctx->bin… in ir_save()
281 ir_ref var = ir_binding_find(ctx, i); in ir_save()
290 && ctx->cfg_map in ir_save()
291 && ctx->cfg_map[i] > 0) { /* the node may be scheduled incompletely */ in ir_save()
296 fprintf(f, " BLOCK=BB%d;", ctx->cfg_map[i]); in ir_save()
300 && ctx->rules) { in ir_save()
301 uint32_t rule = ctx->rules[i]; in ir_save()
327 && ctx->use_lists in ir_save()
328 && ctx->use_lists[i].count) { in ir_save()
329 ir_use_list *use_list = &ctx->use_lists[i]; in ir_save()
331 ir_ref *p = ctx->use_edges + use_list->refs; in ir_save()
346 && ctx->cfg_map in ir_save()
347 && ctx->cfg_map[i] in ir_save()
348 && ctx->cfg_blocks[ctx->cfg_map[i]].end == i) { in ir_save()
349 uint32_t b = ctx->cfg_map[i]; in ir_save()
350 ir_block *bb = &ctx->cfg_blocks[b]; in ir_save()
352 ir_save_dessa_moves(ctx, b, bb, f); in ir_save()