This commit enables to emit accesses with the square bracket array
access operator on pointers.
This is accomplished by adding an additional mandatory argument to
ModelGEP (AND NOT to ModelGEPRef) to represent this case.
MakeModelGEPPass is updated to take this into account, together with all
the other passes that handle ModelGEPs.
In SegregateStackAccesses sometimes we have to replace a call whose call
type does not match the callee type. Specifically when the return type
is a `StructType`, sometimes the call returns an identical `StructType`,
but with a different identity.
This commit adapts the return type of new calls on the fly.
SegregateStackAccesses creates new functions. Iterating over existing
functions while creating new ones is problematic, so we now first
collect all the functions we want to inspect and then process them.
SegregateStackAccesses and PromoteStackPointer were not handling
functions declarated (but not defined) properly.
This commit fixes this, in part by adopting `TaggedFunctionPass`.
Before this commit, calls were marked to push ALAP in the wrong order,
resulting in preventing to actually push them ALAP.
This commit fixes the ordering, reactivating the code motion.
Before this commit, we did not take into consideration that
revng_call_stack_arguments has reference semantics, and we were using
its AddressOf in call sites that were taking the stack arguments.
This commit fixes the problem, bypassing the call to AddressOf when
passing the arguments to calls.
This commit handles the situation in which we have a call site with
stack arguments, but it was not possible to determine the stack height
at the call site.
The solution is to simply ignore stack arguments and emit in the IR a
warning.
Add `ReadOnly` and `InaccessibleMemOnly` attributes to the following
functions:
- `revng_stack_frame`
- `revng_call_stack_arguments`
- `ModelGEP`
- `AddressOf`
This prevents `CSE` from grouping together any of these calls, while
still enabling `DCE` to remove calls that are not used.
Before this commit, SegregateStackAccessesPass always expected to find
calls stack_size_at_call_site markers injected by
InjectStackSizeProbesAtCallSitesPass.
This is not always true, because aggressive LLVM optimizations can
remove dead code.
As an example, if the user or some analysis earlier in the pipeline
wrongly marks registers as non-arguments, the optimization pipeline will
throw away and eliminate everything that descends from the initial
values of those registers.
This commit enables SegregateStackAccessesPass to cope with calls to
stack_size_at_call_site that were eliminated, and keep going just
considering the calls that are still there.
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
Before this commit, SegregateStackAccessPass did not update properly the
metadata. Missing metadata did not allow the rest of the pipeline to
detect the special call.
This commit properly copies the metadata and updates the rest of the
pipeline to take care of the special call.