Files
Alessandro Di Federico f8bd4c3bac Move around some files in preparation for libtcg
* 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}
2025-10-24 15:34:11 +02:00

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;
}