Exemplo n.º 1
0
 public void RemoveExitBlock(BasicBlock exitBlock)
 {
     if (exitBlocks == null)
         return;
     exitBlocks.Remove(exitBlock);
 }
Exemplo n.º 2
0
 public void RemoveEntryBlock(BasicBlock insBlock)
 {
     if (entryBlocks == null) return;
     entryBlocks.Remove(insBlock);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Add the given block to my list of entry blocks.
 /// </summary>
 internal void AddEntryBlock(BasicBlock entryBlock)
 {
     entryBlocks = entryBlocks ?? new HashSet<BasicBlock>();
     entryBlocks.Add(entryBlock);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Add the given block to my list of exit blocks.
 /// </summary>
 internal void AddExitBlock(BasicBlock exitBlock)
 {
     exitBlocks = exitBlocks ?? new HashSet<BasicBlock>();
     exitBlocks.Add(exitBlock);
 }
Exemplo n.º 5
0
 public HashSet<BasicBlock> GetReachableBlocks(BasicBlock basicBlock)
 {
     if (_reachableBlocks == null)
         CalculateReachableBlocks();
     return _reachableBlocks[basicBlock];
 }
Exemplo n.º 6
0
 /// <summary>
 /// This method tests if 'target' can be reached from 'source' without passing through 'blocker'
 /// </summary>
 private bool IsReachable(BasicBlock target, BasicBlock source, BasicBlock blocker, HashSet<BasicBlock> visited)
 {
     foreach (var exit in source.ExitBlocks)
     {                
         if (exit == target)
             return true;
         if (exit == blocker || exit == source)
             continue;
         if (visited.Contains(exit))
             continue; 
         visited.Add(exit);
         if (IsReachable(target, exit, blocker, visited))
             return true;
     }
     return false;
 }
Exemplo n.º 7
0
 public InstructionInBlock(Instruction instruction, BasicBlock block)
 {
     Instruction = instruction;
     Block = block;
 }
Exemplo n.º 8
0
        private HashSet<BasicBlock> CalculateReachableBlocks(BasicBlock block, HashSet<BasicBlock> visited)
        {
            visited.Add(block);

            HashSet<BasicBlock> ret = new HashSet<BasicBlock>();

            foreach (var b in block.ExitBlocks)
            {
                if (visited.Contains(b))
                    continue;

                ret.Add(b);
                if (_reachableBlocks.ContainsKey(b))
                {
                    foreach (var bb in _reachableBlocks[b])
                        ret.Add(bb);
                }
                else
                {
                    foreach (var dep in CalculateReachableBlocks(b, visited))
                        ret.Add(dep);
                }
            }

            return ret;
        }
Exemplo n.º 9
0
 public InstructionInBlock(Instruction instruction, BasicBlock block)
 {
     Instruction = instruction;
     Block       = block;
 }