Files
revng-revng/lib/Pipebox/LLVMPipe.cpp
Giacomo Vercesi 35ef98e83f LLVMPipe: make passes key lowercase
Since the rest of the pypeline yaml file is lowercase, convert the
`Passes` key of the configuration used by `pure-llvm-passes-*` to
lowercase.
2025-12-10 15:05:53 +01:00

44 lines
1.4 KiB
C++

//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "llvm/PassRegistry.h"
#include "revng/Pipebox/LLVMPipe.h"
namespace rpp = revng::pypeline::pipes;
using Configuration = rpp::detail::PureLLVMPassesPipeBase::Configuration;
template<>
struct llvm::yaml::MappingTraits<Configuration> {
static void mapping(IO &IO, Configuration &Fields) {
IO.mapRequired("passes", Fields.Passes);
}
};
Configuration Configuration::parse(llvm::StringRef Input) {
return llvm::cantFail(fromString<Configuration>(Input));
}
namespace revng::pypeline::pipes::detail {
PureLLVMPassesPipeBase::PureLLVMPassesPipeBase(llvm::StringRef
StaticConfiguration) :
StaticConfiguration(StaticConfiguration) {
Configuration Configuration = Configuration::parse(StaticConfiguration);
llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry();
for (llvm::StringRef PassName : Configuration.Passes) {
const llvm::PassInfo *PassInfo = Registry.getPassInfo(PassName);
revng_assert(PassInfo != nullptr,
("llvm-pipe: Requested pass " + PassName
+ " was not found in the PassRegistry")
.str()
.c_str());
PassInfos.push_back(PassInfo);
}
TaskName = "PureLLVMPasses(" + llvm::join(Configuration.Passes, ",") + ")";
}
} // namespace revng::pypeline::pipes::detail