#ifndef STACKANALYSIS_H #define STACKANALYSIS_H // // This file is distributed under the MIT License. See LICENSE.md for details. // // Standard includes #include // LLVM includes #include "llvm/Pass.h" // Local libraries includes #include "revng/BasicAnalyses/FunctionCallIdentification.h" #include "revng/BasicAnalyses/GeneratedCodeBasicInfo.h" #include "revng/StackAnalysis/FunctionsSummary.h" namespace StackAnalysis { template class StackAnalysis : public llvm::FunctionPass { public: static char ID; public: StackAnalysis() : llvm::FunctionPass(ID) {} void getAnalysisUsage(llvm::AnalysisUsage &AU) const override { AU.setPreservesAll(); AU.addRequired(); } bool runOnFunction(llvm::Function &F) override; const std::set & getClobbered(llvm::BasicBlock *Function) { return GrandResult.Functions[Function].ClobberedRegisters; } void serialize(std::ostream &Output) { Output << TextRepresentation; } private: FunctionsSummary GrandResult; std::string TextRepresentation; }; template<> char StackAnalysis::ID; template<> char StackAnalysis::ID; } // namespace StackAnalysis #endif // STACKANALYSIS_H