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.
Switch from specifying `libraries` and `pipelines` in `rp_initialize`
and `rp_manager_create` to the use of command-line options that are to
be passed via `argc` and `argv` in `rp_initialize`.
This commit does 2 main things:
* Adds PYTHONMALLOC=1 environment variable when `--valgrind` is used
to force python to use normal malloc instead of the custom allocator
python normally uses that's not friendly with valgrind
* Add a suppression file to remove a couple of false-positives that
happen consistently and generate useless noise
If needed, wrap the execution of scripts in `exec` to allow running
them with gdb. This is especially useful for running python scripts
that use cffi and being able to inspect the C/C++ side.
There was a codepath in `revng-check-conventions` that would cause
`fail(e)` to be called twice. This would cause an exception on the
second invocation due to the undelying process being already terminated.
A bug introduced no loop promotion by mistake, we now correctly exit the
loop promotion routine if the loop has been already promoted to `while`
or `do-while` loop.
This commit teaches getExpectedModelType about the fact that various
bitwise operations are only allowed to have integer operands.
It also updates VMA, which uses getExpectedModelType, to take this
into account.
In SegregateStackAccesses sometimes we have to replace a call whose call
type does not match the callee type. Specifically when the return type
is a `StructType`, sometimes the call returns an identical `StructType`,
but with a different identity.
This commit adapts the return type of new calls on the fly.
This pass splits calls `*.with.overflow*` intrinsics into the a pair of
instructions: the underlying operation and a call to an `Helper`-tagged
function that computes whether such operation overflowed.
For instance, we go from:
%2 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%3 = extractvalue { i32, i1 } %2, 1
br i1 %3, label %..., label %...
To:
%2 = mul i32 %0, %1
%3 = call i1 @mul_overflow_u32(i32 %0, i32 %1)
br i1 %3, label %..., label %...
This saves from handling `struct` in the backend.
This pass turns phis of invocations of pure functions into an invocation
of the pure functions with one phis per argument of the original
invocations.
This makes handling phis easier in the backend and is necessary after
the introduction of simplify-cfg with sinking enabled.
SegregateStackAccesses creates new functions. Iterating over existing
functions while creating new ones is problematic, so we now first
collect all the functions we want to inspect and then process them.
This commit introduces modelType, which supersedes `llvmIntToModelType`
in order to better handle translation of LLVM types into model types
after introduction of opaque pointer types. The main differences is
that `modelType` accepts the `Value` (instead of just the `Type`), so it
can better handle `AllocaInst` and `GlobalVariable`, which provide
information about the pointee.
Since MakeModelGEP works Use-wise, if a `Value` was used multiple times
in a phi, we used to replace them with distinct model GEPs. This led to
generate illegal IR.
This commit fixes this situation by detecting the situation and reusing
the same model GEP.