mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
7d235f4fd0
Also do some basic cleanup: capitalize first letters, add `.` at the end of the sentences, and so on.
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/// \file LLVMPipe.cpp
|
|
/// A llvm pipe is a pipe that operates on a llvm container.
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/PassRegistry.h"
|
|
#include "llvm/Passes/PassBuilder.h"
|
|
|
|
#include "revng/Pipeline/GenericLLVMPipe.h"
|
|
#include "revng/Pipeline/LLVMContainer.h"
|
|
#include "revng/Support/IRHelpers.h"
|
|
|
|
using namespace std;
|
|
using namespace llvm;
|
|
using namespace pipeline;
|
|
using namespace cl;
|
|
|
|
void O2Pipe::registerPasses(llvm::legacy::PassManager &Manager) {
|
|
StringMap<llvm::cl::Option *> &Options(getRegisteredOptions());
|
|
getOption<bool>(Options, "disable-machine-licm")->setInitialValue(true);
|
|
|
|
PassBuilder Builder;
|
|
Builder.buildPerModuleDefaultPipeline(OptimizationLevel::O2);
|
|
}
|
|
|
|
std::unique_ptr<LLVMPassWrapperBase> PureLLVMPassWrapper::clone() const {
|
|
return std::make_unique<PureLLVMPassWrapper>(*this);
|
|
}
|
|
|
|
void GenericLLVMPipe::run(const Context &, LLVMContainer &Container) {
|
|
llvm::legacy::PassManager Manager;
|
|
for (const auto &Element : Passes)
|
|
Element->registerPasses(Manager);
|
|
Manager.run(Container.getModule());
|
|
}
|
|
|
|
void PureLLVMPassWrapper::registerPasses(llvm::legacy::PassManager &Manager) {
|
|
auto *Registry = llvm::PassRegistry::getPassRegistry();
|
|
Manager.add(Registry->getPassInfo(PassName)->createPass());
|
|
}
|