Ejemplo n.º 1
0
void ParseFunctionBody(SYM *sp)
{    
	char lbl[200];

	needpunc(begin);
    ParseAutoDeclarations();
	cseg();
	if (sp->storage_class == sc_static)
	{
		strcpy(lbl,GetNamespace());
		strcat(lbl,"_");
		strcat(lbl,sp->name);
		gen_strlab(lbl);
	}
	//	put_label((unsigned int) sp->value.i);
	else
		gen_strlab(sp->name);
	currentFn = sp;
	currentFn->IsLeaf = TRUE;
	currentFn->DoesThrow = FALSE;
    GenerateFunction(sp, ParseCompoundStatement());
//	if (optimize)
		flush_peep();
}
Ejemplo n.º 2
0
static Statement *ParseFunctionBody(SYM *sp)
{    
	std::string lbl;
	char *p;
	Statement *stmt;
	Statement *plg;
	Statement *eplg;

  dfs.printf("<Parse function body>:%s|\n", (char *)sp->name->c_str());

	lbl[0] = 0;
	needpunc(begin,47);
     
  tmpReset();
    //ParseAutoDeclarations();
	cseg();
	if (sp->storage_class == sc_static)
	{
		//strcpy(lbl,GetNamespace());
		//strcat(lbl,"_");
//		strcpy(lbl,sp->name);
    lbl = *sp->mangledName;
		//gen_strlab(lbl);
	}
	//	put_label((unsigned int) sp->value.i);
	else {
		if (sp->storage_class == sc_global)
			lbl = "public code ";
//		strcat(lbl,sp->name);
		lbl += *sp->mangledName;
		//gen_strlab(lbl);
	}
  dfs.printf("B");
  p = my_strdup((char *)lbl.c_str());
  dfs.printf("b");
	GenerateMonadic(op_fnname,0,make_string(p));
	currentFn = sp;
	currentFn->IsLeaf = TRUE;
	currentFn->DoesThrow = FALSE;
	currentFn->UsesPredicate = FALSE;
	regmask = 0;
	bregmask = 0;
	currentStmt = (Statement *)NULL;
  dfs.printf("C");
	stmt = ParseCompoundStatement();
  dfs.printf("D");
//	stmt->stype = st_funcbody;
	if (isThor)
		GenerateFunction(sp, stmt);
	else if (isTable888)
		GenerateTable888Function(sp, stmt);
	else if (isRaptor64)
		GenerateRaptor64Function(sp, stmt);
	else if (is816)
		Generate816Function(sp, stmt);
	else if (isFISA64)
		GenerateFISA64Function(sp, stmt);
  dfs.putch('E');

	flush_peep();
	if (sp->storage_class == sc_global) {
		ofs.printf("endpublic\r\n\r\n");
	}
	ofs.printf("%sSTKSIZE_ EQU %d\r\n", (char *)sp->mangledName->c_str(), tmpVarSpace() + lc_auto);
	isFuncBody = false;
	dfs.printf("</ParseFunctionBody>\n");
	return stmt;
}