summaryrefslogtreecommitdiff
path: root/src/analysis/monotone-analyzer.h
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Add explicit deduction guides for CTAD (#6094)Thomas Lively2023-11-091-0/+4
| | | | | | | | | | | Class template argument deduction (CTAD) is a C++17 feature that allows variables to be declared with class template types without specifying the template parameters. Deduction guides are a mechanism by which template authors can control how the template parameters are inferred when CTAD is used. The Google style guide prohibits the use of CTAD except where template authors opt in to supporting it by providing explicit deduction guides. For compatibility with users adhering to Google style, set the compiler flag to check this condition and add the necessary deduction guides to make the compiler happy again.
* [analysis] Simplify core analysis code (#6034)Thomas Lively2023-10-251-17/+5
| | | | | | | | | | | | | | Simplify the monotone analyzer by replacing all the state it used to store in `BlockState` with a simple vector of lattice elements. Use simple indices to refer to both blocks and their associated states in the vector. Remove the ability for transfer functions to control the initial enqueued order of basic blocks since that was a leaky abstraction. Replace the worklist with a UniqueDeferredQueue since that has generally proven to be more efficient in smiilarly contexts, and more importantly, it has a nicer API. Make miscellaneous simplifications to other code as well. Delete a few unit tests that exposed the order in which blocks were analyzed because they printed intermediate results. These tests should be replaced with tests of analyses' public APIs in the future.
* [analysis][NFC] Create a TransferFunction concept (#6033)Thomas Lively2023-10-201-63/+4
| | | | | | | | | Factor the static assertions for transfer functions out into a new transfer-function.h header. The concept requires the `getDependents` method to return an input range of basic blocks, and to satisfy that requirement, fix up _indirect_ptr_iterator in cfg-impl.h so that it is a proper iterator. Remove part of the lattice fuzzer that was using a placeholder transfer function in a way that does not satisfy the new type constraints; most of that code will be overhauled in the future anyway.
* [analysis][NFC] Use C++20 concepts for Lattice (#6027)Thomas Lively2023-10-181-20/+15
| | | | | | | | | | | | | Replace the static assertions ensuring that Lattice types have the necessary operations with a C++20 concept called `Lattice`. To avoid name conflicts with the new concept, rename existing type parameters named `Lattice` to `L`. When not building with C++20, `Lattice` is a macro that resolves to `typename` so the code continues compiling and has the same behavior, but without any eager checks of the requirements on lattices. Add a new C++20 builder to CI to ensure that future changes compile with both C++17 and C++20. Once we switch to C++20 by default, the new builder can be removed. Update the lint builder to use a recent clang-format that understands concepts.
* Reaching Definitions Analysis for LocalGraph (#5817)Bruce He2023-07-191-8/+29
| | | | | | | | | | | This change implements a reaching definitions analysis which is intended to be equivalent to the information provided by LocalGraph, specifically the Flower class of LocalGraph. It also introduces a CRTP utility in visitor-transfer-function.h which implements most commonly found visitor-type transfer function functionalities. The MonotoneCFGAnalyzer is also modified to add a phase to collect results after the analysis is solved from the final CFG states.
* Small fixes to lattice and analyzer (#5815)Bruce He2023-07-131-1/+0
| | | Updates comments. Moves wasm-traversal.h to transfer function classes.
* Make the Transfer Function a Generic, Interchangeable Type for the Monotone ↵Bruce He2023-07-061-41/+83
| | | | | | | Analyzer (#5794) This change makes the transfer function an object separate from the monotone analyzer. The transfer function class type is a generic template of the monotone analyzer, and an instance of the transfer function is instantiated and then passed into the monotone analyzer via its constructor. The API of the transfer function is enforced by a static assertion. This change also introduces LivenessTransferFunction as a transfer function for liveness analysis as an example.
* Dynamic Sized Bitvector Powerset Lattice for Static Analysis (#5784)Bruce He2023-06-291-23/+22
| | | This change introduces a finite-height powerset lattice FinitePowersetLattice where each element's height is determined when constructed in runtime. This is implemented using a vector of `bools. This change also modifies BlockState and MonotoneCFGAnalyzer to be templated on a generic lattice type instead of using a hardcoded lattice. It additionally fixes an iterator bug in MonotoneCFGAnalyzer::fromCFG which assigned a temporary iterator object as predecessor and successor pointers to BlockStates instead of pointers to actual BlockState objects.
* Liveness Analysis Proof of Concept (#5771)Bruce He2023-06-231-0/+77
This introduces a limited monotone flow-sensitive liveness analysis on local indices as an initial proof of concept for the creation of a monotone flow-sensitive static analysis framework. Tests are included in test/gtest/cfg.cpp.