Previously, to enumerate all the CSVs we had to go through the
`GlobalVariable` of a `Module` and see if the were being used in
rev.ng-generated code.
Now we have a named metadata for that: `revng.csv`.
We used to save the type of a block in the `revng.block.type` metadata
as a number. This commit serializes it as a string.
In order to do this, the `BlockType` enum has been promoted to a
namespace with the usual `getName` and `fromName` functions.
In the intraprocedural analysis of the stack analysis we implemented the
transfer function of the `Trunc` instruction as the identity function
(just as `PtrToInt` or `ZExt`). However this is not safe since `Trunc`
loses information. This lead to incorrect results in the ABI analysis.
`extern` declarations of template specializations for Logger<true> and
Logger<false> caused weak symbols to be emitted in librevngSupport.so
and into its users.
Dynamic loading then failed because both symbols were weak.
This commit removes the `extern` declarations so that dynamic loading
succeeds.
All the definitions of `greaterThan` were `!lowerThanOrEqual`, and all
the uses were implicitly assuming this semantic.
However, this was confusing because in a Lattice the ordering is not
total, hence `!lowerThanOrEqual` is not equivalent to `greaterThan`.
This commit drops the `greaterThan` method altogether to avoid
confusion.
In most cases, a user of MonotoneFramework does not need a
interprocedural analysis, nor an analysis whose results on
terminal labels have to be aggregated in a FinalResults.
DefaultInterrupt<LatticeElement> is designed exactly for those
cases, and is hence used as default template parameter for
MonotoneFramework.
The MonotoneFrameworkSet class had two sets of methods, one for handling
set operations on it, the other handling lattice ordering.
It also silently assumed that the lattice combine operation was the set
union, which is not true in general.
This commit decouples the set operations from the lattice operations.
This allows to provide two separate implementations of
IntersectionMonotoneSet (for which the compbine operation is the set
intersection) and UnionMonotoneSet (for which the combine operation is
the set union).
Before this change, `EnforceCFGCombingPass` was occasionally failing on
`verifyModule` if called from Caliban, with mismatches in the
`llvm.dbg.cu` debug metadata.
This metadata is a list of `DICompileUnit`, and `verifyModule` was
failing inside `verifyCompileUnits` because some of the visited compile
unit during the verify were not listed in `llvm.dbg.cu`.
One of the reasons of this problem might be that during
the enforcing we clone many things in the enforced function, and this
may cause the cloned stuff not to update the metadata accordingly.
I couldn't track down if this was caused by my misuse of LLVM's API for
cloning, of to some actual bug in LLVM.
In the end I couldn't find out the exact cause and fix it, so this
commit is a workaround. It adds a dependency on `RemoveDbgMetadata`, so
that the debug metadata causing `verifyModule` to fail are removed
before the enforcing, hence preventing things going astray during the
enforcing, and fixing the failure.
This workaround should be fine, because this is one of the last steps
before generating C code, and debug info are note serialized to C
anyway.