In ModelToHeader generate Inline Types in PTML by handling
Structs, Unions and Enums.
In addition, during the ModelToHeader we avoid producing
Structs that describe stacks, and in the DecompileFunction we
produce the definition of it inline if it is safe (referenced
only once).
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.
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
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).
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.
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(...)`
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.
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.
This commit changes MarkAssignments (and related tests) so that now
instruction with more than one use are not assigned to a new variable
by default.
In some cases it might still be good to serialize them for readability,
but for those cases we will implementa a standalone pass that only
implements heuristics based on readability.
MarkAssignments now only takes decisions based on semantics of
side-effects.
Add support for tracing onto the PipelineC. This is done by:
1. Creating wrapper functions for each PipelineC function with the
script in `scripts/PipelineC_add_tracing.py`. These will call a
special function called `wrap` which will ultimately call a method
with a `_` prepended to the name
2. Conversion of all PipelineC methods in `PipelineC.cpp` to `static`
and their rename with a `_` in front, in order for them to work with
the wrapper function in (1)
3. Generation of 2 additional include files, one for types and one for
functions, to be used by users of tracing files in order to have
introspection.
These steps allow the creation of a trace file with the use of the
`REVNG_C_API_TRACE_PATH` environment variable. The traces can then be
used in conjunction with the `revng trace run` and `revng trace
inspect` commands.
Many Pipeline objects (Globals, Ranks, Kinds, Targets in a TargetList)
were ordered by load order, this makes the playback of traces difficult.
Moreover the order of loading of pipeline files also influences the
ordering of other elements (Step, Analys{is,esLists}). These are also
ordered to prevent incosistent ordering.