Commit Graph

6113 Commits

Author SHA1 Message Date
Alessandro Di Federico 628aa42cc2 Introduce collectTypes 2023-04-28 14:04:31 +02:00
Alessandro Di Federico 170749b0aa Introduce revng::verify 2023-04-28 14:04:31 +02:00
Alessandro Di Federico 0f2b35a632 Adopt new InitRevng signature 2023-04-28 13:54:12 +02:00
Alessandro Di Federico ff6352bab4 Add missing headers 2023-04-28 13:54:12 +02:00
Alessandro Di Federico a823db7ea7 Adopt revng::verify 2023-04-28 13:54:12 +02:00
Alessandro Di Federico 0e6344ce44 Minor changes 2023-04-28 13:33:08 +02:00
Alessandro Di Federico 564843165b tuple_tree.ts: refine ParsableType interface
Fixes an issue that was detected in recent typescript versions where the
`Parsable` interface was not fully defined.
2023-04-28 09:56:06 +02:00
Pietro Fezzardi 503bfd8056 DecompileFunction: drop wrong constant PTML tags
These were a leftover of when `UnaryMinus` and `BinaryNot` were thought
of as only applied to constants, but this is not the case anymore.
2023-04-28 08:16:46 +02:00
Alessandro Di Federico ade402c44d Merge branch 'feature/lift-performance' 2023-04-27 21:07:28 +02:00
Djordje Todorovic c9b2ffaf72 JumpTargetManager: improve data structures
This commit adopts `llvm::DenseSet`, `llvm::DenseMap` and
`std::unordered_set` where needed.
It also tweaks some `llvm::SmallVector` sizes.

It brings an additional ~3% improvement during lifting.
2023-04-27 19:22:03 +02:00
Djordje Todorovic e43fe18021 harvestWithAVI: split up in multiple functions 2023-04-27 19:22:00 +02:00
Djordje Todorovic 3f495d2bc3 harvestWithAVI: run InstCombine only once 2023-04-27 19:16:07 +02:00
Djordje Todorovic 07cd786ec4 Preliminary harvesting: disable InstCombine
Saves up to ~50% of time.
2023-04-27 19:16:07 +02:00
Djordje Todorovic 0604bc4d19 harvestWithAVI: limit InstCombine iterations to 1 2023-04-27 19:16:07 +02:00
Djordje Todorovic 872f14fad4 harvestWithAVI: disable GVN
This commit disables GVN in order to improve lifting performance.

It also increases `EarlyCSEMssaOptCap` so we keep catching all the jump
target we used to.

Lifting /bin/bash goes from ~29mins to ~5mins
2023-04-27 19:16:07 +02:00
Djordje Todorovic 37ab350102 Minor changes 2023-04-27 19:16:07 +02:00
Alessandro Di Federico 64dd348540 Merge branch 'feature/decouple-layouter-from-yield' 2023-04-27 18:23:45 +02:00
Ivan Krysak b2916e946f Yield: retire the old Graph 2023-04-27 18:12:52 +02:00
Ivan Krysak a532f738e2 Yield: switch to new layouter invocation style 2023-04-27 18:12:28 +02:00
Ivan Krysak 04cac0018d Yield: introduce new control flow graph type 2023-04-27 18:12:25 +02:00
Ivan Krysak 3774c9a3ab Yield: introduce new call graph type 2023-04-27 18:12:21 +02:00
Ivan Krysak 42a9d95702 Sugiyama: improve artificial entry cleanup
Before this fix, graph preparation sometimes left extra long-edges not
connected to anything in. They were not visible after the SVG
exportation, but they were making edge routing worse (by forcing
horizontal lanes to appear where they shouldn't be - thus spacing nodes
further away from each other than necessary).
2023-04-27 18:12:11 +02:00
Ivan Krysak f57ca5793e Sugiyama: be extra strict when discarding nodes
This makes sure the "owning" piece of the edge is never discarded as
a part of streamlining the layers.
2023-04-27 18:11:57 +02:00
Ivan Krysak 8270f5b3e5 Sugiyama: separate edge restoration
Since the `orderEdges` function no longer consumes the graph, we can
finally make the restoration step separate - leading to more explicitly
stated boundaries as to where the graph is a DAG, and where it is not.
2023-04-27 18:11:32 +02:00
Ivan Krysak a04f88c402 Sugiyama: bring the documentation up to date 2023-04-27 18:11:06 +02:00
Ivan Krysak c5805a754a Sugiyama: switch to the new internal graph 2023-04-27 18:10:06 +02:00
Ivan Krysak 52cfbe9523 Sugiyama: introduce new internal graph 2023-04-27 18:09:58 +02:00
Ivan Krysak 4cef969b96 Layout: introduce InputGraph and OutputGraph 2023-04-27 18:09:53 +02:00
Ivan Krysak 28574a87bc Yield: switch to layout's position and size 2023-04-27 18:09:38 +02:00
Ivan Krysak 1c2efd09db Layout: introduce LayoutableGraphTraits 2023-04-27 17:28:22 +02:00
Ivan Krysak 58ddbd36e3 Sugiyama: rename InternalGraph into Helpers 2023-04-27 17:28:22 +02:00
Ivan Krysak 3b700f7820 Sugiyama: Rename Layout into InternalCompute
Also renames `calculateSugiyamaLayout()` into `computeInternal()`.
2023-04-27 17:28:22 +02:00
Ivan Krysak 00b450a8c2 Sugiyama: move the namespace under layout
Also removed a few entities to avoid duplication in the full names:
- `yield::layout::sugiyama::LayoutOrientation`
  -> `yield::layout::sugiyama::Orientation`
