Commit Graph

2366 Commits

Author SHA1 Message Date
Qian Matteo Chen 007119af91 [TypeShrinking] Fix comment capitalization 2020-12-23 02:21:56 +01:00
Qian Matteo Chen 8d05cfc440 [TypeShrinking] Visit extremal labels first 2020-12-23 02:21:25 +01:00
Qian Matteo Chen 232c1596ce [TypeShrinking] Split passes in two 2020-12-23 02:20:21 +01:00
Qian Matteo Chen 0893cd824f [TypeShrinking] Handle rooted graphs 2020-12-23 02:19:49 +01:00
Qian Matteo Chen d085560674 [TypeShrinking] Sort nodes using RPOT for MFP 2020-12-23 02:16:07 +01:00
Qian Matteo Chen d6b4bcc185 [TypeShrinking] Allow personalized GraphTrait 2020-12-23 02:13:09 +01:00
Qian Matteo Chen bb8e98bfcb [TypeShrinking] Refactor using ranges .at() 2020-12-23 02:10:16 +01:00
Qian Matteo Chen b0542bbb64 [TypeShrinking] Use concepts in MFP implementation 2020-12-23 01:54:10 +01:00
Qian Matteo Chen 5ee2cdf004 [TypeShrinking] Refactor code
- Use uint32_t
- Define Top as uin32_t max
- Fix copyright notice
- Use using namespace llvm in cpp files
- Change hasSideEffects to isDataFlowSink
- Outline isAddLike
- Add option to ignore certain analysis results
2020-12-23 01:38:52 +01:00
Qian Matteo Chen bd613d5c7f [TypeShrinking] Remove unused files 2020-12-23 01:29:43 +01:00
Qian Matteo Chen 479298d60c [TypeShrinking] Implement type shrinking pass 2020-12-23 01:17:55 +01:00
Qian Matteo Chen fa05ef07f9 [TypeShrinking] Make solving mfp static 2020-12-23 01:09:37 +01:00
Qian Matteo Chen 31b8ed7b14 [TypeShrinking] Move BitLiveness.h to local folder 2020-12-23 01:03:56 +01:00
Qian Matteo Chen ba099220da [TypeShrinking] Add type shrinking mvp 2020-12-23 00:14:03 +01:00
Qian Matteo Chen 86cd1d5505 [TypeShrinking] Add and fix copyright notices 2020-12-22 20:08:06 +01:00
Qian Matteo Chen cccd462b64 [TypeShrinking] Add example of MonotoneFramework 2020-12-22 18:33:24 +01:00
Qian Matteo Chen 60c4e59c6b [TypeShrinking] Refactor MFP to use GraphTraits 2020-12-22 18:30:33 +01:00
Qian Matteo Chen 3d8793fa2a [TypeShrinking] Move implementation to cpp file 2020-12-22 18:19:43 +01:00
Qian Matteo Chen 0bd393a691 [TypeShrinking] Use explicit pointer types 2020-12-22 17:07:51 +01:00
Qian Matteo Chen 473982966b [TypeShrinking] Combine isLess and areEqual 2020-12-22 17:04:55 +01:00
Qian Matteo Chen 335eb24191 [TypeShrinking] Remove c-style comments 2020-12-22 16:58:25 +01:00
Qian Matteo Chen 7feebad315 [TypeShrinking] Add implementation of MFP
See Principles of Program Analysis, Springer 2005, p 75
2020-12-22 16:55:16 +01:00
Qian Matteo Chen c1d144f186 [TypeShrinking] Add pass to print dataflow edges 2020-12-22 16:39:38 +01:00
Pietro Fezzardi ebe43602ac New FilterForDecompilation passes
This commits adds two passes
- FilterForDecompilationFunctionPass deletes the body of a Function if
  it's not a isolated function produced by revng
- FilterForDecompilationModulePass deletes all the bodies of the
  functions that are not isolated functions generated by revng

