sparc.c
来自「基于4个mips核的noc设计」· C语言 代码 · 共 2,357 行 · 第 1/5 页
C
2,357 行
struct _state *p = STATE_LABEL(a); if (c + 0 < p->cost[_rc_NT]) { p->cost[_rc_NT] = c + 0; p->rule._rc = 1; } if (c + 0 < p->cost[_base_NT]) { p->cost[_base_NT] = c + 0; p->rule._base = 5; _closure_base(a, c + 0); }}static void _closure_base(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 = 1; _closure_addr(a, c + 0); }}static void _closure_addr(NODEPTR_TYPE a, int c) { struct _state *p = STATE_LABEL(a); if (c + 0 < p->cost[_call_NT]) { p->cost[_call_NT] = c + 0; p->rule._call = 2; }}static void _closure_rel(NODEPTR_TYPE a, int c) { struct _state *p = STATE_LABEL(a); if (c + 4 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 4; p->rule._stmt = 60; }}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] = p->cost[9] = p->cost[10] = p->cost[11] = p->cost[12] = p->cost[13] = p->cost[14] = p->cost[15] = 0x7fff; switch (OP_LABEL(a)) { case 41: /* ARGB */ 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] + 0; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 61; } } break; case 73: /* INDIRB */ _label(LEFT_CHILD(a)); break; case 216: /* CALLV */ _label(LEFT_CHILD(a)); /* stmt: CALLV(call) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_call_NT] + 2; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 48; } break; case 217: /* CALLB */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); /* stmt: CALLB(call,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_call_NT] + ((struct _state *)(RIGHT_CHILD(a)->x.state))->cost[_reg_NT] + 3; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 49; } break; case 233: /* LOADB */ break; case 248: /* RETV */ break; case 584: /* JUMPV */ _label(LEFT_CHILD(a)); /* stmt: JUMPV(addrg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addrg_NT] + 2; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 33; } /* stmt: JUMPV(addr) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_addr_NT] + 2; if (c + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = c + 0; p->rule._stmt = 34; } break; case 600: /* LABELV */ /* stmt: LABELV */ if (0 + 0 < p->cost[_stmt_NT]) { p->cost[_stmt_NT] = 0 + 0; p->rule._stmt = 35; } 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); } /* con13: CNSTI1 */ c = (imm(a)); if (c + 0 < p->cost[_con13_NT]) { p->cost[_con13_NT] = c + 0; p->rule._con13 = 1; _closure_con13(a, c + 0); } /* reg: CNSTI1 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 40; _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); } /* con13: CNSTU1 */ c = (imm(a)); if (c + 0 < p->cost[_con13_NT]) { p->cost[_con13_NT] = c + 0; p->rule._con13 = 4; _closure_con13(a, c + 0); } /* reg: CNSTU1 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 44; _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 = 14; } /* stmt: ASGNI1(spill,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_spill_NT] + ((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 = 24; } 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 = 17; } /* stmt: ASGNU1(spill,reg) */ c = ((struct _state *)(LEFT_CHILD(a)->x.state))->cost[_spill_NT] + ((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 = 27; } 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[_stk13_NT] == 0) { p->cost[_stk13_NT] = 0; p->rule._stk13 = q->rule._stk13; } if (q->cost[_stk_NT] == 0) { p->cost[_stk_NT] = 0; p->rule._stk = q->rule._stk; } if (q->cost[_con13_NT] == 0) { p->cost[_con13_NT] = 0; p->rule._con13 = q->rule._con13; } if (q->cost[_base_NT] == 0) { p->cost[_base_NT] = 0; p->rule._base = q->rule._base; } if (q->cost[_addr_NT] == 0) { p->cost[_addr_NT] = 0; p->rule._addr = q->rule._addr; } if (q->cost[_addrl_NT] == 0) { p->cost[_addrl_NT] = 0; p->rule._addrl = q->rule._addrl; } if (q->cost[_spill_NT] == 0) { p->cost[_spill_NT] = 0; p->rule._spill = q->rule._spill; } if (q->cost[_rc_NT] == 0) { p->cost[_rc_NT] = 0; p->rule._rc = q->rule._rc; } if (q->cost[_rc5_NT] == 0) { p->cost[_rc5_NT] = 0; p->rule._rc5 = q->rule._rc5; } if (q->cost[_addrg_NT] == 0) { p->cost[_addrg_NT] = 0; p->rule._addrg = q->rule._addrg; } if (q->cost[_call_NT] == 0) { p->cost[_call_NT] = 0; p->rule._call = q->rule._call; } if (q->cost[_rel_NT] == 0) { p->cost[_rel_NT] = 0; p->rule._rel = q->rule._rel; } } 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 = 17; _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[_stk13_NT] == 0) { p->cost[_stk13_NT] = 0; p->rule._stk13 = q->rule._stk13; } if (q->cost[_stk_NT] == 0) { p->cost[_stk_NT] = 0; p->rule._stk = q->rule._stk; } if (q->cost[_con13_NT] == 0) { p->cost[_con13_NT] = 0; p->rule._con13 = q->rule._con13; } if (q->cost[_base_NT] == 0) { p->cost[_base_NT] = 0; p->rule._base = q->rule._base; } if (q->cost[_addr_NT] == 0) { p->cost[_addr_NT] = 0; p->rule._addr = q->rule._addr; } if (q->cost[_addrl_NT] == 0) { p->cost[_addrl_NT] = 0; p->rule._addrl = q->rule._addrl; } if (q->cost[_spill_NT] == 0) { p->cost[_spill_NT] = 0; p->rule._spill = q->rule._spill; } if (q->cost[_rc_NT] == 0) { p->cost[_rc_NT] = 0; p->rule._rc = q->rule._rc; } if (q->cost[_rc5_NT] == 0) { p->cost[_rc5_NT] = 0; p->rule._rc5 = q->rule._rc5; } if (q->cost[_addrg_NT] == 0) { p->cost[_addrg_NT] = 0; p->rule._addrg = q->rule._addrg; } if (q->cost[_call_NT] == 0) { p->cost[_call_NT] = 0; p->rule._call = q->rule._call; } if (q->cost[_rel_NT] == 0) { p->cost[_rel_NT] = 0; p->rule._rel = q->rule._rel; } } 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] + 1; if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 20; _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 = 33; _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 = 37; _closure_reg(a, c + 0); } break; case 2069: /* CNSTI2 */ /* con: CNSTI2 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 3; _closure_con(a, 0 + 0); } /* con13: CNSTI2 */ c = (imm(a)); if (c + 0 < p->cost[_con13_NT]) { p->cost[_con13_NT] = c + 0; p->rule._con13 = 2; _closure_con13(a, c + 0); } /* reg: CNSTI2 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 41; _closure_reg(a, c + 0); } break; case 2070: /* CNSTU2 */ /* con: CNSTU2 */ if (0 + 0 < p->cost[_con_NT]) { p->cost[_con_NT] = 0 + 0; p->rule._con = 4; _closure_con(a, 0 + 0); } /* con13: CNSTU2 */ c = (imm(a)); if (c + 0 < p->cost[_con13_NT]) { p->cost[_con13_NT] = c + 0; p->rule._con13 = 5; _closure_con13(a, c + 0); } /* reg: CNSTU2 */ c = (range(a, 0, 0)); if (c + 0 < p->cost[_reg_NT]) { p->cost[_reg_NT] = c + 0; p->rule._reg = 45; _closure_reg(a, c + 0); } break; case 2101: /* ASGNI2 */ _label(LEFT_CHILD(a)); _label(RIGHT_CHILD(a)); if ( /* stmt: ASGNI2(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: ASGNI2(addr,reg) */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?