There seem to be some issues with defining these in headers due to the
storage type being incomplete. The storage type is only defined in the
.cpp file.
`TypeToNumOfRefs` was used only in one method, so it can be computed
directly there on the fly.
`calculateNumOfOccurrences` doesn't need to be a method (it can be a
free function), it doesn't need to run at construction time, and it
doesn't need to return a map. So it's been moved in the `.cpp` file,
renamed to `getCrossReferencedTypes` and changed to return a set. It is
now only called when needed.
Before this commit, TypeInlineHelper would always visit all the types to
compute reachability.
Now it bails out early, as soon as it detects reachability.
We introduce a new LLVM Pass that should detect implicit
casts, by marking the 3rd argument of ModelCast as `true`.
The backend will omit printing a cast expression if the
ModelCast is implicit one.
Before this commit, the AvailableExpressionAnalysis used by
SwitchToStatements did not take into account the full set of custom
opcodes that allocate local variables.
In particular, if only checked FunctionTags::LocalVariable, and not the
larger set marked with the tag FunctionTags::AllocatesLocalVariable,
which includes revng_stack_frame and revng_call_stack_arguments.
This caused all the reasoning on aliasing that involved the stack to be
broken.
This commit fixes the problem by properly using the
FunctionTags::AllocatesLocalVariable to reason about aliasing.
Before this commit, the InstructionToSerializePicker had a wrong bailout
condition, that caused to never pick for serialization memory reads.
This was wrong and caused semantic bugs, due to the instruction
performing the memory read not being serialized into a new variable.
We introduce a "dead code" optimization like pass on the AST.
The goal is to simplify away, in a `SequenceNode`, everything that
follows a node with sports a `nofallthrough behavior.
A `SwitchBreak` node should not have a specific associated
`FallThroughScopeType`, since its semantics represent the fact of a
`case` of the `switch` with no associated statements, and thus can be
represented with the `FallThrough` behavior.
Change the analysis in order to lift the assumption that a dispatcher
`switch` always coveris all the values of the variable state. This is
not true after the `simplifySwitchBreak` and `inlineDispatcherSwitch`
beautify passes, which can remove some of the `case`s.
The `FallThroughScope` associated to a `ScsNode` should represent the
fact that we have fallthrough from a loop.
Without any more advanced semantical analysis, we cannot conclude that
we do not have fallthrough.