The previous design returned a model::Binary &, which did not allow
users writing the model to properly initialize cross references between
different parts of the model.
While doing thie, also drop `printAccessNode()` from DLA DebugPrinter.
The information about which LLVM instruction originated a given access
node is already available in the csv generated by the `dla-accesses-log`
logger.
Until now, in makeLayout, inheritance edges were ignored when the
children were interfering.
Now the inheritance edges are treated as if they were instance edges at
offset 0.
- Remove `CreateInterProceduralTypes` and `CreateIntraProceduralTypes`
from the StepManager and put them in a separate
`DLATypeSystemLLVMBuilder` object that is in charge of initializing
the DLATypeSystem graph.
- Remove `MakeLayouts` from the StepManager and split into two free
functions: `makeLayouts` and `makeLayoutMap()`
- Remove all LLVM-related stuff (Module, LayoutTypePtrs and mappings
between these and DLATypeSystemNodes) from DLATypeSystem
- Add an IntEqClasses member to DLATypeSystem, to use to map between
LayoutTypePtrs and Layouts
- Add a TSDebugPrinter object inside the DLATypeSystem, which by default
prints only IDs
- Define an LLVMTSDebugPrinter inside DLATypeSystemBuilder which
overrides the default printer's behavior, printing LLVM-related info.
- Add the possibility to dump into a .csv file the bindings between
Nodes in the TypeSystem and `llvm::Value`s
With llvm-12 thera are more stringent requirement on the propagation of
DebugLoc on CallInst and InvokeInst.
Various CallInst and InvokeInst created during lifting did not fulfill
these requirements, causing the Module to not verify() with llvm-12.
This commit fixes the problem, properly propagating the debug locations.
Accessing NextChildPos is not safe if Pushed is true.
This commit switches the conditions so that NextChildPos is never
accessed unsafely thanks to short-circuiting.
This fixes a use-after-free bug, that was activate when calling tryPush
triggered realloc on the Stack.
Not calling the destructor of LayoutTypeSystemNode before their
deallocation was leaking pairs of Successors and Predecessors.
This commit fixes it by explicitly destructing LayoutTypeSystemNodes.
This commit fixes a use-after-poison false-positive report from ASAN.
This was due to misuse of SpecificBumpPtrAllocator together with
__asan_poison_memory_region.
The region was poisoned but not deallocated, which caused a the false
positive when trying to destroy and deallocate it in the destructor of
LayoutTypeSystem.
This was fixed by switching to plain BumpPtrAllocator, and properly
calling the Deallocate method, which wraps its own battle-tested ASAN
logic.
Before this commit DLATypeSystem used a
std::set<std::unique_ptr<LayoutTypeSystemNode> to hold nodes, allowing
heterogenous lookup with bare pointers, fast removal being a set,
and providing address stability without requiring an ordering between
LayoutTypeSystemNodes.
The same requirements is now obtained more cleanly using with a
BumpPtrAllocator for nodes, and a set of naked pointers to them to
enable fast lookup and removal.
They have been substituted with `print` methods, that are more general.
The `dumpToString` is emitted automatically with a template in a revng
header, for those classes that already have the `print` method anyway.
Checking if a `SwitchInst` has a certain case triggers a linear search.
When we have *a lot* of jump targets this is an issue.
This commit assumes that when we add a case to a dispatcher, that case
is not already there.
This commit drops the KeyTraits in favor of a std::any-like solution.
Basically, we type erase any key the user wants to employ, just exposing
a virtual version of the destructor, a comparison operator and a clone
primitive.
RemoveExceptionalCalls is a simple pass whose goal is to drop all the
calls to functions marked as `Exceptional` and replace them with an
`UnrechableInst`.
This is mainly useful in the decompilation pipeline.