/*-----------------------------------------------------------------*/
FILE *createDumpFile (int id) {
struct _dumpFiles *dumpFilesPtr=dumpFiles;
-
+ static int dumpIndex=0;
+ static char dumpIndexStr[32];
+
while (dumpFilesPtr->id) {
if (dumpFilesPtr->id==id)
break;
exit (1);
}
+ sprintf(dumpIndexStr, ".%d", dumpIndex);
+ dumpIndex++;
+
if (!dumpFilesPtr->filePtr) {
// not used before, create it
strncpyz (scratchFileName, dstFileName, PATH_MAX);
+#if 0
+ strncatz (scratchFileName, dumpIndexStr, PATH_MAX);
+#endif
strncatz (scratchFileName, dumpFilesPtr->ext, PATH_MAX);
if (!(dumpFilesPtr->filePtr = fopen (scratchFileName, "w"))) {
werror (E_FILE_OPEN_ERR, scratchFileName);
exit (1);
}
}
+
+#if 0
+ fprintf(dumpFilesPtr->filePtr, "Dump file index: %d\n", dumpIndex);
+#endif
+
return dumpFilesPtr->filePtr;
}
FILE *of;
int i;
eBBlock *bb;
+ set *cseSet;
if (id) {
of=createDumpFile(id);
fprintf (of, "\nInductions Set bitvector :");
bitVectDebugOn (ebbs[i]->linds, of);
}
+
+ fprintf (of, "\ninExprs:");
+ for (cseSet = ebbs[i]->inExprs; cseSet; cseSet=cseSet->next) {
+ cseDef *item=cseSet->item;
+ fprintf (of, " %s(%d)",OP_SYMBOL(item->sym)->name,item->diCode->key);
+ if (item->fromGlobal)
+ fprintf (of, "g");
+ }
+ fprintf (of, "\noutExprs:");
+ for (cseSet = ebbs[i]->outExprs; cseSet; cseSet=cseSet->next) {
+ cseDef *item=cseSet->item;
+ fprintf (of, " %s(%d)",OP_SYMBOL(item->sym)->name,item->diCode->key);
+ if (item->fromGlobal)
+ fprintf (of, "g");
+ }
+ fprintf (of, "\nkilledExprs:");
+ for (cseSet = ebbs[i]->killedExprs; cseSet; cseSet=cseSet->next) {
+ cseDef *item=cseSet->item;
+ fprintf (of, " %s(%d)",OP_SYMBOL(item->sym)->name,item->diCode->key);
+ if (item->fromGlobal)
+ fprintf (of, "g");
+ }
+
fprintf (of, "\n----------------------------------------------------------------\n");
printiCChain (ebbs[i]->sch, of);
}
ebb->ech = ebb->sch;
return ebb;
}
+
+ /* if this is a function call */
+ if (ic->op == CALL || ic->op == PCALL)
+ {
+ ebb->hasFcall = 1;
+ if (currFunc)
+ FUNC_HASFCALL(currFunc->type) = 1;
+ }
if ((ic->next && ic->next->op == LABEL) ||
!ic->next)
(ebbs[i]->entryLabel != entryLabel &&
ebbs[i]->entryLabel != returnLabel))
{
- werror (W_CODE_UNREACH, ebbs[i]->sch->filename, ebbs[i]->sch->lineno);
- continue;
+ iCode *ic = NULL;
+ bool foundNonlabel = 0;
+ ic=ebbs[i]->sch;
+ do
+ {
+ if (ic->op != LABEL)
+ {
+ foundNonlabel = 1;
+ break;
+ }
+ if (ic==ebbs[i]->ech)
+ break;
+ ic = ic->next;
+ }
+ while (ic);
+ if (foundNonlabel && ic)
+ {
+ werrorfl (ic->filename, ic->lineno, W_CODE_UNREACH);
+ continue;
+ }
}
lic->next = ebbs[i]->sch;
lic->next->prev = lic;
lic = ebbs[i]->ech;
+
}
return ric;