#pragma once // // This file is distributed under the MIT License. See LICENSE.md for details. // #include #include "llvm/Pass.h" #include "revng/BasicAnalyses/GeneratedCodeBasicInfo.h" #include "revng/EarlyFunctionAnalysis/CollectCFG.h" class IsolateFunctions : public llvm::ModulePass { public: static char ID; public: IsolateFunctions() : llvm::ModulePass(ID) {} bool runOnModule(llvm::Module &M) override; void getAnalysisUsage(llvm::AnalysisUsage &AU) const override; }; class IsolateFunctionsImpl; namespace revng::pypeline::piperuns { class Isolate { private: const model::Binary &Binary; std::unique_ptr ClonedModule; LLVMFunctionContainer &Output; std::optional GCBI; // unique_ptr to the implementation. This is a temporary measure until the // old pipeline is dropped and the body of the `Impl` class can be inlined in // this one. std::unique_ptr Impl; std::vector> IsolatedFunctions; public: static constexpr llvm::StringRef Name = "isolate"; using Arguments = TypeList< PipeRunArgument, PipeRunArgument, PipeRunArgument>; Isolate(const class Model &Model, llvm::StringRef Config, llvm::StringRef DynamicConfig, const CFGMap &CFG, LLVMRootContainer &Root, LLVMFunctionContainer &Output); ~Isolate(); void runOnFunction(const model::Function &TheFunction); private: void splitIsolatedFunctionsToOutput(); }; } // namespace revng::pypeline::piperuns