コード例 #1
0
ファイル: amd64frame.c プロジェクト: bakumandfp/tiger
static void F_add_to_map(string str, Temp_temp temp)
{
	if (!F_tempMap) {
		F_tempMap = Temp_name();
	}
	Temp_enter(F_tempMap, temp, str);
}
コード例 #2
0
ファイル: x86_64frame.c プロジェクト: MaoKwen/tiger-compiler
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());
}
コード例 #3
0
Temp_temp Temp_newtemp(void)
{Temp_temp p = (Temp_temp) checked_malloc(sizeof (*p));
 p->num=temps++;
 {char r[16];
  sprintf(r, "%d", p->num);
  Temp_enter(Temp_name(), p, String(r));
 }
 return p;
}
コード例 #4
0
Temp_temp Temp_newtemp(const char *name)
{
	Temp_temp p = (Temp_temp) checked_malloc(sizeof (*p));
	
	p->num=temps++;
	{
		char r[LOG_2_MAX_NUM_TEMPORARIES];

		if (strcmp(name,"") == 0)
		{
			sprintf(r, "%s_%d","Temp",p->num);
		}
		else
		{
			strcpy(r,name);
		}
		Temp_enter(Temp_name(), p, String(r));
	}
	
	return p;
}