private void MarkOptimizationAndCaseBlocks(InstructionBlock block, RemoveCompilerOptimizationsStep.SwitchData data) { V_0 = new Queue <InstructionBlock>(); V_1 = new HashSet <int>(); V_2 = block.get_Successors(); V_3 = 0; while (V_3 < (int)V_2.Length) { V_0.Enqueue(V_2[V_3]); V_3 = V_3 + 1; } while (V_0.get_Count() > 0) { V_5 = V_0.Dequeue(); dummyVar0 = V_1.Add(V_5.get_First().get_Offset()); if (!this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable())) { if (!this.IsCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression()) && !this.IsNullCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression())) { continue; } this.switchBlocksToCasesMap.get_Item(block.get_First().get_Offset()).Add(V_5.get_First().get_Offset()); V_8 = V_5.get_Successors()[1]; if (this.IsEmptyStringCaseBlock(this.blockExpressions.get_Item(V_8.get_First().get_Offset()), data.get_SwitchExpression())) { V_5.set_Last(V_8.get_Last()); V_5.set_Successors(V_8.get_Successors()); V_9 = this.blockExpressions.get_Item(V_5.get_First().get_Offset()).get_Item(0) as BinaryExpression; V_9.set_Right(new LiteralExpression("", this.methodContext.get_Method().get_Module().get_TypeSystem(), null)); V_10 = this.blockExpressions.get_Item(V_8.get_First().get_Offset()).get_Item(0).get_UnderlyingSameMethodInstructions(); V_9 = V_9.CloneAndAttachInstructions(V_10) as BinaryExpression; this.blockExpressions.get_Item(V_5.get_First().get_Offset()).set_Item(0, new UnaryExpression(11, V_9, null)); this.blocksToBeRemoved.Add(V_8.get_First().get_Offset()); } dummyVar1 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5); } else { V_6 = V_5.get_Successors()[0]; if (!V_1.Contains(V_6.get_First().get_Offset())) { V_0.Enqueue(V_6); } V_7 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5); if (!V_1.Contains(V_7.get_First().get_Offset()) && this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable())) { V_0.Enqueue(V_7); } this.blocksToBeRemoved.Add(V_5.get_First().get_Offset()); } } return; }
private HashSet <ILogicalConstruct> GetLogicalConstructsInRange(BlockRange blockRange, out ILogicalConstruct theCommonParent) { V_0 = new HashSet <ILogicalConstruct>(); V_1 = new HashSet <ISingleEntrySubGraph>(); V_2 = blockRange.Start.get_First().get_Offset(); V_3 = blockRange.End.get_First().get_Offset(); V_5 = 0; while (V_5 < (int)this.context.get_CFG().get_Blocks().Length) { V_6 = this.context.get_CFG().get_Blocks()[V_5]; if (V_6.get_First().get_Offset() >= V_2 && V_6.get_First().get_Offset() <= V_3) { V_7 = this.context.get_CFGBlockToLogicalConstructMap().get_Item(V_6); V_8 = 0; while (V_8 < (int)V_7.Length) { dummyVar0 = V_1.Add((ILogicalConstruct)V_7[V_8].get_Parent()); dummyVar1 = V_0.Add(V_7[V_8]); V_8 = V_8 + 1; } } V_5 = V_5 + 1; } if (V_1.get_Count() == 1) { theCommonParent = (ILogicalConstruct)V_1.ToArray <ISingleEntrySubGraph>()[0]; return(V_0); } theCommonParent = (ILogicalConstruct)LogicalFlowUtilities.FindFirstCommonParent(V_1); V_4 = new HashSet <ILogicalConstruct>(); V_9 = V_0.GetEnumerator(); try { while (V_9.MoveNext()) { dummyVar2 = LogicalFlowUtilities.TryGetParentConstructWithGivenParent(V_9.get_Current(), theCommonParent, out V_10); dummyVar3 = V_4.Add(V_10); } } finally { ((IDisposable)V_9).Dispose(); } if (theCommonParent as ExceptionHandlingLogicalConstruct != null) { V_4.Clear(); dummyVar4 = V_4.Add(theCommonParent); theCommonParent = theCommonParent.get_Parent() as ILogicalConstruct; } return(V_4); }