These passes are used at the beginning of the decompilation pipeline, to
prevent all the passes of the decompilation pipeline to run on root and
other big functions coming from QEMU that do not need to be decompiled.
2020-12-16 18:20:58 +01:00
Pietro Fezzardi 08c76374a2 MakeEnvNullPass is now a FunctionPass
This fixes an issue causing crashes when calling the public API
`decompileFunction`, that was internally adding a `MakeEnvNullPass`
(formerly a `ModulePass`) to a `FunctionPassManager.
2020-12-01 17:34:30 +01:00
Alessandro Di Federico c6d0ce9dec Don't use RPOT for DisjointRanges
Sorting the BasicBlocks on which DisjointRanges works is detrimental for
performance.  Using a random order takes less time. This is due to the
fact that the number of BasicBlocks to analyze is significantly smaller
than the whole list of BasicBlocks.
2020-11-23 14:52:46 +01:00
Pietro Fezzardi d4d8430553 Add MakeEnvNull pass
This pass substitutes the `@env` global variable with a null pointer
`@env` is a pointer to the CPU state in QEMU, and is not meant to be
visible in the decompiled code.
This pass is used to remove all references to it before decompilation.
2020-11-17 14:33:19 +01:00
Pietro Fezzardi 9869f057b9 Use #pragma once for header include guards 2020-11-13 14:12:18 +01:00
Pietro Fezzardi cd9bc34d9d Enforce new include conventions 2020-11-13 10:00:24 +01:00
Alessandro Di Federico ab6c8276f5 AVI: handle pointer as smallest operation 2020-11-12 20:36:02 +01:00
Pietro Fezzardi 429633b627 Use #pragma once for header include guards 2020-11-12 18:00:45 +01:00
Pietro Fezzardi 93d9cbb67b Enforce new include conventions 2020-11-12 18:00:45 +01:00
Alessandro Di Federico 5e7d288530 Introduce PruneRetSuccessors pass
This commit introduces the PruneRetSuccessors pass, whose role is to
identify all the indirect jumps whose devirtualized destinations
correspond to return addresses. In fact, they are most likely to be
return instructions and devirtualizing them is always detrimental.
2020-11-12 15:28:31 +01:00
Pietro Fezzardi fc537a2fc7 Add missing MIT license headers 2020-11-12 14:55:57 +01:00
Alessandro Di Federico 37fde04594 Move licensing details to LICENSE.md 2020-11-09 10:03:33 +01:00
Andrea Gussoni 6c8eb2fd53 ASTTree: remove Successor in sequence creation
When the `Successor` field is consumed to create the `Sequence` nodes,
we blank the field so that we do not have redundant information in our
graph representation.
2020-11-06 15:08:00 +01:00
Andrea Gussoni 1bade3fd88 ASTTree: delete sequence nodes in simplification
When performing `atomicSequenceSimplification`, actually remove the
nodes from the ASTTree.
2020-11-06 15:08:00 +01:00
Andrea Gussoni 5afaa7a90b ASTTree: AST debug printing is now iterative
Change the AST debug printing from a recursive descent on the AST nodes
in the graph, to an iterative printing of respectively nodes and their
outgoing edges.

Also, we now print the edge going to the `Successor` field, if present.
2020-11-06 15:08:00 +01:00
Andrea Gussoni f3f11533b8 ASTTree: Reorganize AST dot printing
Reorganize the AST dot printing in order to use LLVM facilities for
files handling. In addition, clean up the code, and add a function
(useful in debug) in order to dump the dot of and AST from GDB (accepts
a `char *` instead of a `std::string`.
2020-11-06 15:08:00 +01:00
Andrea Gussoni f3df7e2ab1 Fix inclusion order 2020-11-06 15:08:00 +01:00
Andrea Gussoni e6e5c73f62 ASTTree: Remove old version of dumpASTOnFile 2020-11-06 15:08:00 +01:00
Andrea Gussoni df0985f1fc RegionCFG: dumpOnFile to dumpASTOnFile 2020-11-06 15:08:00 +01:00
Andrea Gussoni eb1ddab86c RegionCFG: dumpDotOnFile to dumpCFGOnFile 2020-11-06 15:08:00 +01:00
Andrea Gussoni 7362e7beeb RegionCFG: Reorganize graph debug
Now, when the `debug-log=restructure` flag is active, debug graphs are
organized in a more rational way.

First of all, all the graphs are now put in a single directory, and are
divided first by function name and then by type.

Also, as in the case of the tiling debug graphs, their name is more
consistent with the rest of the codebase.
2020-11-06 15:08:00 +01:00
Pietro Fezzardi e0c5bba880 Drop UnitTestHelpers.h, now shipped by revng 2020-11-06 15:08:00 +01:00
Pietro Fezzardi 217a18edb1 Update copyright notice 2020-11-06 15:07:45 +01:00
Pietro Fezzardi 890d60833b Drop old obsolete RemovePCStoresPass 2020-11-04 09:42:13 +01:00
Pietro Fezzardi 8bfbb153ca libDecompiler: new public API decompileFunction 2020-11-04 09:32:36 +01:00
Pietro Fezzardi 90ff17f107 Fix handling of switch default in GHAST 2020-11-04 09:32:36 +01:00
Andrea Gussoni 6a8a1b613d Combing: fix conditional node edge inlining
Before marking any outgoing edge as inlined, check that the exit nodes
reachable from each successor of the conditional node are two disjoint
sets.
2020-11-04 09:32:36 +01:00