private bool TryMakeLoop(IntervalConstruct interval, DominatorTree dominatorTree) { V_0 = DFSTBuilder.BuildTree(interval); if (V_0.get_BackEdges().get_Count() == 0) { return(false); } V_2 = this.BuildLoop(V_0, out V_1); V_4 = this.DetermineLoopType(V_1, V_2, interval, dominatorTree, out V_3); if (V_1.get_Count() > 0) { V_5 = new LoopLogicalConstruct(interval.get_Entry() as ILogicalConstruct, V_1, V_4, V_3, this.typeSystem); this.CleanUpEdges(V_5); this.UpdateDominatorTree(dominatorTree, V_5); return(true); } V_6 = V_0.get_BackEdges().GetEnumerator(); try { while (V_6.MoveNext()) { V_7 = V_6.get_Current(); this.MarkAsGotoEdge(V_7.get_Start().get_Construct() as ILogicalConstruct, V_7.get_End().get_Construct() as ILogicalConstruct); } } finally { ((IDisposable)V_6).Dispose(); } return(false); }
private LoopType DetermineLoopType(HashSet <ILogicalConstruct> loopBody, HashSet <ILogicalConstruct> latchingNodes, IntervalConstruct interval, DominatorTree dominatorTree, out ConditionLogicalConstruct loopCondition) { V_0 = interval.get_Entry() as ILogicalConstruct; V_1 = new HashSet <ILogicalConstruct>(latchingNodes); dummyVar0 = V_1.Add(V_0); V_2 = DFSTBuilder.BuildTree(V_0.get_Parent() as ILogicalConstruct); V_3 = new HashSet <ILogicalConstruct>(); V_4 = loopBody.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_6 = dominatorTree.GetDominanceFrontier(V_5).GetEnumerator(); try { while (V_6.MoveNext()) { V_7 = (ILogicalConstruct)V_6.get_Current(); if (!interval.get_Children().Contains(V_7) || loopBody.Contains(V_7)) { continue; } dummyVar1 = V_3.Add(V_7); } } finally { ((IDisposable)V_6).Dispose(); } } } finally { ((IDisposable)V_4).Dispose(); } if (V_3.get_Count() == 0) { V_8 = V_2.get_ReversePostOrder().GetEnumerator(); try { while (V_8.MoveNext()) { V_9 = V_8.get_Current().get_Construct() as ILogicalConstruct; if (loopBody.Contains(V_9)) { continue; } loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_9); if (loopCondition == null) { continue; } this.ExpandLoopBody(interval, loopBody, V_9); if (loopCondition != V_0) { V_10 = 2; goto Label1; } else { V_10 = 1; goto Label1; } } goto Label0; } finally { ((IDisposable)V_8).Dispose(); } Label1: return(V_10); } V_11 = V_2.get_ReversePostOrder().get_Count(); V_4 = V_3.GetEnumerator(); try { while (V_4.MoveNext()) { V_13 = V_4.get_Current(); V_14 = V_2.get_ConstructToNodeMap().get_Item(V_13).get_ReversePostOrderIndex(); if (V_14 >= V_11) { continue; } V_11 = V_14; } } finally { ((IDisposable)V_4).Dispose(); } V_12 = V_2.get_ReversePostOrder().get_Item(V_11).get_Construct() as ILogicalConstruct; loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_12); this.ExpandLoopBody(interval, loopBody, V_12); if (loopCondition == null) { return(0); } if (loopCondition == V_0) { return(1); } return(2); Label0: if (!this.CanBeLoopCondition(V_0, loopBody)) { loopCondition = null; return(0); } loopCondition = V_0 as ConditionLogicalConstruct; return(1); }