Class StructuralAnalyzer


  • public class StructuralAnalyzer
    extends Object
    CFG structural analysis identifying if-then-else, while, do-while, for and switch regions.
    • Constructor Detail

      • StructuralAnalyzer

        public StructuralAnalyzer​(IRMethod method,
                                  DominatorTree dominatorTree,
                                  LoopAnalysis loopAnalysis)
        Creates an analyzer; the post-dominator tree is built by analyze().
        Parameters:
        method - SSA method to analyze
        dominatorTree - dominator tree over the same method
        loopAnalysis - natural loops of the same method
    • Method Detail

      • getMethod

        public IRMethod getMethod()
        Returns:
        the method
      • getDominatorTree

        public DominatorTree getDominatorTree()
        Returns:
        the dominator tree
      • getLoopAnalysis

        public LoopAnalysis getLoopAnalysis()
        Returns:
        the loop analysis
      • getPostDominatorTree

        public PostDominatorTree getPostDominatorTree()
        Returns:
        the post dominator tree
      • getReachabilityCache

        public Map<IRBlock,​Set<IRBlock>> getReachabilityCache()
        Returns:
        the reachability cache
      • analyze

        public void analyze()
        Analyzes the method and identifies structured regions.
      • isPureExitBlock

        public boolean isPureExitBlock​(IRBlock block)
        Checks if a block is a PURE exit: a throw, a void return, or a trivial goto to such a block.
        Parameters:
        block - block to test
        Returns:
        true if the block is a pure exit
      • getRegionInfo

        public StructuralAnalyzer.RegionInfo getRegionInfo​(IRBlock block)
        Parameters:
        block - block to look up
        Returns:
        the region recorded for the block, or null when analysis identified none