Skip to content

Writing an IDE Analysis

LinusJungemann edited this page Jul 27, 2020 · 7 revisions

When writing an IDE analysis one only has to implement a single class as well. The general concept is very similar to writing an IFDS analysis. But this time the analysis class has to inherit from DefaultIDETabulationProblem or LLVMDefaultIDETabulationProblem. 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 top element of the underlying lattice that the analysis uses -> meaning 'no information at all'
  • bottomElement()

    • A function that returns the bottom 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 top value.
  • 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 EdgeFunctionPtrType as a return type. This type provides a very efficient and low overhead edge function implementation. It also includes a builtin way to let the framework do the memory management for all edge functions. To use this memory manager use getEFMM().make_edge_function<FLOWFUNCTIONTYPE>(FLOWFUNCTIONPARAMS) to construct a new edge function that is directly managed by the edge function memory manager. This is not necessary for the special singleton edge functions such as EdgeIdentity<l_t>. For these, just use the static member function getInstance().

composeWith and joinwith

The edge function member functions composeWith and joinWith have to be provided with a reference to the EdgeFunctionManager. This parameter is used to provide memory management for the results and temporary edge functions that are created in these two functions. The reference of the MemoryManager can be used exactly like the result of getEFMM(), which means the factory method make_edge_function<FLOWFUNCTIONTYPE>(FLOWFUNCTIONPARAMS) can also be used directly in custom edge functions.

Clone this wiki locally