We used to turn `internal` linkage to the equivalent of C++'s inline.
We need to do the same for `private`. If we don't do this, the number of
`private` variables grows exponentially.
The rule output logic was wrongly coded to do `"\n".join` where
appending a newline to each line was the correct behavior.
Also remove a leftover typo in `rcc-config.yml`.
SegregateStackAccesses and PromoteStackPointer were not handling
functions declarated (but not defined) properly.
This commit fixes this, in part by adopting `TaggedFunctionPass`.
This commit introduces `BasicBlockID` as the unique identifier for a
`efa::BasicBlock` into the CFG. A `BasicBlockID` is defined by a
`MetaAddress` plus an incremental integer. This enables us to have
multiple instances of the same block in a single function, which is
particularly useful when inlining multiple times the same function.
Apart from this, the commit also does the following:
* It drops representing `MetaAddress`es a `structs` in the IR. This created
several issues related to ABI. We now represent them as strings.
* It defines more functions in `support.h`, instead of defining prototypes
by hand in `CodeGenerator.cpp` and the like. Specifically, `unknownPC`
and `raise_exception_helper`. We also introduce a C "constructor" for
`PlainMetaAddress`.
* It significantly reduces the API of `GeneratedCodeBasicInfo`, which
was supposed to be put on a diet since a long time. Specifically,
many jump target related methods have been moved to free functions in
`IRHelpers.h`. Also `GCBI::getSuccessors` has been pushed into its
only user, `PruneRetSuccessors`, to prevent further usage of a
deprecated API. In the future, it would be nice to drop it entirely.
* It introduces `efa::BasicBlock::InlinedFrom`.
* Introduce an enum to represent named argument indices for `newpc`.
This enables us to more effectively manipulate its argument list.
* It improves the verification and error reporting for
`efa::FunctionMetadata`.
* Update tests.
This commit is preliminary to another piece of work to improve the
generality of inlining beyond the simple "fake function" scenario, for
which the feature was originally conceived.
Do not promote registers to `undef` initializers of registers not marked
as being preserved by the current function.
This is useful to highlight usages of registers that are not an
argument, nor a callee saved register. Mainly this has been introduced
to preserved reads from x86-64 `fs` register.
We need to prevent DCE from killing `revng_init_local_sp`, since certain
passes downstream might want to introduce new uses of it, and they might
be the first.
`SegregateStackAccesses` will take care of removing it by hand.
This commit fixes file output `revng.api` in two ways:
* The buffer's size is properly reported in `PipelineC.cpp`
* The function `deserialize_container` in `revng.api.manager` no longer
appends a `\0` to `content`, while avoiding a redundant copy
The `xmlns` attribute outputted contained two sets of `""` (one
introducted by the format string and one from `Tag`) which would break
strict XML parsers
TrackingContainer is a wrapper around KeyedObjectContainers (notably,
SortedVector) intended to figure out which elements of the underlying
container have been accessed.
`DocumentError`s are the inteded way of propagating errors from the
pipeline to the frontend when a location is required to inform the user
of the error whereabouts.
The previous implementation was iterating on the instructions in order.
This caused problems when we had two instructions, A and B, both tagged
IsRef, and B was using A and B had 2 or more uses.
In this case the pass was looking at A before looking at B, so A was not
duplicated because it only had one use (B).
Then B was analyzed and it had 2 uses so it was duplicated, causing the
number of uses of A to increase accordingly.
This commit fixes the problem iterating on the BasicBlocks in post
order, and on the instruction list in reverse order.
It also fixes MarkAssignments.cpp not to erroneously mark instructions
that are marked IsRef.
Using a named metadata is simply wrong, because we need to have many of
these metadata alive at the same time with different values.
Using a named metadata has the unpleasant side effect of making all the
`SegmentRef` functions to refer to the same segment.
Change the way the jump instructions are outputted in the assembly
output to be PC-relative. This fixes an issue where the addresses in the
output where shifted forward.
Rework the startup code used to boot starlette, this allows removing the
use of all globals, moreover it allow dropping the ManagerMiddleware
class as it is no longer needed.
add the setElementByPath function which allows setting a value in a
tuple tree give a tuple tree path to apply it to
Also apply some small fixes to the `tuple_tree.ts` codebase
This change fixes the pipeline behavior when producing targets:
* produce and extract now return rp_buffer, which has a start pointer
and size
* the python api `revng.api` will return on produce/extract either str
or bytes depending on the mime type of the container
* the GraphQL api will encode bytes in base64