Removed 2 lingering TRUE/FALSE references

Removed 2 calls to cCode.appendDecl in walkCondExpr, replaced with
ostringstream usage + 1 call to cCode.appendDecl
Created Type helper class = TypeContainer
This commit is contained in:
Artur K
2012-03-13 00:35:32 +01:00
parent 14b06c252e
commit fe250a822d
4 changed files with 57 additions and 31 deletions

View File

@@ -628,7 +628,7 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, int* numLoc)
bool needBracket; /* Determine whether parenthesis is needed */
BWGLB_TYPE* bwGlb; /* Ptr to BWGLB_TYPE (global indexed var) */
STKSYM * psym; /* Pointer to argument in the stack */
std::ostringstream outStr;
std::ostringstream outStr,codeOut;
if (expr == NULL)
return "";
@@ -709,7 +709,8 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, int* numLoc)
if (id->name[0] == '\0') /* no name */
{
sprintf (id->name, "loc%ld", ++(*numLoc));
cCode.appendDecl("%s %s; /* %s */\n",hlTypes[id->type], id->name,Machine_X86::regName(id->id.regi).c_str());
codeOut <<TypeContainer::typeName(id->type)<< " "<<id->name<<"; ";
codeOut <<"/* "<<Machine_X86::regName(id->id.regi)<<" */\n";
}
if (id->hasMacro)
o << id->macro << "("<<id->name<<")";
@@ -752,9 +753,9 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, int* numLoc)
else if (id->loc == REG_FRAME)
{
sprintf (id->name, "loc%ld", ++(*numLoc));
cCode.appendDecl("%s %s; /* %s:%s */\n",hlTypes[id->type], id->name,
Machine_X86::regName(id->id.longId.h).c_str(),
Machine_X86::regName(id->id.longId.l).c_str());
codeOut <<TypeContainer::typeName(id->type)<< " "<<id->name<<"; ";
codeOut <<"/* "<<Machine_X86::regName(id->id.longId.h) << ":" <<
Machine_X86::regName(id->id.longId.l) << " */\n";
o << id->name;
pProc->localId.propLongId (id->id.longId.l,id->id.longId.h, id->name);
}
@@ -784,6 +785,7 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, int* numLoc)
outStr << o.str();
break;
}
cCode.appendDecl(codeOut.str());
return outStr.str();
}

View File

@@ -218,7 +218,7 @@ void Function::codeGen (std::ostream &fs)
/* Write arguments */
for (size_t i = 0; i < args.sym.size(); i++)
{
if (args.sym[i].invalid == FALSE)
if (args.sym[i].invalid == false)
{
buf<<hlTypes[args.sym[i].type]<<" "<<args.sym[i].name;
if (i < (args.sym.size() - 1))
@@ -238,7 +238,7 @@ void Function::codeGen (std::ostream &fs)
for (ID &refId : localId )
{
/* Output only non-invalidated entries */
if (refId.illegal == FALSE)
if (refId.illegal == false)
{
if (refId.loc == REG_FRAME)
{