예제 #1
0
 internal void SelfRemove()
 {
     DataFlowForwardRelated.RemoveAllTwoWay();
     DataFlowBackRelated.RemoveAllTwoWay();
     foreach (var forwardRoute in ProgramFlowForwardRoutes)
     {
         forwardRoute.ProgramFlowBackRoutes.AddTwoWay(ProgramFlowBackRoutes);
     }
     //RemoveFromBranches();
     ProgramFlowBackRoutes.RemoveAllTwoWay();
     ProgramFlowForwardRoutes.RemoveAllTwoWay();
 }
예제 #2
0
 internal virtual void SelfRemoveAndStitch()
 {
     foreach (var forwardInst in DataFlowForwardRelated.ToArray())
     {
         int index = forwardInst.ArgIndex;
         forwardInst.MirrorArg.ContainingList.AddTwoWay(DataFlowBackRelated.Select(x => x.Argument).ToList(), index);
         forwardInst.ContainingList.RemoveTwoWay(forwardInst);
     }
     foreach (var forwardPath in ProgramFlowForwardRoutes.ToArray())
     {
         forwardPath.ProgramFlowBackRoutes.AddTwoWay(ProgramFlowBackRoutes.ToList());
         ProgramFlowForwardRoutes.RemoveTwoWay(forwardPath);
     }
     RemoveFromBranches();
     DataFlowBackRelated.RemoveAllTwoWay();
     foreach (CoupledList related in new CoupledList[] { ProgramFlowBackRoutes, SingleUnitBackRelated, SingleUnitForwardRelated })
     {
         related.RemoveAllTwoWay();
     }
 }
예제 #3
0
 public InstructionNode(Instruction instruction, MethodDefinition method)
 {
     Instruction = instruction;
     Method      = method;
     // TODO rework, this must precede StackPopCount for now, yuck
     DataFlowBackRelated       = new DataFlowBackArgList(this);
     StackPushCount            = GetStackPushCount(instruction);
     StackPopCount             = GetStackPopCount(instruction);
     MemoryReadCount           = MemoryProperties.GetMemReadCount(instruction.OpCode.Code);
     MemoryStoreCount          = MemoryProperties.GetMemStoreCount(instruction.OpCode.Code);
     ProgramFlowBackRoutes     = new ProgramFlowBackRoutes(this);
     ProgramFlowForwardRoutes  = new ProgramFlowForwardRoutes(this);
     DataFlowForwardRelated    = new DataFlowForwardArgList(this);
     SingleUnitBackRelated     = new SingleUnitBackRelated(this);
     SingleUnitForwardRelated  = new SingleUnitForwardRelated(this);
     SingleUnitNodes           = new List <InstructionNode>();
     MethodNameForSerilization = method.Name;
     MyGuid            = Guid.NewGuid();
     _BranchProperties = new BranchProperties(this);
     BranchProperties.BaseBranch.AddTwoWay(this);
 }
예제 #4
0
 private void RemoveFromBranches()
 {
     foreach (var branch in BranchProperties.Branches.ToList())
     {
         branch.RemoveTwoWay(this);
     }
     if (BranchProperties.MergingNodeProperties.IsMergingNode)
     {
         foreach (var nextNode in ProgramFlowForwardRoutes)
         {
             nextNode.BranchProperties.MergingNodeProperties.IsMergingNode = true;
             nextNode.BranchProperties.MergingNodeProperties.MergedBranches.AddRange(this.BranchProperties.MergingNodeProperties.MergedBranches);
         }
         foreach (var branchGroup in BranchProperties.MergingNodeProperties.MergedBranches.GroupBy(x => x.OriginatingNode))
         {
             var branch = branchGroup.First();
             if (ProgramFlowBackRoutes.Contains(branch.OriginatingNode))
             {
                 branch.BranchNodes.RemoveAll(x => x == this);
             }
         }
     }
 }