Class FunctionCallSizeInfo


  • public class FunctionCallSizeInfo
    extends Object
    Auxiliary data structure to hold function call summaries in terms of information about number of function calls, consistent dimensions, consistent sparsity, and dimension-preserving functions.
    • Constructor Detail

      • FunctionCallSizeInfo

        public FunctionCallSizeInfo​(FunctionCallGraph fgraph)
        Constructs the function call summary for all functions reachable from the main program.
        Parameters:
        fgraph - function call graph
      • FunctionCallSizeInfo

        public FunctionCallSizeInfo​(FunctionCallGraph fgraph,
                                    boolean init)
        Constructs the function call summary for all functions reachable from the main program.
        Parameters:
        fgraph - function call graph
        init - initialize function candidates
    • Method Detail

      • getFunctionCallCount

        public int getFunctionCallCount​(String fkey)
        Gets the number of function calls to a given function.
        Parameters:
        fkey - function key
        Returns:
        number of function calls
      • isValidFunction

        public boolean isValidFunction​(String fkey)
        Indicates if the given function is valid for statistics propagation.
        Parameters:
        fkey - function key
        Returns:
        true if valid
      • getValidFunctions

        public Set<String> getValidFunctions()
        Gets the set of functions that are valid for statistics propagation.
        Returns:
        set of function keys
      • getInvalidFunctions

        public Set<String> getInvalidFunctions()
        Gets the set of functions that are invalid for statistics propagation. This is literally the set of reachable functions minus the set of valid functions.
        Returns:
        set of function keys.
      • addDimsPreservingFunction

        public void addDimsPreservingFunction​(String fkey)
        Adds a function to the set of dimension-preserving functions.
        Parameters:
        fkey - function key
      • getDimsPreservingFunctions

        public Set<String> getDimsPreservingFunctions()
        Gets the set of dimension-preserving functions, i.e., functions with one matrix input and output of equal dimension sizes.
        Returns:
        set of function keys
      • isDimsPreservingFunction

        public boolean isDimsPreservingFunction​(String fkey)
        Indicates if the given function belongs to the set of dimension-preserving functions.
        Parameters:
        fkey - function key
        Returns:
        true if the function is dimension-preserving
      • isSafeNnz

        public boolean isSafeNnz​(String fkey,
                                 int pos)
        Indicates if the given function input allows for safe nnz propagation, i.e., all function calls have a consistent number of non-zeros.
        Parameters:
        fkey - function key
        pos - function input position
        Returns:
        true if nnz can safely be propagated
      • hasSafeLiterals

        public boolean hasSafeLiterals​(String fkey)
        Indicates if the given function has at least one input that allows for safe literal propagation and replacement, i.e., all function calls have consistent literal inputs.
        Parameters:
        fkey - function key
        Returns:
        true if a literal can be safely propagated
      • isSafeLiteral

        public boolean isSafeLiteral​(String fkey,
                                     int pos)
        Indicates if the given function input allows for safe literal propagation and replacement, i.e., all function calls have consistent literal inputs.
        Parameters:
        fkey - function key
        pos - function input position
        Returns:
        true if literal that can be safely propagated
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object