void ProcessLoop(InstructionBlock block) { try { var start = block.Successors[0]; if (start.Index == 0) { System.Diagnostics.Debug.WriteLine("in detailedAnnotationBuilder.ProcessLoop: start.Index == 0 (so aborting function)"); return; } var before = cfg.Blocks[start.Index - 1]; var annotation = IsPreTestedLoop(before, block) ? Annotation.PreTestedLoop : Annotation.PostTestedLoop; var data = new LoopData(start, cfg.Blocks[block.Index + 1]); Annotate(block.Last, annotation, data); PushLoopData(data); Process(block.Successors[0]); Process(block.Successors[1]); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("in detailedAnnotationBuilder.ProcessLoop: " + ex.Message); } }
void ProcessLoop(InstructionBlock block) { var start = block.Successors [0]; //Problem with branch to the beginning of a method (L_0000) fixed. // var before = (start.Index==0) ? start : cfg.Blocks [start.Index - 1]; // InstructionBlock before; // if (start.Index == 0) { // before = start; // } // else { // before = cfg.Blocks [start.Index - 1]; // } // var annotation = IsPreTestedLoop (before, block) ? // Annotation.PreTestedLoop : Annotation.PostTestedLoop; var annotation = IsPreTestedLoop(block) ? Annotation.PreTestedLoop : Annotation.PostTestedLoop; var data = new LoopData(start, cfg.Blocks [block.Index + 1]); Annotate(block.Last, annotation, data); PushLoopData(data); Process(block.Successors [0]); Process(block.Successors [1]); }
void ProcessLoop(InstructionBlock block) { var start = block.Successors [0]; var before = cfg.Blocks [start.Index - 1]; var annotation = IsPreTestedLoop(before, block) ? Annotation.PreTestedLoop : Annotation.PostTestedLoop; var data = new LoopData(start, cfg.Blocks [block.Index + 1]); Annotate(block.Last, annotation, data); PushLoopData(data); Process(block.Successors [0]); Process(block.Successors [1]); }
void PushLoopData(LoopData data) { loop_stack.Add(data); }