mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
a96f98821c
Add a pass that computes the lowest negative offset that is summed in each isolated function to the local stack pointer returned by a call to revng_init_local_sp (previously added by PromoteStackPointerPass). After the computation, all the accesses relative to the stack pointer are recomputed as if the stack pointer was lowered by the computed amount. This is useful to enable the DLA to easily recover layouts that are placed at negative offsets from the stack pointer. The reason is that the DLA in its current form does not handle negative offsets, but at the same time negative offsets are important to recover the layout of the local variables on the stack. This pass implicitly depends on running PromoteStackPointerPass. If PromoteStackPointerPass did not run before the execution of AdjustStackPointerPass, the latter doesn't do anything. For demonstration purposes, AdjustStackPointerPass has been implemented both with LLVM's legacy PassManager and the new PassManager.