138 Commits

Author SHA1 Message Date
Fredrik Dahlgren
064dbf6c6e Make file IDs optional to support testing 2022-07-02 09:42:55 +02:00
Fredrik Dahlgren
edb3269603 Added signal tracking to VariableMeta 2022-07-02 09:42:01 +02:00
Fredrik Dahlgren
a277368896 Changed Cfg::into_ssa to return self 2022-07-02 09:40:45 +02:00
Fredrik Dahlgren
97e243d91b Don't version arrays. 2022-07-01 12:13:08 +02:00
Fredrik Dahlgren
b8da577f00 Bug fix in declaration map generation.
After SSA, only variables are in the environment, which meant that `Cfg::into_ssa` would panic if it tried to update the declaration for a signal or component.
2022-05-27 15:00:50 +02:00
Fredrik Dahlgren
a9ccef75da Removed Declaration enum variant from IR.
Declarations are now tracked by the CFG header. The set of declared variables is obtained by calling `Cfg::get_variables()`, and the declaration for variable `v` can be obtained by calling `Cfg::get_declaration(v)`.
2022-05-27 14:33:10 +02:00
Fredrik Dahlgren
552464b334 Fixed Clippy lints. 2022-05-27 10:02:45 +02:00
Fredrik Dahlgren
bd872ea92a Cargo fmt. 2022-05-27 09:41:22 +02:00
Fredrik Dahlgren
4493d30b5f Rewrote SSA traits to take the environment as a generic parameter
The previous SSA environment trait was strongly tied to the actual implementation and could not be easily replaced. This makes the implementation more loosely coupled. At the same time, this fixes an issue in the SSA generation algorithm where the current version was not tracked correctly.
2022-05-27 09:32:45 +02:00
Fredrik Dahlgren
ee090f6080 Multiple bug fixes in CFG generation.
This commit fixes a number of issues related to how the predecessor set was propagated when handling nested conditional statements.
2022-05-27 09:29:02 +02:00
Fredrik Dahlgren
029fab2418 Bug fix in CFG generation.
The previous implementation visited the true branch twice rather than visiting the false branch.
2022-05-27 09:24:00 +02:00
Fredrik Dahlgren
1d948b547d Removed old DominatorTree implementation. 2022-05-27 09:18:57 +02:00
Fredrik Dahlgren
e79b3be970 Added TryFrom<&Definition> for (Cfg, ReportCollection)
This is used to parse strings into CFGs for unit testing.
2022-05-27 09:18:20 +02:00
Fredrik Dahlgren
77291e8f97 Added Cfg::get_basic_blocks(). 2022-05-27 09:12:57 +02:00
Fredrik Dahlgren
14d577795f SSA generation now propagates values automatically. 2022-05-27 09:12:32 +02:00
Fredrik Dahlgren
e24cc10869 Added missing DirectedGraphNode dependency to basic_block.rs. 2022-05-27 09:07:08 +02:00
Fredrik Dahlgren
fddc5aebbf Replaced quotes with backticks in log messages. 2022-05-27 08:53:26 +02:00
Fredrik Dahlgren
e314934e18 Bug fix in BasicBlock::is_empty. 2022-05-27 08:47:27 +02:00
Fredrik Dahlgren
3fed5bc136 Implemented constant value propagation
Added constant value propagation for expressions. This is used to implement the constant conditional analysis pass.
2022-05-27 08:46:39 +02:00
Fredrik Dahlgren
70da75a561 Moved ValueMeta and VariableMeta from CFG to IR module. 2022-05-27 08:39:40 +02:00
Fredrik Dahlgren
43b16bf0f5 Fixed Clippy suggestions. 2022-05-27 08:35:56 +02:00
Fredrik Dahlgren
8559b7758a Removed directed_graph.rs from utils. 2022-05-27 08:28:12 +02:00
Fredrik Dahlgren
a2fab1e6c7 Fixed issue with ShadowingVariableWarning
When gneerating a new `ShadowingVariableWarning` the primary label claimed to reference the shadowing variable, but was in fact referencing the shadowed variable.
2022-05-23 15:39:35 +02:00
Fredrik Dahlgren
5a1aedab7e Reformatted logging and report messages to
Report messages are now capitalized. Log messages use back ticks instead of single quotes for IR node names like statements and individual expressions.
2022-05-23 15:32:49 +02:00
Fredrik Dahlgren
781791e26b Added initial Sarif export
It is now possible to export analysis output to a Sarif file by passing the command line option `--sarif-file <OUTPUT_FILE>` to circomspect.
2022-05-23 15:26:38 +02:00
Fredrik Dahlgren
8c93b03e90 Added initial analysis passes. 2022-05-20 13:25:31 +02:00
Fredrik Dahlgren
aed9896570 Reorganized CFG and IR module APIs. 2022-05-20 13:24:22 +02:00
Fredrik Dahlgren
2f9424dd09 Only output color when writing to a tty. 2022-05-20 13:22:50 +02:00
Fredrik Dahlgren
3405bde70b Added must_use decorations and proptest for VariableName. 2022-05-20 13:21:43 +02:00
Fredrik Dahlgren
4244a51461 Renamed all uppercase acronyms. 2022-05-20 13:20:17 +02:00
Fredrik Dahlgren
3c91780b88 Use VariableNames to track variables rather than Strings. 2022-05-20 13:17:44 +02:00
Fredrik Dahlgren
acd52d463a Removed greek phi's because Clippy said so. 2022-05-20 13:15:00 +02:00
Fredrik Dahlgren
d624d00c61 Added doctests for NonEmptyVec. 2022-05-20 13:12:06 +02:00
Fredrik Dahlgren
c05b96c49b Added analysis pass finding all field element comparisons. 2022-05-17 18:29:42 +02:00
Fredrik Dahlgren
8c9dc7b95e Moved intermediate representation into separate module. 2022-05-17 13:24:02 +02:00
Fredrik Dahlgren
ff925f6b60 Commited initial version of SSA. 2022-05-17 12:57:15 +02:00
Fredrik Dahlgren
c71079c580 Added initial version of SSA. 2022-04-07 17:03:29 +02:00
Fredrik Dahlgren
240f38cd46 Initial commit. 2022-03-10 13:38:24 +01:00