Add PromoteInitCSVToUndef to pypeline

This commit is contained in:
Giacomo Vercesi
2025-11-18 15:16:51 +01:00
parent e13e5add06
commit 0bc74e0234
3 changed files with 45 additions and 0 deletions
@@ -0,0 +1,33 @@
#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "revng/Model/NameBuilder.h"
#include "revng/Pipebox/Helpers.h"
#include "revng/PipeboxCommon/Helpers/PipeRuns/LLVMFunctionMixin.h"
#include "revng/PipeboxCommon/LLVMContainer.h"
#include "revng/PipeboxCommon/Model.h"
namespace revng::pypeline::piperuns {
class PromoteInitCSVToUndef : public LLVMFunctionMixin<PromoteInitCSVToUndef> {
private:
const model::Binary &Binary;
public:
static constexpr llvm::StringRef Name = "promote-init-csv-to-undef";
using Arguments = SingleLLVMFunctionsArgument;
PromoteInitCSVToUndef(const class Model &Model,
llvm::StringRef Config,
llvm::StringRef DynamicConfig,
LLVMFunctionContainer &ModuleContainer) :
LLVMFunctionMixin(ModuleContainer), Binary(*Model.get().get()){};
void runOnLLVMFunction(const model::Function &Function,
llvm::Function &LLVMFunction);
};
} // namespace revng::pypeline::piperuns
+2
View File
@@ -19,6 +19,7 @@
#include "revng/PipeboxCommon/RawContainer.h"
#include "revng/Recompile/CompileModulePipe.h"
#include "revng/Recompile/LinkForTranslationPipe.h"
#include "revng/RemoveLiftingArtifacts/PromoteInitCSVToUndef.h"
#include "revng/RemoveLiftingArtifacts/RemoveLiftingArtifacts.h"
#include "revng/Yield/HexDump.h"
#include "revng/Yield/Pipes/ProcessAssembly.h"
@@ -68,6 +69,7 @@ static RegisterSingleOutputPipeRun<CompileRootModule> P15;
static RegisterSingleOutputPipeRun<LinkForTranslation> P16;
static RegisterSingleOutputPipeRun<InvokeIsolatedFunctions> P17;
static RegisterFunctionPipeRun<RemoveLiftingArtifacts> P18;
static RegisterFunctionPipeRun<PromoteInitCSVToUndef> P19;
//
// Analyses
@@ -11,6 +11,7 @@
#include "revng/Model/LoadModelPass.h"
#include "revng/Model/NamedTypedRegister.h"
#include "revng/Model/Register.h"
#include "revng/RemoveLiftingArtifacts/PromoteInitCSVToUndef.h"
#include "revng/Support/IRHelpers.h"
using namespace llvm;
@@ -90,3 +91,12 @@ static constexpr const char *Flag = "promote-init-csv-to-undef";
using Reg = RegisterPass<PromoteInitCSVToUndefPass>;
static Reg X(Flag,
"Promotes calls to revng_undefined_* functions for CSV to undefs");
namespace revng::pypeline::piperuns {
void PromoteInitCSVToUndef::runOnLLVMFunction(const model::Function &Function,
llvm::Function &LLVMFunction) {
undefPreservedRegistersInitialization(LLVMFunction, Function, Binary);
}
} // namespace revng::pypeline::piperuns