Skip to content

Writing an IDE Analysis

Fabian Schiebel edited this page Jun 17, 2023 · 6 revisions

When writing an IDE analysis one only has to implement a single class, similar to IFDS. The general concept is very similar to writing an IFDS analysis. But this time the analysis inherits from IDETabulationProblem. In addition to this documentation, please also refer to the built-in implementations of IDE data-flow analyses in PhASAR such as the IDELinearConstantAnalysis.

The member functions you a user has to provide implementations for are:

  • getNormalFlowFunction()

    • See Writing an IFDS analysis
  • getCallFlowFuntion()

    • See writing an IFDS analysis
  • getRetFlowFunction()

    • See writing an IFDS analysis
  • getCallToRetFlowFunction()

    • See writing an IFDS analysis
  • Optional: getSummaryFlowFunction()

    • See writing an IFDS analysis
  • initialSeeds()

    • See writing an IFDS analysis
  • topElement()

    • A function that returns the bottom element of the underlying lattice that the analysis uses (yes, we call the bottom-element "top" and vice versa!) -> meaning 'no information at all'
  • bottomElement()

    • A function that returns the top element of the underlying lattice that the analysis is using -> meaning 'all information' (the most imprecise element in the lattice)
  • join()

    • A function that defines how information is joined (the merge operator of the lattice) that gets one higher up in the lattice (making the result less precise).
  • allTopFunction()

    • Function that returns the a special edge function allTop that is the EdgeFunction representation of the topElement.
  • getNormalEdgeFunction()

    • Returns edge functions for the intra-procedural edges that specify computations that are associated with the corresponding exploded super graph edges.
  • getCallEdgeFunction()

    • Expresses the computations for inter-procedural call edges. These edge functions are oftentimes just the identity function as the actual parameters are usually mapped to the formal parameters of the called function.
  • getReturnEdgeFunction()

    • Express the edge functions that are applied to map data-flow facts that hold at the end of a callee back to the caller. Oftentimes this will be implemented as edge identity.
  • getCallToReturnEdgeFunction()

    • Here the edge functions are defined that are applied for data-flow facts that are passed alongsite the call-site.
  • Constructor

    • See Constructor of Writing an IFDS analysis

Please also refer to the IDE analysis IDELinearConstantAnalysis.

Memory Management

For Memory Management of flow functions please refer to "Writing an IFDS Analysis".

Our IDE interface functions, that are used for edge function computation, use the custom type EdgeFunction as a return type. This type provides a very efficient and low overhead type-erasing mechanism for edge functions. All the builtin edge-function implementations as well as you own edge-function classes are implicitly convertible to EdgeFunction<L> as long as you provide implementations for all required API functions. The EdgeFunction class then takes care about lifetime and ownership of the respective edge function. If your edge function types are large (> sizeof(void*)) you may want to check out the EdgeFunctionSingletonCache for caching.

Compose and Join

The edge function member functions compose and join implement function composition and lattice join, respectively. Please consult existing implementations (such as IDELinearConstantAnalysis) for reference.

Clone this wiki locally