Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up dump mechanism and add an
all
option (#24)
This changes the way dumping is done. It now uses a single `--dump` command line argument that can be specified multiple times and a `DFPP_DUMP` environment argument. Both may also be supplied with a comma separated list of artifacts to dump. Using a single options makes typos much less likely when specifying them via environment arg, because the arguments themselves are checked whereas the env var name is not. This cleans up the presentation for the CLI significantly, from this ``` Debugging and Testing: --dump-call-only-flow Dumps a dot graph representation of the dataflow between function calls calculated for each controller to <name of controller>.call-only-flow.gv [env: DUMP_CALL_ONLY_FLOW=] --dump-callee-mir Dump the MIR (`.mir`) of each called function (irrespective of whether they are a controller) [env: DUMP_CALLEE_MIR=] --dump-ctrl-mir For each controller dump a dot representation for each [`mir::Body`] as provided by rustc [env: DUMP_CTRL_MIR=] --dump-dataflow-analysis-result Dump a `.df` file for each called function describing the dataflow matrices calculated by the flowistry-style dataflow analysis [env: DUMP_DATAFLOW_ANALYSIS_RESULT=] --dump-flowistry-matrix Dumps a table representing retrieved Flowistry matrices to stdout [env: DUMP_FLOWISTRY_MATRIX=] --dump-global-equations Dump the equations after inlining (`.global.eqs`) [env: DUMP_GLOBAL_EQUATIONS=] --dump-inlined-function-flow Dumps a dot graph representation of the finely granular, inlined flow of each controller. Unlike `dump_call_only_flow` this contains also statements and non-call terminators. It is also created differently (using dependency resolution) and has not been tested in a while and shouldn't be relied upon [env: DUMP_INLINED_FUNCTION_FLOW=] --dump-inlined-graph Dump a `.inlined.gv` PDG after inlining called functions, but before pruning [env: DUMP_INLINED_GRAPH=] --dump-inlined-pruned-graph Dump a `.inlined-pruned.gv` PDG for each called function describing the flow graph after pruning with the place algebra (only useful without `--no-pruning`) [env: DUMP_INLINED_PRUNED_GRAPH=] --dump-local-equations Dump the equations before inlining (`.local.eqs`) [env: DUMP_LOCAL_EQUATIONS=] --dump-locals-graph [env: DUMP_LOCALS_GRAPH=] --dump-non-transitive-graph Deprecated alias for `dump_call_only_flow` [env: DUMP_NON_TRANSITIVE_GRAPH=] --dump-pre-inline-graph Dump the flow PDG before inlining the called functions [env: DUMP_PRE_INLINE_GRAPH=] --dump-regal-ir Dump a representation of the "regal" IR for each function (`.regal`) [env: DUMP_REGAL_IR=] --dump-serialized-flow-graph Dump a complete `crate::desc::ProgramDescription` in serialized (json) format to "flow-graph.json". Used for testing [env: DUMP_SERIALIZED_FLOW_GRAPH=] --dump-serialized-non-transitive-graph For each controller dumps the calculated dataflow graphs as well as information about the MIR to <name of controller>.ntgb.json. Can be deserialized with `crate::dbg::read_non_transitive_graph_and_body` [env: DUMP_SERIALIZED_NON_TRANSITIVE_GRAPH=] ``` to this ``` --dump <DUMP> Generate intermediate of various formats and at various stages of compilation. A short description of each value is provided here, for a more comprehensive explanation refer to the [notion page on dumping](https://www.notion.so/justus-adam/Dumping-Intermediate-Representations-4bd66ec11f8f4c459888a8d8cfb10e93). Can also be supplied as a comma-separated list (no spaces) and be set with the `DFPP_DUMP` variable. Possible values: - ctrl-mir: For each controller dump a dot representation for each [`mir::Body`] as provided by rustc - serialized-non-transitive-graph: For each controller dumps the calculated dataflow graphs as well as information about the MIR to <name of controller>.ntgb.json. Can be deserialized with `crate::dbg::read_non_transitive_graph_and_body` - call-only-flow: Dumps a dot graph representation of the dataflow between function calls calculated for each controller to <name of controller>.call-only-flow.gv - serialized-flow-graph: Dump a complete `crate::desc::ProgramDescription` in serialized (json) format to "flow-graph.json". Used for testing - dataflow-analysis-result: Dump a `.df` file for each called function describing the dataflow matrices calculated by the flowistry-style dataflow analysis - inlined-pruned-graph: Dump a `.inlined-pruned.gv` PDG for each called function describing the flow graph after pruning with the place algebra (only useful without `--no-pruning`) - inlined-graph: Dump a `.inlined.gv` PDG after inlining called functions, but before pruning - callee-mir: Dump the MIR (`.mir`) of each called function (irrespective of whether they are a controller) - pre-inline-graph: Dump the flow PDG before inlining the called functions - regal-ir: Dump a representation of the "regal" IR for each function (`.regal`) - local-equations: Dump the equations before inlining (`.local.eqs`) - global-equations: Dump the equations after inlining (`.global.eqs`) - locals-graph - non-transitive-graph: Deprecated alias for `dump_call_only_flow` - all: Dump everything we know of ``` It also adds an `all` option that simply enables all dumps. Changes the test cases to use the new arguments
- Loading branch information