mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
f8bd4c3bac
* Make the following private headers public:
* Lift/CPUStateAccessAnalysisPass.h
* Lift/CSVOffsets.h
* Lift/PTCDump.h
* Lift/VariableManager.h
* Move from revngSupport to revngLift:
* IRAnnotators.{h,cpp}
* SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
* FunctionTags.{h,cpp}
* ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
* OriginalAssemblyAnnotationWriter.{h,cpp}
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
/// \file FunctionPass.cpp
|
|
/// Contains the implementation of pipeline passes.
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/Support/Progress.h"
|
|
|
|
#include "revng/Model/FunctionTags.h"
|
|
#include "revng/Model/LoadModelPass.h"
|
|
#include "revng/Pipeline/Context.h"
|
|
#include "revng/Pipeline/ExecutionContext.h"
|
|
#include "revng/Pipeline/LLVMKind.h"
|
|
#include "revng/Pipes/FunctionPass.h"
|
|
#include "revng/Pipes/TaggedFunctionKind.h"
|
|
|
|
bool pipeline::detail::runOnModule(llvm::Module &Module,
|
|
FunctionPassImpl &Pipe) {
|
|
auto &Analysis = Pipe.getAnalysis<pipeline::LoadExecutionContextPass>();
|
|
|
|
// Obtain the context
|
|
ExecutionContext *EC = Analysis.get();
|
|
revng_assert(EC != nullptr);
|
|
|
|
// Run the prologue
|
|
auto &ModelWrapper = Pipe.getAnalysis<LoadModelWrapperPass>().get();
|
|
bool Result = Pipe.prologue();
|
|
|
|
// Run on individual functions
|
|
using Type = revng::kinds::TaggedFunctionKind;
|
|
auto ContainerName = Analysis.getContainerName();
|
|
auto ToIterOn = Type::getFunctionsAndCommit(*EC, Module, ContainerName);
|
|
llvm::Task T(Analysis.getRequestedTargets().size(), "Running FunctionPass");
|
|
for (const auto &[ModelFunction, LLVMFunction] : ToIterOn) {
|
|
T.advance(ModelFunction->Entry().toString(), true);
|
|
Result = Pipe.runOnFunction(*ModelFunction, *LLVMFunction) or Result;
|
|
}
|
|
|
|
Result = Pipe.epilogue() or Result;
|
|
|
|
return Result;
|
|
}
|