Class SSACFG

    • Field Detail

      • delegate

        protected final AbstractCFG<com.ibm.wala.shrike.shrikeBT.IInstruction,​IBasicBlock<com.ibm.wala.shrike.shrikeBT.IInstruction>> delegate
        A delegate CFG, pre-built, which stores the graph structure of this CFG.
    • Constructor Detail

    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • getBlockForInstruction

        public SSACFG.BasicBlock getBlockForInstruction​(int instructionIndex)
        Get the basic block an instruction belongs to. Note: the instruction2Block array is filled in lazily. During initialization, the mapping is set up only for the first instruction of each basic block.
        Specified by:
        getBlockForInstruction in interface ControlFlowGraph<SSAInstruction,​ISSABasicBlock>
        Parameters:
        instructionIndex - an instruction index
        Returns:
        the basic block which contains this instruction.
      • getInstructions

        public SSAInstruction[] getInstructions()
        NB: Use iterators such as IR.iterateAllInstructions() instead of this method. This will probably be deprecated someday.

        Return the instructions. Note that the CFG is created from the Shrike CFG prior to creating the SSA instructions.

        Specified by:
        getInstructions in interface ControlFlowGraph<SSAInstruction,​ISSABasicBlock>
        Returns:
        an array containing the SSA instructions.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isCatchBlock

        public boolean isCatchBlock​(int i)
        is the given i a catch block?
        Returns:
        true if catch block, false otherwise
      • getNumber

        public int getNumber​(ISSABasicBlock b)
                      throws java.lang.IllegalArgumentException
        Specified by:
        getNumber in interface com.ibm.wala.util.graph.NumberedNodeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
      • getNode

        public SSACFG.BasicBlock getNode​(int number)
        Specified by:
        getNode in interface com.ibm.wala.util.graph.NumberedNodeManager<ISSABasicBlock>
        See Also:
        NumberedNodeManager.getNode(int)
      • getMaxNumber

        public int getMaxNumber()
        Specified by:
        getMaxNumber in interface com.ibm.wala.util.graph.NumberedNodeManager<ISSABasicBlock>
        See Also:
        NumberedNodeManager.getMaxNumber()
      • iterator

        public java.util.Iterator<ISSABasicBlock> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<ISSABasicBlock>
        Specified by:
        iterator in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
        See Also:
        NodeManager.iterator()
      • stream

        public java.util.stream.Stream<ISSABasicBlock> stream()
        Specified by:
        stream in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
      • getNumberOfNodes

        public int getNumberOfNodes()
        Specified by:
        getNumberOfNodes in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
        See Also:
        NodeManager.getNumberOfNodes()
      • getPredNodes

        public java.util.Iterator<ISSABasicBlock> getPredNodes​(ISSABasicBlock b)
                                                        throws java.lang.IllegalArgumentException
        Specified by:
        getPredNodes in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        EdgeManager.getPredNodes(Object)
      • getPredNodeCount

        public int getPredNodeCount​(ISSABasicBlock b)
                             throws java.lang.IllegalArgumentException
        Specified by:
        getPredNodeCount in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        EdgeManager.getPredNodeCount(Object)
      • getSuccNodes

        public java.util.Iterator<ISSABasicBlock> getSuccNodes​(ISSABasicBlock b)
                                                        throws java.lang.IllegalArgumentException
        Specified by:
        getSuccNodes in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        EdgeManager.getSuccNodes(Object)
      • getSuccNodeCount

        public int getSuccNodeCount​(ISSABasicBlock b)
                             throws java.lang.IllegalArgumentException
        Specified by:
        getSuccNodeCount in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
        See Also:
        EdgeManager.getSuccNodeCount(Object)
      • addNode

        public void addNode​(ISSABasicBlock n)
                     throws java.lang.UnsupportedOperationException
        Specified by:
        addNode in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
        See Also:
        NodeManager.addNode(Object)
      • addEdge

        public void addEdge​(ISSABasicBlock src,
                            ISSABasicBlock dst)
                     throws java.lang.UnsupportedOperationException
        Specified by:
        addEdge in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
      • removeEdge

        public void removeEdge​(ISSABasicBlock src,
                               ISSABasicBlock dst)
                        throws java.lang.UnsupportedOperationException
        Specified by:
        removeEdge in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
      • removeAllIncidentEdges

        public void removeAllIncidentEdges​(ISSABasicBlock node)
                                    throws java.lang.UnsupportedOperationException
        Specified by:
        removeAllIncidentEdges in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
        See Also:
        EdgeManager.removeAllIncidentEdges(Object)
      • removeNodeAndEdges

        public void removeNodeAndEdges​(ISSABasicBlock N)
                                throws java.lang.UnsupportedOperationException
        Specified by:
        removeNodeAndEdges in interface com.ibm.wala.util.graph.Graph<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
        See Also:
        NodeManager.removeNode(Object)
      • removeNode

        public void removeNode​(ISSABasicBlock n)
                        throws java.lang.UnsupportedOperationException
        Specified by:
        removeNode in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
        See Also:
        NodeManager.removeNode(Object)
      • containsNode

        public boolean containsNode​(ISSABasicBlock N)
        Specified by:
        containsNode in interface com.ibm.wala.util.graph.NodeManager<ISSABasicBlock>
        See Also:
        NodeManager.containsNode(Object)
      • getExceptionalSuccessors

        public java.util.List<ISSABasicBlock> getExceptionalSuccessors​(ISSABasicBlock b)
        Description copied from interface: MinimalCFG
        The order of blocks returned must indicate the exception-handling scope. So the first block is the first candidate catch block, and so on. With this invariant one can compute the exceptional control flow for a given exception type.
        Specified by:
        getExceptionalSuccessors in interface MinimalCFG<ISSABasicBlock>
        Returns:
        the basic blocks which may be reached from b via exceptional control flow
      • hasExceptionalEdge

        public boolean hasExceptionalEdge​(SSACFG.BasicBlock src,
                                          SSACFG.BasicBlock dest)
        has exceptional edge src -> dest
        Throws:
        java.lang.IllegalArgumentException - if dest is null
      • hasNormalEdge

        public boolean hasNormalEdge​(SSACFG.BasicBlock src,
                                     SSACFG.BasicBlock dest)
        has normal edge src -> dest
        Throws:
        java.lang.IllegalArgumentException - if dest is null
      • iterateNodes

        public java.util.Iterator<ISSABasicBlock> iterateNodes​(com.ibm.wala.util.intset.IntSet s)
        Specified by:
        iterateNodes in interface com.ibm.wala.util.graph.NumberedNodeManager<ISSABasicBlock>
        See Also:
        NumberedNodeManager.iterateNodes(com.ibm.wala.util.intset.IntSet)
      • removeIncomingEdges

        public void removeIncomingEdges​(ISSABasicBlock node)
                                 throws java.lang.UnsupportedOperationException
        Specified by:
        removeIncomingEdges in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
      • removeOutgoingEdges

        public void removeOutgoingEdges​(ISSABasicBlock node)
                                 throws java.lang.UnsupportedOperationException
        Specified by:
        removeOutgoingEdges in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        java.lang.UnsupportedOperationException
      • hasEdge

        public boolean hasEdge​(ISSABasicBlock src,
                               ISSABasicBlock dst)
                        throws com.ibm.wala.util.debug.UnimplementedError
        Specified by:
        hasEdge in interface com.ibm.wala.util.graph.EdgeManager<ISSABasicBlock>
        Throws:
        com.ibm.wala.util.debug.UnimplementedError
      • getSuccNodeNumbers

        public com.ibm.wala.util.intset.IntSet getSuccNodeNumbers​(ISSABasicBlock b)
                                                           throws java.lang.IllegalArgumentException
        Specified by:
        getSuccNodeNumbers in interface com.ibm.wala.util.graph.NumberedEdgeManager<ISSABasicBlock>
        Throws:
        java.lang.IllegalArgumentException
      • getPredNodeNumbers

        public com.ibm.wala.util.intset.IntSet getPredNodeNumbers​(ISSABasicBlock node)
                                                           throws com.ibm.wala.util.debug.UnimplementedError
        Specified by:
        getPredNodeNumbers in interface com.ibm.wala.util.graph.NumberedEdgeManager<ISSABasicBlock>
        Throws:
        com.ibm.wala.util.debug.UnimplementedError
      • getBasicBlock

        public SSACFG.BasicBlock getBasicBlock​(int bb)
        Returns:
        the basic block with a particular number