LoopList lpNaturalLoopsFrFlog(FlowGraph flog, Dominators * pDoms) { LoopList loops; Dominators doms; EdgeList backEdges; doms = lpDominatorsFrFlog(flog); if (DEBUG(lp)) { lpDominatorsPrintDb(doms); } backEdges = lpBackEdgesFrDominators(doms); if (DEBUG(lp)) { fprintf(dbOut,"Back Edges: \n"); lpEdgeListPrintDb(backEdges); } if (pDoms) *pDoms = doms; else lpDominatorsFree(doms); loops = lpNaturalLoopsFrBackEdges(backEdges, flog); if (DEBUG(lp)) { lpLoopListPrintDb(loops); } listFreeDeeply(Edge)(backEdges, lpEdgeFree); return loops; }
void testLoop(Foam foam) { Foam defs = foam->foamUnit.defs; Foam def; int i; FlowGraph flog; LoopList loops; lpDebug = true; for (i = 0; i < foamArgc(defs); i++) { def = defs->foamDDef.argv[i]; if (foamTag(def->foamDef.rhs) != FOAM_Prog) continue; flog = flogFrProg(def->foamDef.rhs, FLOG_UniqueExit); loops = lpNaturalLoopsFrFlog(flog, (Dominators *) NULL); loops = lpUnifyCommonHeaders(loops); def->foamDef.rhs = flogToProg(flog); listFreeDeeply(Loop)(loops, lpLoopFree); } }
void arClose(Archive ar) { fnameFree(ar->name); if (ar->hasFile) fclose(ar->file); listFreeDeeply(ArEntry)(ar->members, arFreeEntry); listFree(Syme)(ar->symes); stoFree((Pointer) ar); }
AbSyn compFileFront(EmitInfo finfo, Stab stab, FILE *fin, int *plno) { FileName fn = emitSrcFile(finfo); AbSyn ab; FTypeNo ft = ftypeNo(fnameType(fn)); if (ft == FTYPENO_OLDABSYN) { comsgWarning(NULL, ALDOR_W_OldTypeAbsyn, cmdName); } if ((ft == FTYPENO_ABSYN) || (ft == FTYPENO_OLDABSYN)) { ab = compPhaseLoadAbSyn(finfo); } else { SrcLineList sll; TokenList tl; sll = compPhaseInclude(finfo, fin, plno); fintGetInitCompTime(); if (!compIsMoreAfterInclude(finfo)) { inclFree(sll); return 0; } tl = compPhaseScan (finfo, sll); tl = compPhaseSysCmd (finfo, tl); tl = compPhaseLinear (finfo, tl); ab = compPhaseParse (finfo, tl); inclFree(sll); listFreeDeeply(Token)(tl,tokFree); if (comsgErrorCount()) return ab; } ab = compPhaseAbNorm (finfo, ab, false); ab = compPhaseMacEx (finfo, ab); if (comsgErrorCount()) return ab; ab = compPhaseAbNorm (finfo, ab, true); ab = compPhaseAbCheck(finfo, ab); /* creates the .ax file */ if (!compIsMoreAfterSyntax(finfo)) return ab; compPhaseScoBind(finfo, stab, ab); if (comsgErrorCount()) { if (fintMode == FINT_LOOP) scoSetUndoState(); return ab; } compPhaseTInfer (finfo, stab, ab); if (comsgErrorCount()) { if (fintMode == FINT_LOOP) scoSetUndoState(); return ab; } return ab; }
local void absFreeDeeply0(AbSub sigma, AbsFreeBindingFun f) { if (sigma == absFail()) return; if (--sigma->refc > 0) return; listFreeDeeply(AbBind)(sigma->l, f); tblFree(sigma->results); /*!! Could free sigma->fv. */ stoFree((Pointer) sigma); return; }
void compPhasePutAXLmainC(EmitInfo finfo) { phStart(PH_PutC); if (emitIsOutputNeededOrWarn(finfo, FTYPENO_AXLMAINC)) { /* ?? Should do what emitGetFileIdName does */ CCode mainc = genAXLmainC(strCopy(emitGetEntryFile())); CCodeList ccodel = listCons(CCode)(mainc, listNil(CCode)); emitSetDone(FTYPENO_AXLMAINC); emitTheC(finfo, ccodel); listFreeDeeply(CCode)(ccodel, ccoFree); } phEnd((PhPrFun) 0, (PhPrFun) 0, (Pointer) NULL); }
void compPhasePutC(EmitInfo finfo, Foam foam) { String id = emitGetFileIdName(finfo); phStart(PH_PutC); if (emitIsOutputNeededOrWarn(finfo, FTYPENO_C)) { /* Should do what emitGetFileId does */ #if 0 FileName fname = emitSrcFile(finfo); CCodeList ccodel = genC(foam, strCopy(fnameName(fname))); #else CCodeList ccodel = genC(foam, id); #endif emitTheC(finfo, ccodel); listFreeDeeply(CCode)(ccodel, ccoFree); } phEnd((PhPrFun) 0, (PhPrFun) 0, (Pointer) NULL); }
void errorSetFree(ErrorSet errors) { listFreeDeeply(String)(errors->alloc, strFree); }
/* * Free a list of source lines. */ void inclFree(SrcLineList sll) { listFreeDeeply(SrcLine)(sll, slineFree); }