From ee1fdebc4ea12ea8ee4e7e25abefb8bafc587403 Mon Sep 17 00:00:00 2001 From: Giacomo Vercesi Date: Mon, 1 Dec 2025 12:11:55 +0100 Subject: [PATCH] Add `SegregateStackAccesses` to pypeline --- .../SegregateStackAccesses.h | 19 +++++++++++++++++++ lib/Pipebox/Pipebox.cpp | 1 + .../SegregateStackAccessesPass.cpp | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/include/revng/PromoteStackPointer/SegregateStackAccesses.h b/include/revng/PromoteStackPointer/SegregateStackAccesses.h index 010966bb9..e9a5af0c5 100644 --- a/include/revng/PromoteStackPointer/SegregateStackAccesses.h +++ b/include/revng/PromoteStackPointer/SegregateStackAccesses.h @@ -30,4 +30,23 @@ public: llvm::Function &LLVMFunction); }; +class SegregateStackAccesses + : public LLVMFunctionMixin { +private: + const model::Binary &Binary; + +public: + static constexpr llvm::StringRef Name = "segregate-stack-accesses"; + using Arguments = SingleLLVMFunctionsArgument; + + SegregateStackAccesses(const class Model &Model, + llvm::StringRef Config, + llvm::StringRef DynamicConfig, + LLVMFunctionContainer &ModuleContainer) : + LLVMFunctionMixin(ModuleContainer), Binary(*Model.get().get()) {} + + void runOnLLVMFunction(const model::Function &Function, + llvm::Function &LLVMFunction); +}; + } // namespace revng::pypeline::piperuns diff --git a/lib/Pipebox/Pipebox.cpp b/lib/Pipebox/Pipebox.cpp index 9570afec6..be2639db2 100644 --- a/lib/Pipebox/Pipebox.cpp +++ b/lib/Pipebox/Pipebox.cpp @@ -88,6 +88,7 @@ static RegisterFunctionPipeRun P21; static RegisterFunctionPipeRun P22; static RegisterFunctionPipeRun P23; static RegisterFunctionPipeRun P24; +static RegisterFunctionPipeRun P25; // // Analyses diff --git a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp index e7e38fb24..a0660e21c 100644 --- a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp +++ b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp @@ -1631,4 +1631,12 @@ void LegacySegregateStackAccesses::runOnLLVMFunction(const model::Function Impl.epilogue(); } +void SegregateStackAccesses::runOnLLVMFunction(const model::Function &Function, + llvm::Function &LLVMFunction) { + ::SegregateStackAccesses Impl(Binary, *LLVMFunction.getParent()); + Impl.prologue(); + Impl.runOnFunction(Function, LLVMFunction); + Impl.epilogue(); +} + } // namespace revng::pypeline::piperuns