- `yield::layout::sugiyama::layout(...)`
  -> `yield::layout::sugiyama::compute(...)`
2023-04-27 17:28:22 +02:00
Ivan Krysak 44b9bfd04c Yield: SugiyamaStyle as a part of GraphLayout 2023-04-27 17:28:22 +02:00
Ivan Krysak 268f53cdeb Sugiyama: move the "main" file inside the layouter 2023-04-27 17:28:22 +02:00
Ivan Krysak 6d43876e78 SVG: move one of the sugiyama::layout overloads
It isn't generic enough to be kept in the header, so it was moved
closer to its users.
2023-04-27 17:28:22 +02:00
Ivan Krysak 0de7e3540f Sugiyama: move DAG converter to getBackedges 2023-04-27 17:28:22 +02:00
Andrea Gussoni 7a92d70b8c Introduce llvm::dfs usage for graph algorithms
Implement a couple of restructure algorithms in a template manner, so
that they can be used with any data structure implementing
`GraphTraits`.

Test the algorithms using the `GenericGraph` data structure.
2023-04-27 17:28:22 +02:00
Ivan Krysak 5034488766 GenericGraph: hasSuccessor and hasPredecessor
Older node types didn't have these helpers, so they were added
for compatibility.
2023-04-27 17:28:22 +02:00
Ivan Krysak 49d3499b26 EFA: fix buildControlFlowGraph requirements 2023-04-27 17:28:22 +02:00
Ivan Krysak 7ca012dbc3 Minor improvements 2023-04-27 17:28:22 +02:00
Alessandro Di Federico dba6f8d257 Merge branch 'feature/model-tracking' 2023-04-27 16:44:37 +02:00
Massimo Fioravanti 80248711b4 Update revng-c to use TrackingSortedVector
The revng model is now composed of TrackingSortedVector instead of
SortedVector, and thus uses in revng-c must be updated.
2023-04-26 18:00:42 +02:00
Massimo Fioravanti 69aafd4181 TupleTree: implement tracking data manipulation
Implement the core visits that are able to inspect the model bypassing
the instrumentation.
2023-04-21 17:51:05 +02:00
Massimo Fioravanti 254dc99fcb TupleTreeGenerator: emit tracking machinery 2023-04-21 17:50:16 +02:00
Massimo Fioravanti d65d73359d TrackingContainer: review API 2023-04-21 17:49:26 +02:00
Pietro Fezzardi cf07e1041c Merge 'feature/reduce-number-of-local-variables' 2023-04-20 17:52:04 +02:00
Pietro Fezzardi 53d35e7df9 AddAssignmentMarkerPass: fix Copy(LocalVariable)
Before this commit, the pattern Copy(LocalVariable) used to generate
unnecessarily redundant additional LocalVariables.

This commit fixes this problem, indroducing reuse of local variables
when possible.
2023-04-20 17:51:16 +02:00
Pietro Fezzardi 17cbe341c6 Remove DuplicateReferences from pipeline
The pass was necessary to prevent the creation of local variables with
reference types, caused by calls to custom opcodes tagged with
FunctionTags::IsRef.
These local variables would not be valid for decompilation, because C
doesn't have reference types.
However, creation of such variables would pop up if not deduplicated,
due to the fact these calls could have many uses, and MarkAssignments
had a policy of marking for serialization all the instructions with many
uses.
Now that policy has been dropped, so this pass doesn't need to exist
anymore.
2023-04-20 17:51:16 +02:00
Pietro Fezzardi 9bbafa9da4 ExitSSA: group PHI in equivalence classes
Each equivalence class informally represents a set of PHINodes for which
we want to emit a single alloca.
2023-04-20 17:51:16 +02:00