Temp_map F_TempMap() { static Temp_map m = NULL; if (!m) { m = Temp_empty(); Temp_enter(m, F_FP(), "fp"); Temp_enter(m, F_SP(), "sp"); Temp_enter(m, F_RV(), "rv"); Temp_enter(m, F_ZERO(), "zf"); Temp_tempList args = F_ARGS(); Temp_tempList callee = F_CALLEE(); Temp_tempList caller = F_CALLER(); string buf[10]; for (int i=0; args; args = args->tail, i++) { sprintf(buf, "args%d", i); Temp_enter(m, args, ""); } for (int i=0; callee; callee = callee->tail, i++) { sprintf(buf, "callee%d", i); Temp_enter(m, args, ""); } for (int i=0; caller; caller = caller->tail, i++) { sprintf(buf, "caller%d", i); Temp_enter(m, args, ""); } } return Temp_layerMap(m, Temp_name()); }
static Temp_tempList F_special_registers(void) { static Temp_tempList spregs = NULL; if (!spregs) { spregs = Temp_TempList(F_SP(), Temp_TempList(F_FP(), Temp_TempList(F_RV(), NULL))); } return spregs; }
void Tr_procEntryExit(Tr_level level, Tr_exp body, Tr_accessList formals, Temp_label label){ T_stm stm; stm = T_Seq( T_Label(label), T_Move(T_Temp(F_RV()), unEx(body)) ); //Put the frag into the list F_Proc(stm, level->frame); }
static Temp_tempList F_make_caller_saves(void) { Temp_temp r10 = Temp_newtemp(), r11 = Temp_newtemp(); F_add_to_map("r10", r10); F_add_to_map("r11", r11); return TL(F_RV(), TL(r10, TL(r11, F_make_arg_regs()))); }