1. Hoist the logic to retrieve a model CallEdge from an llvm::CallInst
out of `getCallSitePrototype()`, in a separate `getCallEdge()`
function.
2. Modify `getCallSitePrototype()` so that the parent function's type is
optional.
Inject is meant to inject a model into an `llvm::Module`, but it fails
when operating on a Module that had no model metadata.
This commit fixes the bug.
This DLAStep was moving edges improperly before this commit.
In particular, edges were detected solely looking at source and target
edge, not looking at the edge itself. This was leading to wrong results
whenever a node N1 had many outgoing edges to a child node N2, at
different offsets, where all the edges were moved instead of just the
correct ones.
In order to fix this, this commit:
- reworks the logic of `moveEdges`, switching to iterator-based logic
- reworks the struct OrderedChild used internally by
DLAComputeNonInterferingComponents, so that it is also iterator-based
- re-uses common code for field size computation
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.
**Symptoms**: a correct visit of the GHAST resulted in an incorrect
visit order of the CFG (some instructions were visited before their
operands)
**Causes**: When creating the tile of a dispatcher with an inline
successor and a fallthrough, the predecessors of the dispatcher
were correctly connected to the new tile, but the fallthrough
was not, leading to a split in the GHAST between nodes that should
have been connected
**Solution**: Setting `PostDomBB = Fallthrough` if there is a
fallthrough just before calling `createTile()` corrects
this behavior, connecting the tile to its fallthrough node
We should never be changing the nature of a `while` node into a
`doWhile` and vice-versa: we only upgrade standard nodes in
either a `while` or a `doWhile`.