`Alignment` was `unsigned`. However we were doing bit operations,
bitwise negation in particular, which was supposed to happen on
64-bits, to initialize a `ConstantInt` mask.
This commit ensures relocations imported from PE/COFF binaries have
generic `Address`. The fact that this was not the case lead to not
detecting dynamic calls.
The commit also improves logging and fixes the handling of maximum depth
visit of the PDB importer.
Add infrastructure to pypeline that allows containers to be notified
when they are being used last, this allows two things:
* `Pipe`s eagerly clearing those containers once they are done reading
their contents
* `ScheduledTask`s clearing those out at the end of their execution in
case the pipe did not do it
This overall should improve memory usage as container no longer take up
memory if they are no longer used as part of a `Schedule`.
Implement trivial memory optimizations on the `isolate` pipe:
* Clone the `root` module right away to the correct context before
performing isolation
* Delete the `root` function's body right after isolation
* Delete the isolated function body from the cloned module after it has
been `cloneFiltered`-ed into the output container
Fix the behavior of binary importers by propagating the path of the
input binary from revng2 downwards, allowing finding `.debug` files in
the correct paths.
Store the contents of the files deserialized by `BinariesContainer` to
disk via `TemporaryFile`. This also allows some pipes to avoid shuffling
data around since they needed a file on disk anyways.
Sometimes QEMU will emit code that reads a local temporary *before* it
is assigned in the `TranslationBlock`. This usually happens when lifting
non-code, but it's still a problem since it leads to phis around the
dispatcher, which we don't want.
For example, consider the following x86-64 code:
```
0000000140002000 <.text>:
140002000: f0 lock
140002001: 38 00 cmpb %al, (%rax)
```
It leads to:
```
[libtcg] Translation starting from 0x140002000:Generic64
[libtcg] ---- 0000000040002000
[libtcg] mov_i64 loc2,rax
[libtcg] mov_i64 loc1,rax
[libtcg] mov_i64 cc_src,loc1
[libtcg] mov_i64 loc8,loc0
[libtcg] sub_i64 cc_dst,loc0,loc1
[libtcg] discard cc_src2
[libtcg] discard cc_op
```
Note how `loc0` is read before being initialized.
Currently we zero-initialize all the temporaries. It would be in
princple possible to detect those that need the initialization, which
would also enable us to emit a warning.
When initializing `revng::InitRevng` it is assumed by its parent,
`InitLLVM`, that the lifetime of `Argv` and be equivalent to
static, because it might be later retrieved to print it in case of a
crash. This works with the traditional `main`, however in the pipebox
the string passed are not guaranteed to have that lifetime. This commits
moves ownership of the strings to a class that stores them to avoid this
problem.
In the same vein as `PureLLVMPassesPipe`, add a pipe to pypeline that
allows running arbitrarily-specified MLIR passes that do not depend on
the model.
In equivalence with `LLVMFunctionMixin`, add a mixin that allows
writing a pipe that instead of defining the `runOnFunction` method it
defines the `runOnCliftFunction` which receives both the
`module::Function` and the `FunctionOp`.
Add a mixin class for piperuns that work on an LLVM module and need
both the model function and the `llvm::Function`. Pipe that inherit this
mixin will receive both the model and LLVM function in the
`runOnLLVMFunction` method.
Change the `Register.*Pipe` functions to end in `Run` if the template
argument should be a pipe run. Also change the concepts `Is.*Pipe` to
also have the `Run` suffix if applicable.
Make the interface required by `SingleOutputPipe` similar to other
piperuns by requiring a constructor, the use of `PipeRunArgument`s and
the implementation of a non-static `run` function.