📄 minimips.c
字号:
}static void _closure_acon(NODEPTR_TYPE a, int c) { struct _state *p = STATE_LABEL(a); if (c + 0 < p->cost[_addr_NT]) { p->cost[_addr_NT] = c + 0; p->rule._addr = 4; _closure_addr(a, c + 0); }}static void _closure_addr(NODEPTR_TYPE a, int c) { struct _state *p = STATE_LABEL(a); if (c + 1 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 1; p->rule._reg = 7; _closure_reg(a, c + 1); }}static void _label(NODEPTR_TYPE a) { int c; struct _state *p; if (!a) fatal("_label", "Null tree\n", 0); STATE_LABEL(a) = p = allocate(sizeof *p, FUNC); p->rule._stmt = 0; p->cost[1] = p->cost[2] = p->cost[3] = p->cost[4] = p->cost[5] = p->cost[6] = p->cost[7] = p->cost[8] = 0x7fff; switch (OP_LABEL(a)) { case 41: /* ARGB */ _label(LEFT_CHILD(a)); if ( /* stmt: ARGB(INDIRB(reg)) */ LEFT_CHILD(a)->op == 73 /* INDIRB */ ) { c = ((struct _state *)(LEFT_CHILD(LEFT_CHILD(a))->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 45; } } break; case 57: /* ASGNB */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNB(reg,INDIRB(reg)) */ RIGHT_CHILD(a)->op == 73 /* INDIRB */ ) { c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + ((struct _state *)(LEFT_CHILD(RIGHT_CHILD(a))->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 46; } } break; case 73: /* INDIRB */ _label(LEFT_CHILD(a)); break; case 216: /* CALLV */ _label(LEFT_CHILD(a)); /* stmt: CALLV(ar) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_ar_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 35; } break; case 217: /* CALLB */ break; case 233: /* LOADB */ break; case 248: /* RETV */ _label(LEFT_CHILD(a)); /* stmt: RETV(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 40; } break; case 584: /* JUMPV */ _label(LEFT_CHILD(a)); /* stmt: JUMPV(acon) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_acon_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 15; } /* stmt: JUMPV(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 16; } break; case 600: /* LABELV */ /* stmt: LABELV */ if (0 + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = 0 + 0; p->rule._stmt = 14; } break; case 711: /* VREGP */ break; case 1045: /* CNSTI1 */ /* con: CNSTI1 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 1; _closure_con(a, 0 + 0); } /* reg: CNSTI1 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 8; _closure_reg(a, c + 0); } break; case 1046: /* CNSTU1 */ /* con: CNSTU1 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 2; _closure_con(a, 0 + 0); } /* reg: CNSTU1 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 10; _closure_reg(a, c + 0); } break; case 1077: /* ASGNI1 */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNI1(VREGP,reg) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { c = ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 0; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 1; } } /* stmt: ASGNI1(addr,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 8; } break; case 1078: /* ASGNU1 */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNU1(VREGP,reg) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { c = ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 0; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 2; } } /* stmt: ASGNU1(addr,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 9; } break; case 1093: /* INDIRI1 */ _label(LEFT_CHILD(a)); if ( /* reg: INDIRI1(VREGP) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { if (mayrecalc(a)) { struct _state *q = a->syms[RX]->u.t.cse->x.state; if (q->cost[_stmt_NT] == 0) { p->cost[_stmt_NT] = 0; p->rule._stmt = q->rule._stmt; } if (q->cost[_reg_NT] == 0) { p->cost[_reg_NT] = 0; p->rule._reg = q->rule._reg; } if (q->cost[_con_NT] == 0) { p->cost[_con_NT] = 0; p->rule._con = q->rule._con; } if (q->cost[_acon_NT] == 0) { p->cost[_acon_NT] = 0; p->rule._acon = q->rule._acon; } if (q->cost[_addr_NT] == 0) { p->cost[_addr_NT] = 0; p->rule._addr = q->rule._addr; } if (q->cost[_rc_NT] == 0) { p->cost[_rc_NT] = 0; p->rule._rc = q->rule._rc; } if (q->cost[_ar_NT] == 0) { p->cost[_ar_NT] = 0; p->rule._ar = q->rule._ar; } if (q->cost[_magic_addr_NT] == 0) { p->cost[_magic_addr_NT] = 0; p->rule._magic_addr = q->rule._magic_addr; } } c = 0; if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 1; _closure_reg(a, c + 0); } } /* reg: INDIRI1(addr) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + 1; if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 14; _closure_reg(a, c + 0); } break; case 1094: /* INDIRU1 */ _label(LEFT_CHILD(a)); if ( /* reg: INDIRU1(VREGP) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { if (mayrecalc(a)) { struct _state *q = a->syms[RX]->u.t.cse->x.state; if (q->cost[_stmt_NT] == 0) { p->cost[_stmt_NT] = 0; p->rule._stmt = q->rule._stmt; } if (q->cost[_reg_NT] == 0) { p->cost[_reg_NT] = 0; p->rule._reg = q->rule._reg; } if (q->cost[_con_NT] == 0) { p->cost[_con_NT] = 0; p->rule._con = q->rule._con; } if (q->cost[_acon_NT] == 0) { p->cost[_acon_NT] = 0; p->rule._acon = q->rule._acon; } if (q->cost[_addr_NT] == 0) { p->cost[_addr_NT] = 0; p->rule._addr = q->rule._addr; } if (q->cost[_rc_NT] == 0) { p->cost[_rc_NT] = 0; p->rule._rc = q->rule._rc; } if (q->cost[_ar_NT] == 0) { p->cost[_ar_NT] = 0; p->rule._ar = q->rule._ar; } if (q->cost[_magic_addr_NT] == 0) { p->cost[_magic_addr_NT] = 0; p->rule._magic_addr = q->rule._magic_addr; } } c = 0; if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 2; _closure_reg(a, c + 0); } } /* reg: INDIRU1(addr) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + 2; if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 15; _closure_reg(a, c + 0); } break; case 1157: /* CVII1 */ break; case 1158: /* CVIU1 */ break; case 1205: /* CVUI1 */ break; case 1206: /* CVUU1 */ break; case 1253: /* LOADI1 */ _label(LEFT_CHILD(a)); /* reg: LOADI1(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + (move(a)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 52; _closure_reg(a, c + 0); } break; case 1254: /* LOADU1 */ _label(LEFT_CHILD(a)); /* reg: LOADU1(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + (move(a)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 53; _closure_reg(a, c + 0); } break; case 2277: /* LOADI2 */ break; case 2278: /* LOADU2 */ break; case 4113: /* CNSTF4 */ /* reg: CNSTF4 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 13; _closure_reg(a, c + 0); } break; case 4117: /* CNSTI4 */ /* con: CNSTI4 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 3; _closure_con(a, 0 + 0); } /* reg: CNSTI4 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 9; _closure_reg(a, c + 0); } break; case 4118: /* CNSTU4 */ /* con: CNSTU4 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 4; _closure_con(a, 0 + 0); } /* reg: CNSTU4 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 11; _closure_reg(a, c + 0); } break; case 4119: /* CNSTP4 */ /* con: CNSTP4 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 5; _closure_con(a, 0 + 0); } /* reg: CNSTP4 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 12; _closure_reg(a, c + 0); } /* ar: CNSTP4 */ c = (range(a, 0, 0x0fffffff)); if (c + 0 < p->cost[_ar_NT]) { p->cost[_ar_NT] = c + 0; p->rule._ar = 2; } /* magic_addr: CNSTP4 */ c = (is_magic_addr(a)); if (c + 0 < p->cost[_magic_addr_NT]) { p->cost[_magic_addr_NT] = c + 0; p->rule._magic_addr = 1; } break; case 4129: /* ARGF4 */ _label(LEFT_CHILD(a)); /* stmt: ARGF4(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 41; } break; case 4133: /* ARGI4 */ _label(LEFT_CHILD(a)); /* stmt: ARGI4(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 42; } break; case 4134: /* ARGU4 */ _label(LEFT_CHILD(a)); /* stmt: ARGU4(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 44; } break; case 4135: /* ARGP4 */ _label(LEFT_CHILD(a)); /* stmt: ARGP4(reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 43; } break; case 4145: /* ASGNF4 */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNF4(VREGP,reg) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { c = ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 0; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 3; } } /* stmt: ASGNF4(addr,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 13; } break; case 4149: /* ASGNI4 */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNI4(VREGP,reg) */ LEFT_CHILD(a)->op == 711 /* VREGP */ ) { c = ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 0; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 4; } } /* stmt: ASGNI4(addr,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 1; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 10; } break; case 4150: /* ASGNU4 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -