- FILE *of;
- int i;
-
- if (ext) {
- /* create the file name */
- strcpy(buffer,srcFileName);
- strcat(buffer,ext);
-
- if (!(of = fopen(buffer,"a+"))) {
- werror(E_FILE_OPEN_ERR,buffer);
- exit(1);
- }
- } else
- of = stdout;
-
- for (i=0; i < count ; i++ ) {
- fprintf(of,"\n----------------------------------------------------------------\n");
- fprintf(of,"Basic Block %s : loop Depth = %d noPath = %d , lastinLoop = %d\n",
- ebbs[i]->entryLabel->name,
- ebbs[i]->depth,
- ebbs[i]->noPath,
- ebbs[i]->isLastInLoop);
- fprintf(of,"\ndefines bitVector :");
- bitVectDebugOn(ebbs[i]->defSet,of);
- fprintf(of,"\nlocal defines bitVector :");
- bitVectDebugOn(ebbs[i]->ldefs,of);
- fprintf(of,"\npointers Set bitvector :");
- bitVectDebugOn(ebbs[i]->ptrsSet,of);
- fprintf(of,"\n----------------------------------------------------------------\n");
- printiCChain(ebbs[i]->sch,of);
+ FILE *of;
+ int i;
+ eBBlock *bb;
+ set *cseSet;
+ eBBlock ** ebbs = ebbi->dfOrder ? ebbi->dfOrder : ebbi->bbOrder;
+ int count = ebbi->count;
+
+ if (id) {
+ of=createDumpFile(id);
+ } else {
+ of = stdout;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ fprintf (of, "\n----------------------------------------------------------------\n");
+ fprintf (of, "Basic Block %s (df:%d bb:%d lvl:%d): loopDepth=%d%s%s%s\n",
+ ebbs[i]->entryLabel->name,
+ ebbs[i]->dfnum, ebbs[i]->bbnum, ebbs[i]->entryLabel->level,
+ ebbs[i]->depth,
+ ebbs[i]->noPath ? " noPath" : "",
+ ebbs[i]->partOfLoop ? " partOfLoop" : "",
+ ebbs[i]->isLastInLoop ? " isLastInLoop" : "");
+
+ // a --nolabelopt makes this more readable
+ fprintf (of, "\nsuccessors: ");
+ for (bb=setFirstItem(ebbs[i]->succList);
+ bb;
+ bb=setNextItem(ebbs[i]->succList)) {
+ fprintf (of, "%s ", bb->entryLabel->name);
+ }
+ fprintf (of, "\npredecessors: ");
+ for (bb=setFirstItem(ebbs[i]->predList);
+ bb;
+ bb=setNextItem(ebbs[i]->predList)) {
+ fprintf (of, "%s ", bb->entryLabel->name);
+ }
+ {
+ int d;
+ fprintf (of, "\ndominators: ");
+ for (d=0; d<ebbs[i]->domVect->size; d++) {
+ if (bitVectBitValue(ebbs[i]->domVect, d)) {
+ fprintf (of, "%s ", ebbi->bbOrder[d]->entryLabel->name); //ebbs[d]->entryLabel->name);
+ }
+ }
+ }
+ fprintf (of, "\n");
+
+ fprintf (of, "\ndefines bitVector :");
+ bitVectDebugOn (ebbs[i]->defSet, of);
+ fprintf (of, "\nlocal defines bitVector :");
+ bitVectDebugOn (ebbs[i]->ldefs, of);
+ fprintf (of, "\npointers Set bitvector :");
+ bitVectDebugOn (ebbs[i]->ptrsSet, of);
+#if 0
+ fprintf (of, "\nin coming definitions :");
+ bitVectDebugOn (ebbs[i]->inDefs, of);
+ fprintf (of, "\nout going definitions :");
+ bitVectDebugOn (ebbs[i]->outDefs, of);
+ fprintf (of, "\ndefines used :");
+ bitVectDebugOn (ebbs[i]->usesDefs, of);
+#endif
+
+ if (ebbs[i]->isLastInLoop) {
+ 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);