private void mapRGFA(Function f, SGTTSD gttd, IEnumerable <GT> pgts) { Debug.Assert(gttd.depth >= 0 && gttd.depth < maxDepth); if (!pgts.Any()) { return; } GTI gti; SGTSD gtd = null; if (gttd.tryGetSGFA(f, out gti)) { gtd = getGTD(gti); } else { gtd = mapGFA(f, gttd); setDepth(gtd, gttd.depth + 1); gti = gtd.gti; } if (gtd != null) { Debug.Assert(gtd.isFeasible); setActual(gtd); mapPGTs(gtd, pgts); if (gtd.isAnyUpdated) { enqueuePropagateGTI(gti); } } }
/* protected override void checkSourcesNoLGTs() * { #if DEBUG * base.checkSourcesNoLGTs(); * foreach (var gtd in allGTDs) * { * var gti = gtd.gti; * * } #endif * }*/ #endregion consistency #region propagate protected sealed override void completeNewGTTSources(SGTTSD gttd) { var pgtsT = (from gti in gttd.gtiT select new HashSet <GT>(getGTD(gti).pgts)).ToArray(); var pgtts = universe.makePGTTs(pgtsT); mapPGTTs(gttd, pgtts); }
protected void mapPGTT(SGTTSD gttd, GTT pgtt) { int gtti; if (tryGetPGTTGTTI(pgtt, out gtti)) { if (gtti != gttd.gtti) { enqueueMergeGTTI(gtti, gttd.gtti); } else { } } else { #region preconditions #if DEBUG Debug.Assert(!hasPGTT(pgtt)); Debug.Assert(!gttd.pgtts.Contains(pgtt)); #endif #endregion preconditions mapNewPGTT(gttd, pgtt); enqueuePropagateGTTI(gttd.gtti); } Debug.Assert(gttd.pgtts.Contains(pgtt) || tMergeToGTTI(getPGTTGTTI(pgtt)) == tMergeToGTTI(gttd.gtti)); }
void mapNewPGTT(SGTTSD gttd, GTT pgtt) { #if DEBUG Debug.Assert(!gttSS.hasPT(pgtt)); #endif newPGTTs.Add(pgtt); mapPGTTInt(gttd.gtti, pgtt); }
protected override void mergeSources(SGTTSD gttdFrom, SGTTSD gttdTo) { foreach (var pgtt in gttdFrom.pgtts) { remapPGTT(gttdTo.gtti, pgtt); } if (gttdTo.isActual) { newPGTTs.UnionWith(gttdFrom.pgtts); } }
private void mapPGTTs(SGTTSD gttd, IEnumerable <GTT> pgtts) { foreach (var pgtt in pgtts) { mapPGTT(gttd, pgtt); } /* { * GTTI gtti2; * if (!tryGetPGTTGTTI(pgtt, out gtti2)) * mapPGTT(gttd, pgtt); * else * Debug.Assert(gtti2 == gttd.gtti); * }*/ }
protected override sealed void propagateGTTINLGTTs(SGTTSD gttd) { if (gttd.depth < 0 || gttd.depth >= maxDepth) { return; } if (gttd.pgtts.Any()) { foreach (var f in new HashSet <Function>(from nlgtt in gttd.nlts from rgfa in universe.getRGFAs(nlgtt) select rgfa)) { var pgts = universe.makePredecessorGTs(f, gttd.pgtts); mapRGFA(f, gttd, pgts); } } gttd.clearNLTs(); }
private void mapRGTT(GTI[] gtiT, IEnumerable <GTT> pgtts) { #region consistency #if DEBUG Debug.Assert(gtiT.Length > 0); foreach (var gti in gtiT) { Debug.Assert(getGTD(gti).depth >= 0 && getGTD(gti).depth < maxDepth); } #endif #endregion consistency if (!pgtts.Any()) { return; } SGTTSD gttd = null; GTTI gtti; if (tryGetGTTIByGTIs(gtiT, out gtti)) { gttd = getGTTD(gtti); } else { gttd = makeNewGTT(gtiT); var d = (from gti in gtiT select getGTD(gti).depth).Max(); setDepth(gttd, d); gtti = gttd.gtti; } if (gttd.gtiT.Length > 0) { setDepth(gttd, (from gti1 in gttd.gtiT select getGTD(gti1).depth).Max()); } if (gttd != null) { Debug.Assert(gttd.isFeasible); setActual(gttd); mapPGTTs(gttd, pgtts); if (gttd.isAnyUpdated) { enqueuePropagateGTTI(gtti); } } }
protected sealed override void propagateUpGTTISources(SGTTSD gttd) { // if (gttd.depth < 0 || gttd.depth >= maxDepth) // return; var npgtts = gttd.npgtts; if (!npgtts.Any() && !gttd.isDepthDownUpdated) { return; } foreach (var f in gttd.allSGFAs) { var gti = gttd.getSGFA(f); var gtd = getGTD(gti); var pgts = universe.makePredecessorGTs(f, npgtts); mapPGTsToGTI(gtd, pgts); } foreach (var f in new HashSet <Function>(from lgtt in gttd.lgtts from f in universe.getRGFAs(lgtt) select f)) { var pgts = universe.makePredecessorGTs(f, npgtts); mapRGFA(f, gttd, pgts); } }
protected sealed override void propagateDownGTTISources(SGTTSD gttd) { }
protected override void gttdActualUpdated(SGTTSD gttd) { base.gttdActualUpdated(gttd); newPGTTs.UnionWith(gttd.pgtts); }