41static void ir_save_dessa_moves(
const ir_ctx *ctx,
int b,
ir_block *bb, FILE *f)
46 ir_ref k, i, *
p, use_ref, input;
58 use_insn = &ctx->
ir_base[use_ref];
59 if (use_insn->op == IR_PHI) {
62 fprintf(f,
"\t# DESSA MOV c_%d", -input);
63 }
else if (ctx->
vregs[input] != ctx->
vregs[use_ref]) {
64 fprintf(f,
"\t# DESSA MOV d_%d {R%d}", input, ctx->
vregs[input]);
69 int8_t *regs = ctx->
regs[use_ref];
76 fprintf(f,
" -> d_%d {R%d}", use_ref, ctx->
vregs[use_ref]);
78 int8_t reg = ctx->
regs[use_ref][0];
97 for (i =
IR_UNUSED + 1, insn = ctx->
ir_base - i; i < ctx->consts_count; i++, insn--) {
99 if (insn->op == IR_FUNC) {
102 }
else if (insn->op == IR_SYM) {
104 }
else if (insn->op == IR_FUNC_ADDR) {
119 && (int32_t)ctx->
cfg_map[i] > 0
174 int8_t reg = ctx->
regs[i][0];
192 int8_t reg = ctx->
regs[i][0];
204 if ((insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) &&
n != 2) {
206 }
else if ((insn->op == IR_CALL || insn->op == IR_TAILCALL) &&
n != 2) {
208 }
else if (insn->op == IR_PHI &&
n != 3) {
210 }
else if (insn->op == IR_SNAPSHOT) {
214 for (
j = 1,
p = insn->ops + 1;
j <=
n;
j++,
p++) {
222 fprintf(f,
"%sc_%d", first ?
"(" :
", ", -ref);
224 fprintf(f,
"%sd_%d", first ?
"(" :
", ", ref);
227 if (ctx->
vregs && ref > 0 && ctx->
vregs[ref]) {
231 int8_t *regs = ctx->
regs[i];
232 int8_t reg = regs[
j];
244 fprintf(f,
"%sl_%d", first ?
"(" :
", ", ref);
252 fprintf(f,
"%sfunc ", first ?
"(" :
", ");
261 fprintf(f,
"%s%d", first ?
"(" :
", ", ref);
266 fprintf(f,
"%s%d", first ?
"(" :
", ", ref);
270 fprintf(f,
"%snull", first ?
"(" :
", ");
284 fprintf(f,
" # BIND(0x%x);", -var);
301 uint32_t rule = ctx->
rules[i];
337 fprintf(f,
" USE_LIST(%d)=[%05d",
n, *
p);
338 for (
p++,
n--;
n;
p++,
n--) {
352 ir_save_dessa_moves(ctx, b, bb, f);
fprintf($stream, string $format, mixed ... $values)
ir_ref ir_binding_find(const ir_ctx *ctx, ir_ref ref)
const char * ir_type_cname[IR_LAST_TYPE]
const char * ir_get_str(const ir_ctx *ctx, ir_ref idx)
const uint32_t ir_op_flags[IR_LAST_OP]
void ir_print_const(const ir_ctx *ctx, const ir_insn *insn, FILE *f, bool quoted)
const char * ir_op_name[IR_LAST_OP]
#define IR_REG_SPILL_STORE
IR_ALWAYS_INLINE ir_ref ir_insn_op(const ir_insn *insn, int32_t n)
struct _ir_proto_t ir_proto_t
#define IR_IS_CONST_REF(ref)
#define IR_REG_SPILL_LOAD
const char * ir_reg_name(int8_t reg, ir_type type)
#define IR_REG_SPILL_SPECIAL
#define IR_SAVE_USE_LISTS
struct _ir_use_list ir_use_list
struct _ir_block ir_block
#define IR_OPND_CONTROL_REF
IR_ALWAYS_INLINE uint32_t ir_phi_input_number(const ir_ctx *ctx, const ir_block *bb, uint32_t from)
#define IR_OPND_CONTROL_DEP
#define IR_BB_DESSA_MOVES
const char * ir_rule_name[]
IR_ALWAYS_INLINE ir_ref ir_operands_count(const ir_ctx *ctx, const ir_insn *insn)
#define IR_OPND_KIND(flags, i)
#define IR_BB_UNREACHABLE
IR_ALWAYS_INLINE uint32_t ir_insn_inputs_to_len(uint32_t inputs_count)
#define IR_OP_FLAG_CONTROL
#define IR_BB_LOOP_HEADER
#define IR_IS_REF_OPND_KIND(kind)
void ir_print_proto(const ir_ctx *ctx, ir_ref func_proto, FILE *f)
void ir_save(const ir_ctx *ctx, uint32_t save_flags, FILE *f)
uint32_t successors_count
uint32_t predecessors_count