ModelGEP calls in LLVM IR now return an integer that has the same
size of the field being addressed by the ModelGEP.
AddressOf calls, instead, can accept any integer size as argument but
always return a pointer-sized integer.
Add `ReadsMemory` and `WritesMemory` Tags and restructure the
logic that decides whether two instructions are interfering
as follows:
1. Consider `Store`s and anything with a `WritesMemory` tag as
having side effects
2. Consider all the `TaintSet` of an instruction when deciding
if two instructions interfere
3. Consider both `ReadsMemory` and `WritesMemory` Tags when
deciding interference
Add `ReadOnly` and `InaccessibleMemOnly` attributes to the following
functions:
- `revng_stack_frame`
- `revng_call_stack_arguments`
- `ModelGEP`
- `AddressOf`
This prevents `CSE` from grouping together any of these calls, while
still enabling `DCE` to remove calls that are not used.
A simple pass that maps LLVM IR instructions to C operators,
taking into account their precedence and associativity to
emit nice-looking parenthesized expressions.
A pass that strips the casts off from some instructions, including
`ModelGEP`s, general function calls, return and store ones, and
embeds the cast into new dedicated `ModelCast` function calls.
Calls to `OpaqueExtractValue()` are meant to replace `extractvalue`s
found in the LLVM IR. Since the type of an `OpaqueExtractValue` is
identified by both the return type (extracted value) and the first
argument's type (aggregate operand of the `extractvalue` instruction),
we need to consider both when building the associated FunctionPool.
Previously, we were identifying each `OpaqueExtractValue` variant using
only the returned value, which was wrong. In fact, if we have two
`extractvalue` instructions that extract a value of the same type
(e.g. i32) from two different aggregate types (e.g. structA and
structB), we have to define two different `OpaqueExtractValue`: one
that returns an i32 and has a parameter of type structA, and one that
returns an i32 and has a parameter of structB. If we use only the
return type, we are not able to distinguish the two.
This library replaces the old AddIRSerializationMarkers, cleaning up a
lot of historcal baggage, merging Liveness and MarkAnalysis, and
adopting a more accurate naming across all the codebase.
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
* RemoveExtractValues transforms every `extractvalue` instruction
into an opaque call. This prevents the optimization pipeline from
moving around and optimizing `extractvalue`s, since they have a
particular meaning in our IR
* RestoreExtractValues transforms such opaque calls back to regular
`extractvalue`s at the end of the pipeline
We used to collect all binaries into the `bin/` directory. However this
led to confusions since certain commands where available both as
`revng-command` and `revng command`.
This commit moves all the executables except `revng` into
`libexec/revng`, which, according to FHS, is dedicated to "internal
binaries that are not intended to be executed directly by users or shell
scripts".
This is a big step to split revng-lift in two parts: one that only
writes the model and one that actually lifts to LLVM IR.
* Introduce `revng import binary`
* Split off `BinaryFile.h`
* Drop `revng.h`
* `GeneratedCodeBasicInfo`: use model
* Reduce role of `GeneratedCodeBasicInfo` in favor of
`model::Architecture` and `model::Register` methods
* `CodeGenerator`: adopt `RawBinaryView` and model
* `JumpTargetManager`: adopt `RawBinaryView` and model
* `ExternalJumpsHandler`: adopt model
* `InstructionTranslator`: discard `Architecture` in favor of
`EndianessMismatch`
* Many other changes
In order to enable the optimizer to strip dead calls, ModelGEP,
SerializationMarker and AddressOf functions are marked as
`ReadNone` instead of `InaccessibleMemOnly`.
Separate `ModelToHeader.cpp` into 3 different files:
1. DependencyGraph, used to calculate the precedence between
type declarations
2. ModelTypeNames, that holds all the naming logic, whose
primitives are accessible from other modules through a
public header
3. ModelToHeader, that now contains only the logic to print
out declarations and definitions
Also add a compilation test for the headers generated by this pass.
renvg.h should not use model headers, however, currently it does. This,
combined with the fact that the revngSupport library did not depend on
revngModel or the header generation led to non-deterministic build
failures.
Before this commit the bug can be found by:
orc clean revng
orc uninstall revng
orc configure revng
orc shell -c revng ninja renvgSupport
The error should manifest itself as some generated headers missing.
The proper fix would be to rewrite revng.h so that it does not uses the
model.
This commit adds a second argument to functions in the family of
SerializationMarker. The second argument is a boolean.
If it's true, it represents the information that the marked
llvm::Instruction was marked because it had side effects.
This information is necessary for various beautification tasks on the
GHAST, and we want it on the IR in order to be able to switch away from
the old MarkForSerializationPass.