The loop creating the labes in `BinaryFile::parseELF` was badly indent
and resulted in the creation of labels only if the `.dynamic` section
was available.
`JumpTargetManager::purgeTranslation` deletes some basic blocks that
need to re-translated, however references to some instructions remained
in `OriginalInstructionAddresses`.
* Drop unused argument names from function prototypes
* Make `static` some methods
* Disable some copy constructors
* Fix casing of Doxygen `\file` directives
* Add some casts to make the compiler happy
* Initialize `hasRelocationAddend` for AArch64
* Use references in range-for where possible
* Drop default for `switch` statements covering all the entries of an `enum`
* Make some global variables `static`
* Drop dead functions
LLVM already implements an analogous `mapped_iterator` type in
`STLExtras.h` header. `llvm::mapped_iterator` has been used to
substitute `TransformIterator` in the project so that we don't need to
reinvent the wheel.
Before this commit, the `dumpToString()` function defined in
`include/revng/Support/IRHelpers.h` was only defined with arguments of
type `const llvm::Module *` and `const llvm::Value *`.
This is not very ergonomic, because lots of types in LLVM have a
`print()` method that dumps the representation on a
`llvm::raw_ostream``.
This commit introduces function templates to handle all possible types
in LLVM that have a method `void print(llvm::raw_ostream &)`.
The templates are defined so that they should work with every possible
combination of references and pointer types, along with const
qualifiers.
To achieve this, the code makes use of `std::enable_if`` to provide
different definitions of the `dumpToString()` template helper function,
which only participate in overload resolution for specific types:
1. for `llvm::Module` and `llvm::Function`, which share the same
prototype for the `print()` method
2. for `llvm::Value` which has yet another prototype for the `print()`
method
3. for all other types that provide a method with the signature
`void print(llvm::raw_ostream &)`.
The last implementation (3) also works for all non-LLVM types provide a
method with the signature `void print(llvm::raw_ostream &)`.
In this sense, if in the future we want our own type to be easily dumped
to string (handy for logging), we can just implement the method
`void print(llvm::raw_ostream &)` and the `dumpToString()` function
template added in this commit will work out ot the box.
Handle `ConstantPointerNull` explicitly in Advanced Value Info, instead
of trying to obtain the analysis result for its operand (which is by
design a `nullptr`).
Before this commit, the header `revng/Support/DebugHelper.h` could only
be included after explicitly including
`llvm/IR/AssemblyAnnotationWriter.h`, since `DebugHelper.h` used the
LLVM class `AssemblyAnnotationWriter`, that is not defined in
`DebugHelper.h`.
This commit includes `llvm/IR/AssemblyAnnotationWriter.h` directly into
`revng/Support/DebugHelper.h`, which can now be included alone without
compilation errors.
This commit performs the changes necessary in order to integrate with
revng-qa, the new project for cross-project quality assurance.
Basically, the source code of all the tests has been moved in revng-qa,
which will take care of producing "artifacts" (i.e., compiled programs),
using the appropriate cross-compilers.
revng will then consume them and produce new artifacts to be consumed by
other tools down the pipeline.
The directory structure of the tests has been reworked to reflect
`revng-qa`. A large amount of boilerplate code has been dropped.
Note that certain actions, that used to be carried out during testing,
are now part of the regular build process. Specifically, lifting the
tests is performed at build time, so that they can be installed.
At this point, this branch is guaranteed to build without warnings with
our two supported compilers: clang-9 and gcc-9.
The dependencies are:
- llvm-9
- clang-9
- boost-1.71
- c++2a
This commit does three things.
- Removes explicit dependency from boost version 1.63. This is no longer
necessary since orchestra has moved to compiling boost test directly,
and ships version 1.71 (as of now).
- Switches UnitTests.cmake to using modern cmake package for
Boost::unit_test_framework
- Adds an header copied from revng, to define
boost::throw_exception(std::exception const &E)
This is necessary to compile with -fno-exception and boost
unit_test_framework.
Introduced various untangle algorithm improvements:
- Improve untangle edge reorganization: improve the criterion used for
reorganizing the edges between the old postdominator and the cloned
one, after an inline procedure is attempted during the untangle.
- Untangle counter: introduce two new counters which take into account
the number of times the untangle procedure is attempted and the actual
times it is performed.
- Disable not dominated restriction: disable the criterion which
restricts the untangle opportunities if we do not dominate entirely
at least one of the two branches. This has likely broken the
assumption that the postdominators of nodes do not changes after each
untangle step has been carried out.
- Change dominance criterion: the dominance of the nodes belonging to
the `then` and `else` nodes is now checked not with respect to the
conditional node, but to the `then` and `else` edges of the conditional
node.
- Untangle eager inlining: now, when the untangle procedure finds a
suitable candidate for the inlining, proceed the complete inlining
starting from the selected branch. By default new clones of all the
nodes till the exit are created and attached to the branch, while the
original nodes are detached. An additional pass which removes eventual
dandling nodes (nodes which are not reachable from the entry node of
the graph) is performed after the eager inlining. This means that if
no other incoming edges to this group of nodes is present the original
nodes will be purged.
The post dominator now is updated during the inlining analysis, and
the paths conducting to inlined exits are not taken into account for
the post dominator computation.
- Enable untangle for mixed branches: perform the untangle even if the
`then` and `else` branches share nodes. This was not feasible before
because without the eager inlining we couldn't decide which edge to
attach to the new postdominator clone. This problem is not present
anymore, so we can handle any kind of topology in the untangle.
- Improved also the analysis information serialized by the decompiler.
Add a flag to enable the decompilation of a single function.
In order to have a single flag shared between the `RestructureCFGPass`
and the `CDecompilerPass`, we added a new dedicated decompilation unit
called `TargetFunctionOption`.
This commits make the use of Loggers in revng-c more idiomatic, while
removing calls to the method, which clashes with the Qt emit keyword.
This is important, because this clash prevents integration of revng-c
into the GUI, which is written in Qt.
A `ConstantRange` such as `[5,0)` was not handled correctly in
`ConstantRangeSet` due to a spurious 0 at the end of the range.
This commit also fixes the testing infrastructure that was not checking
the size of the range before making the comparison with the reference
vector.