This commit changes MakeSegmentRefPass so that it's now a ModulePass and
it uses the binary to detect integer constants that represent the
address of strings.
When it detects address of constant strings, instead of injecting calls
to SegmentRef, we now inject calls to cstringLiteral, so that we can
later emit them as inline string literals in C.
In segmentRef we use integer type meaning address in memory, so we
generate segmentRef function with non-pointer type. For cstringLiteral
function we need real pointer type of operand.
Save MetaAddress, size, offset and original type for every
cstringLiteral call in metadata as we do for segmentRef calls.
For cstringLiteral "revng.cstring_literal" metadata name is used.
StringLiteralPool needs tuple of address, size, offset and type to
keep distinct string decorator functions for each string. This tuple is
represented by StringLiteralPoolKey struct.
Pipe for MakeSegmentRefPass needs to be defined explicitly, because
additional wrapper passes are required in MakeSegmentRef:
1. LoadModelWrapperPass
2. LoadBinaryWrapperPass
MakeSegmentRefPass requires access to RawBinaryView to detect cstring
literals in binary.
Fix printed command in MakeSegmentRefPipe
This printed command might not work. @ale commented it will be replaced
with `revng pipe run-pipe` once we will have it.
Update IRHelpers to new revng API
Switch String and Namespace arguments in getUniqueString
This method is similar to `getByAddress`, but it returns an
`llvm::StringRef`.
It is intended for those users that need to manipulate the bytes as
strings. In those cases, the `llvm::ArrayRef<uint8_t>` returned by
`getByAddress` is not suitable, because it triggers warnings due to
`uint8_t` not being the same as `char`.
In the previous implementation of Model.verify an llvm::Error was
returned. Some call sites retained the logic associated with it. Fix
these with the correct logic.
Also fix an instance of `verify` that was missing an assert.
Drop the use of unique_ptr within the rp_error data type and instead use
std::monostate. Also fix the functions to allow the use of `nullptr` as
the error parameter
The new option is `NoRegisterArgumentsCanComeAfterStackOnes`
If it's set to `true`, then no register argument can follow any stack
argument under the said abi, otherwise such "shuffling" of arguments
is allowed.
This makes the conversions more robust, since everything can rely on
the same tools for filling in missing registers and ordering them based
on the ABI requirements.
This introduces `emplace` and `emplace_or_assign` members
allowing population of the container without copying values in.
It also reworks the batch insertion. On top of adding the ability
to move the elements in (without making a copy) and constructing
them in place, it also makes the non-assign version of the inserter
a lot safer by explicitly asserting the fact that while it was
in use no duplicates were added to the vector. Before now,
the duplicates were just silently removed from the container.
It also optimizes the batch insertion somewhat by using non-stable
`std::sort` for unique case as well as replacing `std::unique`
invocation with `std::find_adjacent`.
* Let GraphQL accept zero or more parameters for analyses
* Handle the general case of analyses using zero or more containers with
a variable ammount of targets