From 8d67f33ce556c073dace700709bf209b49407465 Mon Sep 17 00:00:00 2001 From: Alessandro Di Federico Date: Wed, 17 Jun 2026 10:30:08 +0200 Subject: [PATCH] IRHelpers: turn some functions into `IRBuilder::*` --- .../BasicAnalyses/GeneratedCodeBasicInfo.h | 1 + .../revng/EarlyFunctionAnalysis/CFGAnalyzer.h | 1 + .../revng/EarlyFunctionAnalysis/CallHandler.h | 1 + .../FunctionIsolation/StructInitializers.h | 1 + include/revng/Lift/VariableManager.h | 2 +- include/revng/Model/ProgramCounterHandler.h | 15 ++--- include/revng/Support/IRBuilder.h | 54 +++++++++++++++--- include/revng/Support/IRHelpers.h | 56 +++---------------- include/revng/Support/MetaAddress.h | 5 +- include/revng/Support/OpaqueRegisterUser.h | 1 + lib/Backend/DecompileFunction.cpp | 1 + lib/BasicAnalyses/RemoveHelperCalls.cpp | 3 +- lib/Canonicalize/ExitSSAPass.cpp | 1 + lib/Canonicalize/ExtractValueToGEP.cpp | 1 + lib/Canonicalize/FoldModelGEP.cpp | 1 + lib/Canonicalize/MakeLocalVariables.cpp | 1 + lib/Canonicalize/MakeModelCastPass.cpp | 1 + lib/Canonicalize/MakeModelGEPPass.cpp | 1 + .../OperatorPrecedenceResolutionPass.cpp | 1 + lib/Canonicalize/PrettyIntFormattingPass.cpp | 1 + lib/Canonicalize/RemoveLoadStore.cpp | 1 + lib/Canonicalize/RemovePointerCasts.cpp | 1 + .../SplitOverflowIntrinsicsPass.cpp | 1 + lib/Canonicalize/TernaryReductionPass.cpp | 1 + ...sComplementArithmeticNormalizationPass.cpp | 1 + lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp | 9 +-- lib/EarlyFunctionAnalysis/DetectABI.cpp | 1 + lib/EarlyFunctionAnalysis/Outliner.cpp | 3 +- .../PromoteGlobalToLocalVars.cpp | 3 +- lib/FunctionIsolation/EnforceABI.cpp | 3 +- .../InvokeIsolatedFunctions.cpp | 3 +- lib/FunctionIsolation/IsolateFunctions.cpp | 1 + lib/FunctionIsolation/PromoteCSVs.cpp | 7 ++- lib/FunctionIsolation/StructInitializers.cpp | 1 + lib/Lift/CodeGenerator.cpp | 1 + lib/Lift/DropHelperCallsPass.h | 3 +- lib/Lift/ExternalJumpsHandler.cpp | 3 +- lib/Lift/InstructionTranslator.cpp | 1 + lib/Lift/InstructionTranslator.h | 1 + lib/Lift/JumpTargetManager.cpp | 1 + lib/Lift/RootAnalyzer.cpp | 3 +- lib/Lift/RootAnalyzer.h | 1 + lib/Lift/VariableManager.cpp | 7 ++- lib/LocalVariables/LocalVariableBuilder.cpp | 10 ++-- lib/Model/FunctionTags.cpp | 1 + lib/Model/ProgramCounterHandler.cpp | 33 +++++------ .../InjectStackSizeProbesAtCallSitesPass.cpp | 7 ++- .../InstrumentStackAccessesPass.cpp | 1 + .../PromoteStackPointerPass.cpp | 5 +- .../SegregateStackAccessesPass.cpp | 2 +- .../RemoveExtractValuesPass.cpp | 1 + lib/RemoveLiftingArtifacts/CleanupIRPass.cpp | 1 + .../MakeSegmentRefPass.cpp | 1 + lib/RestructureCFG/EnforceSingleExitPass.cpp | 1 + lib/RestructureCFG/ScopeGraphUtils.cpp | 1 + lib/RestructureCFG/SimplifyHybridNot.cpp | 1 + 56 files changed, 154 insertions(+), 117 deletions(-) diff --git a/include/revng/BasicAnalyses/GeneratedCodeBasicInfo.h b/include/revng/BasicAnalyses/GeneratedCodeBasicInfo.h index 50a5685d7..bca752000 100644 --- a/include/revng/BasicAnalyses/GeneratedCodeBasicInfo.h +++ b/include/revng/BasicAnalyses/GeneratedCodeBasicInfo.h @@ -24,6 +24,7 @@ #include "revng/Model/LoadModelPass.h" #include "revng/Model/ProgramCounterHandler.h" #include "revng/Support/BlockType.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" // Forward declarations diff --git a/include/revng/EarlyFunctionAnalysis/CFGAnalyzer.h b/include/revng/EarlyFunctionAnalysis/CFGAnalyzer.h index 176e6cdfd..21df7e668 100644 --- a/include/revng/EarlyFunctionAnalysis/CFGAnalyzer.h +++ b/include/revng/EarlyFunctionAnalysis/CFGAnalyzer.h @@ -10,6 +10,7 @@ #include "revng/EarlyFunctionAnalysis/Outliner.h" #include "revng/EarlyFunctionAnalysis/TemporaryOpaqueFunction.h" #include "revng/Model/Binary.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" #include "revng/Support/OpaqueRegisterUser.h" diff --git a/include/revng/EarlyFunctionAnalysis/CallHandler.h b/include/revng/EarlyFunctionAnalysis/CallHandler.h index 968b45b22..3797fdd5b 100644 --- a/include/revng/EarlyFunctionAnalysis/CallHandler.h +++ b/include/revng/EarlyFunctionAnalysis/CallHandler.h @@ -7,6 +7,7 @@ #include #include "revng/EarlyFunctionAnalysis/AnalyzeRegisterUsage.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/MetaAddress.h" namespace revng { diff --git a/include/revng/FunctionIsolation/StructInitializers.h b/include/revng/FunctionIsolation/StructInitializers.h index 2e787b9f3..0ec9365cc 100644 --- a/include/revng/FunctionIsolation/StructInitializers.h +++ b/include/revng/FunctionIsolation/StructInitializers.h @@ -4,6 +4,7 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" namespace revng { diff --git a/include/revng/Lift/VariableManager.h b/include/revng/Lift/VariableManager.h index f5a3bb3df..6ec9b2553 100644 --- a/include/revng/Lift/VariableManager.h +++ b/include/revng/Lift/VariableManager.h @@ -95,7 +95,7 @@ public: Builder.CreateStore(Undef, V); } - return createLoadVariable(Builder, V); + return Builder.createLoadVariable(V); } /// Get or create the LLVM value associated to a PTC temporary diff --git a/include/revng/Model/ProgramCounterHandler.h b/include/revng/Model/ProgramCounterHandler.h index 7f5893f47..2122f2c83 100644 --- a/include/revng/Model/ProgramCounterHandler.h +++ b/include/revng/Model/ProgramCounterHandler.h @@ -9,12 +9,9 @@ #include "revng/Model/Architecture.h" #include "revng/Support/BlockType.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" -namespace revng { -class IRBuilder; -} // namespace revng - inline llvm::IntegerType *getCSVType(llvm::GlobalVariable *CSV) { using namespace llvm; return cast(CSV->getValueType()); @@ -156,7 +153,7 @@ public: // Load and re-store each CSV affecting the PC and then feed them to // handleStore for (GlobalVariable *CSVAffectingPC : CSVsAffectingPC) { - auto *FakeLoad = createLoad(Builder, CSVAffectingPC); + auto *FakeLoad = Builder.createLoad(CSVAffectingPC); auto *FakeStore = Builder.CreateStore(FakeLoad, CSVAffectingPC); bool HasInjectedCode = handleStore(Builder, FakeStore); eraseFromParent(FakeStore); @@ -183,10 +180,10 @@ public: llvm::Instruction *composeIntegerPC(revng::IRBuilder &B) const { return MetaAddress::composeIntegerPC(B, - align(B, createLoad(B, AddressCSV)), - createLoad(B, EpochCSV), - createLoad(B, AddressSpaceCSV), - createLoad(B, TypeCSV)); + align(B, B.createLoad(AddressCSV)), + B.createLoad(EpochCSV), + B.createLoad(AddressSpaceCSV), + B.createLoad(TypeCSV)); } bool isPCSizedType(llvm::Type *T) const { diff --git a/include/revng/Support/IRBuilder.h b/include/revng/Support/IRBuilder.h index 242520081..3cdce4b59 100644 --- a/include/revng/Support/IRBuilder.h +++ b/include/revng/Support/IRBuilder.h @@ -4,9 +4,12 @@ // This file is distributed under the MIT License. See LICENSE.md for details. // +#include "llvm/ADT/SmallVector.h" +#include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/Function.h" #include "llvm/IR/GlobalVariable.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instructions.h" @@ -14,15 +17,7 @@ #include "revng/Support/Assert.h" #include "revng/Support/Debug.h" - -inline llvm::Type *getVariableType(const llvm::Value *Variable) { - if (auto *Alloca = llvm::dyn_cast(Variable)) - return Alloca->getAllocatedType(); - else if (auto *GV = llvm::dyn_cast(Variable)) - return GV->getValueType(); - else - revng_abort("Either GlobalVariable or AllocaInst expected"); -} +#include "revng/Support/IRHelpers.h" namespace revng { @@ -183,6 +178,47 @@ public: return CreateStore(V, Variable); } + llvm::LoadInst *createLoad(llvm::GlobalVariable *GV) { + return this->CreateLoad(GV->getValueType(), GV); + } + + llvm::LoadInst *createLoad(llvm::AllocaInst *Alloca) { + return this->CreateLoad(Alloca->getAllocatedType(), Alloca); + } + + llvm::LoadInst *createLoadVariable(llvm::Value *Variable) { + if (auto *Alloca = llvm::dyn_cast(Variable)) + return createLoad(Alloca); + if (auto *GV = llvm::dyn_cast(Variable)) + return createLoad(GV); + revng_abort("Either GlobalVariable or AllocaInst expected"); + } + + void setInsertPointToFirstNonAlloca(llvm::Function &F) { + using namespace llvm; + for (Instruction &I : F.getEntryBlock()) { + if (not isa(&I)) { + SetInsertPoint(&I); + return; + } + } + revng_abort(); + } + + llvm::SmallVector unpack(llvm::Value *V) { + using namespace llvm; + Type *T = V->getType(); + if (isa(T)) + return { V }; + if (auto *ST = dyn_cast(T)) { + SmallVector Result; + for (unsigned I = 0; I < ST->getNumElements(); ++I) + Result.push_back(this->CreateExtractValue(V, { I })); + return Result; + } + revng_abort("Cannot unpack the given type"); + } + protected: // NOLINTNEXTLINE explicit IRBuilder(bool EnableDebugInformationChecks, llvm::LLVMContext &C) : diff --git a/include/revng/Support/IRHelpers.h b/include/revng/Support/IRHelpers.h index 03720f8c4..ae0fbcfa0 100644 --- a/include/revng/Support/IRHelpers.h +++ b/include/revng/Support/IRHelpers.h @@ -31,7 +31,6 @@ #include "revng/Support/BasicBlockID.h" #include "revng/Support/Debug.h" #include "revng/Support/Generator.h" -#include "revng/Support/IRBuilder.h" #include "revng/Support/MetaAddress.h" class ProgramCounterHandler; @@ -1443,18 +1442,13 @@ inline void setPointersMetadata(Value *V, QMD.tuple(PointerOperandsMD) })); } -inline void setInsertPointToFirstNonAlloca(revng::IRBuilder &Builder, - llvm::Function &F) { - using namespace llvm; - - BasicBlock &Entry = F.getEntryBlock(); - for (Instruction &I : Entry) { - if (not isa(&I)) { - Builder.SetInsertPoint(&I); - return; - } - } - revng_abort(); +inline llvm::Type *getVariableType(const llvm::Value *Variable) { + if (auto *Alloca = llvm::dyn_cast(Variable)) + return Alloca->getAllocatedType(); + else if (auto *GV = llvm::dyn_cast(Variable)) + return GV->getValueType(); + else + revng_abort("Either GlobalVariable or AllocaInst expected"); } inline llvm::Value *getPointer(llvm::User *U) { @@ -1495,42 +1489,6 @@ llvm::Function *changeFunctionType(llvm::Function &OldFunction, llvm::Type *NewReturnType, llvm::ArrayRef NewArguments); -inline llvm::SmallVector unpack(revng::IRBuilder &Builder, - llvm::Value *V) { - using namespace llvm; - Type *Type = V->getType(); - if (isa(Type)) { - return { V }; - } else if (auto *StructType = dyn_cast(Type)) { - llvm::SmallVector Result; - for (unsigned I = 0; I < StructType->getNumElements(); ++I) - Result.push_back(Builder.CreateExtractValue(V, { I })); - return Result; - } else { - revng_abort("Cannot unpack the given type"); - } -} - -inline llvm::Instruction *createLoad(revng::IRBuilder &Builder, - llvm::GlobalVariable *GV) { - return Builder.CreateLoad(GV->getValueType(), GV); -} - -inline llvm::Instruction *createLoad(revng::IRBuilder &Builder, - llvm::AllocaInst *Alloca) { - return Builder.CreateLoad(Alloca->getAllocatedType(), Alloca); -} - -inline llvm::Instruction *createLoadVariable(revng::IRBuilder &Builder, - llvm::Value *Variable) { - if (auto *Alloca = llvm::dyn_cast(Variable)) - return createLoad(Builder, Alloca); - else if (auto *GV = llvm::dyn_cast(Variable)) - return createLoad(Builder, GV); - else - revng_abort("Either GlobalVariable or AllocaInst expected"); -} - void pruneDICompileUnits(llvm::Module &M); llvm::SmallSet findPhiTreeLeaves(llvm::Value *Root); diff --git a/include/revng/Support/MetaAddress.h b/include/revng/Support/MetaAddress.h index cd62368de..5b6e06c64 100644 --- a/include/revng/Support/MetaAddress.h +++ b/include/revng/Support/MetaAddress.h @@ -11,14 +11,11 @@ #include "revng/ADT/KeyedObjectContainer.h" #include "revng/Model/Architecture.h" +#include "revng/Runtime/PlainMetaAddress.h" #include "revng/Support/Debug.h" #include "revng/Support/IntegerSerialization.h" #include "revng/Support/OverflowSafeInt.h" -extern "C" { -#include "revng/Runtime/PlainMetaAddress.h" -} - namespace llvm { class TypeDefinition; class Constant; diff --git a/include/revng/Support/OpaqueRegisterUser.h b/include/revng/Support/OpaqueRegisterUser.h index 07a854706..b0acfdd8d 100644 --- a/include/revng/Support/OpaqueRegisterUser.h +++ b/include/revng/Support/OpaqueRegisterUser.h @@ -9,6 +9,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/Register.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" namespace revng { diff --git a/lib/Backend/DecompileFunction.cpp b/lib/Backend/DecompileFunction.cpp index 3cc329a19..d211cbd37 100644 --- a/lib/Backend/DecompileFunction.cpp +++ b/lib/Backend/DecompileFunction.cpp @@ -60,6 +60,7 @@ #include "revng/RestructureCFG/RestructureCFG.h" #include "revng/Support/Assert.h" #include "revng/Support/DecompilationHelpers.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/YAMLTraits.h" #include "revng/TypeNames/LLVMTypeNames.h" diff --git a/lib/BasicAnalyses/RemoveHelperCalls.cpp b/lib/BasicAnalyses/RemoveHelperCalls.cpp index eae34a2c8..41e43dc3e 100644 --- a/lib/BasicAnalyses/RemoveHelperCalls.cpp +++ b/lib/BasicAnalyses/RemoveHelperCalls.cpp @@ -8,6 +8,7 @@ #include "llvm/ADT/SmallVector.h" #include "revng/BasicAnalyses/RemoveHelperCalls.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/OpaqueRegisterUser.h" @@ -49,7 +50,7 @@ RemoveHelperCallsPass::run(llvm::Function &F, // Assumption: helpers do not leave the stack altered, thus we can save the // stack pointer and restore it back later. - auto *SP = createLoad(Builder, GCBI->spReg()); + auto *SP = Builder.createLoad(GCBI->spReg()); auto *RetTy = cast(I)->getFunctionType()->getReturnType(); auto *OriginalHelperMarker = OFPOriginalHelper.get(RetTy, diff --git a/lib/Canonicalize/ExitSSAPass.cpp b/lib/Canonicalize/ExitSSAPass.cpp index fc1fd842c..fd7880538 100644 --- a/lib/Canonicalize/ExitSSAPass.cpp +++ b/lib/Canonicalize/ExitSSAPass.cpp @@ -28,6 +28,7 @@ #include "revng/ADT/SmallMap.h" #include "revng/ADT/ZipMapIterator.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" using namespace llvm; diff --git a/lib/Canonicalize/ExtractValueToGEP.cpp b/lib/Canonicalize/ExtractValueToGEP.cpp index 0b96406da..633712aa7 100644 --- a/lib/Canonicalize/ExtractValueToGEP.cpp +++ b/lib/Canonicalize/ExtractValueToGEP.cpp @@ -12,6 +12,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" using namespace llvm; diff --git a/lib/Canonicalize/FoldModelGEP.cpp b/lib/Canonicalize/FoldModelGEP.cpp index 449dc102a..08d8f7083 100644 --- a/lib/Canonicalize/FoldModelGEP.cpp +++ b/lib/Canonicalize/FoldModelGEP.cpp @@ -16,6 +16,7 @@ #include "revng/Model/LoadModelPass.h" #include "revng/Support/Assert.h" #include "revng/Support/DecompilationHelpers.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/YAMLTraits.h" static Logger Log{ "fold-model-gep" }; diff --git a/lib/Canonicalize/MakeLocalVariables.cpp b/lib/Canonicalize/MakeLocalVariables.cpp index 31525022c..bf84715cb 100644 --- a/lib/Canonicalize/MakeLocalVariables.cpp +++ b/lib/Canonicalize/MakeLocalVariables.cpp @@ -15,6 +15,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/IRHelpers.h" #include "revng/Model/LoadModelPass.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" struct MakeLocalVariables : public llvm::FunctionPass { diff --git a/lib/Canonicalize/MakeModelCastPass.cpp b/lib/Canonicalize/MakeModelCastPass.cpp index 3b01b4edc..8acd6f0df 100644 --- a/lib/Canonicalize/MakeModelCastPass.cpp +++ b/lib/Canonicalize/MakeModelCastPass.cpp @@ -19,6 +19,7 @@ #include "revng/Model/IRHelpers.h" #include "revng/Model/LoadModelPass.h" #include "revng/Support/Assert.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/YAMLTraits.h" #include "revng/TypeNames/LLVMTypeNames.h" diff --git a/lib/Canonicalize/MakeModelGEPPass.cpp b/lib/Canonicalize/MakeModelGEPPass.cpp index 13396c90c..b91791c39 100644 --- a/lib/Canonicalize/MakeModelGEPPass.cpp +++ b/lib/Canonicalize/MakeModelGEPPass.cpp @@ -46,6 +46,7 @@ #include "revng/Model/VerifyHelper.h" #include "revng/Support/BlockType.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/YAMLTraits.h" diff --git a/lib/Canonicalize/OperatorPrecedenceResolutionPass.cpp b/lib/Canonicalize/OperatorPrecedenceResolutionPass.cpp index 7e6950fee..072ea5e3f 100644 --- a/lib/Canonicalize/OperatorPrecedenceResolutionPass.cpp +++ b/lib/Canonicalize/OperatorPrecedenceResolutionPass.cpp @@ -15,6 +15,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Support/Assert.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/OpaqueFunctionsPool.h" diff --git a/lib/Canonicalize/PrettyIntFormattingPass.cpp b/lib/Canonicalize/PrettyIntFormattingPass.cpp index f2c6f6828..fe1be3a15 100644 --- a/lib/Canonicalize/PrettyIntFormattingPass.cpp +++ b/lib/Canonicalize/PrettyIntFormattingPass.cpp @@ -20,6 +20,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/IRHelpers.h" #include "revng/Model/LoadModelPass.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/OpaqueFunctionsPool.h" diff --git a/lib/Canonicalize/RemoveLoadStore.cpp b/lib/Canonicalize/RemoveLoadStore.cpp index d2a4c6a5a..484304da3 100644 --- a/lib/Canonicalize/RemoveLoadStore.cpp +++ b/lib/Canonicalize/RemoveLoadStore.cpp @@ -16,6 +16,7 @@ #include "revng/Model/LoadModelPass.h" #include "revng/Support/Assert.h" #include "revng/Support/DecompilationHelpers.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" struct RemoveLoadStore : public llvm::FunctionPass { diff --git a/lib/Canonicalize/RemovePointerCasts.cpp b/lib/Canonicalize/RemovePointerCasts.cpp index fa7cee80b..cbd916375 100644 --- a/lib/Canonicalize/RemovePointerCasts.cpp +++ b/lib/Canonicalize/RemovePointerCasts.cpp @@ -9,6 +9,7 @@ #include "llvm/Pass.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" struct RemovePointerCasts : public llvm::FunctionPass { public: diff --git a/lib/Canonicalize/SplitOverflowIntrinsicsPass.cpp b/lib/Canonicalize/SplitOverflowIntrinsicsPass.cpp index 908172aa1..1540e3d3c 100644 --- a/lib/Canonicalize/SplitOverflowIntrinsicsPass.cpp +++ b/lib/Canonicalize/SplitOverflowIntrinsicsPass.cpp @@ -8,6 +8,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" using namespace llvm; diff --git a/lib/Canonicalize/TernaryReductionPass.cpp b/lib/Canonicalize/TernaryReductionPass.cpp index 4c808b938..0ea649673 100644 --- a/lib/Canonicalize/TernaryReductionPass.cpp +++ b/lib/Canonicalize/TernaryReductionPass.cpp @@ -13,6 +13,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" struct TernaryReductionPass : public llvm::FunctionPass { diff --git a/lib/Canonicalize/TwosComplementArithmeticNormalizationPass.cpp b/lib/Canonicalize/TwosComplementArithmeticNormalizationPass.cpp index 57870ce06..7148433e9 100644 --- a/lib/Canonicalize/TwosComplementArithmeticNormalizationPass.cpp +++ b/lib/Canonicalize/TwosComplementArithmeticNormalizationPass.cpp @@ -13,6 +13,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" struct TwosComplementArithmeticNormalizationPass : public llvm::FunctionPass { diff --git a/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp b/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp index 44ef9566c..588c35a70 100644 --- a/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp +++ b/lib/EarlyFunctionAnalysis/CFGAnalyzer.cpp @@ -37,6 +37,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Support/BasicBlockID.h" #include "revng/Support/Generator.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/TemporaryLLVMOption.h" @@ -382,12 +383,12 @@ CFGAnalyzer::State CFGAnalyzer::loadState(revng::IRBuilder &Builder) const { LLVMContext &Context = M.getContext(); // Load the stack pointer - auto *SP0 = createLoad(Builder, GCBI.spReg()); + auto *SP0 = Builder.createLoad(GCBI.spReg()); // Load the return address Value *ReturnAddress = nullptr; if (GlobalVariable *Register = GCBI.raReg()) { - ReturnAddress = createLoad(Builder, Register); + ReturnAddress = Builder.createLoad(Register); } else { auto *OpaquePointer = PointerType::get(Context, 0); auto *StackPointerPointer = Builder.CreateIntToPtr(SP0, OpaquePointer); @@ -409,7 +410,7 @@ CFGAnalyzer::State CFGAnalyzer::loadState(revng::IRBuilder &Builder) const { SmallVector CSVs; Type *IsRetTy = Type::getInt128Ty(Context); for (auto *CSR : ABICSVs) { - auto *V = createLoad(Builder, CSR); + auto *V = Builder.createLoad(CSR); CSVs.emplace_back(V); } @@ -1150,7 +1151,7 @@ void CallSummarizer::handleCall(MetaAddress CallerBlock, // Adjust back the stack pointer if (not IsTailCall) { if (MaybeFSO.has_value()) { - auto *StackPointer = createLoad(Builder, SPCSV); + auto *StackPointer = Builder.createLoad(SPCSV); Value *Offset = ConstantInt::get(StackPointer->getType(), *MaybeFSO); auto *AdjustedStackPointer = Builder.CreateAdd(StackPointer, Offset); Builder.CreateStore(AdjustedStackPointer, SPCSV); diff --git a/lib/EarlyFunctionAnalysis/DetectABI.cpp b/lib/EarlyFunctionAnalysis/DetectABI.cpp index 372e9b422..7fe5a0712 100644 --- a/lib/EarlyFunctionAnalysis/DetectABI.cpp +++ b/lib/EarlyFunctionAnalysis/DetectABI.cpp @@ -40,6 +40,7 @@ #include "revng/Pipes/ModelGlobal.h" #include "revng/Support/BasicBlockID.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/OpaqueRegisterUser.h" diff --git a/lib/EarlyFunctionAnalysis/Outliner.cpp b/lib/EarlyFunctionAnalysis/Outliner.cpp index 4c73522a5..8595e5320 100644 --- a/lib/EarlyFunctionAnalysis/Outliner.cpp +++ b/lib/EarlyFunctionAnalysis/Outliner.cpp @@ -16,6 +16,7 @@ #include "revng/EarlyFunctionAnalysis/CallHandler.h" #include "revng/EarlyFunctionAnalysis/Outliner.h" #include "revng/Model/IRHelpers.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/OpaqueRegisterUser.h" @@ -212,7 +213,7 @@ void Outliner::integrateFunctionCallee(CallHandler *TheCallHandler, PointeeType = CSV->getValueType(); } else { PointeeType = GCBI.spReg()->getValueType(); - Pointer = Builder.CreateIntToPtr(createLoad(Builder, GCBI.spReg()), + Pointer = Builder.CreateIntToPtr(Builder.createLoad(GCBI.spReg()), PointeeType->getPointerTo()); } diff --git a/lib/EarlyFunctionAnalysis/PromoteGlobalToLocalVars.cpp b/lib/EarlyFunctionAnalysis/PromoteGlobalToLocalVars.cpp index 685bdbb23..fc5a59069 100644 --- a/lib/EarlyFunctionAnalysis/PromoteGlobalToLocalVars.cpp +++ b/lib/EarlyFunctionAnalysis/PromoteGlobalToLocalVars.cpp @@ -8,6 +8,7 @@ #include "revng/EarlyFunctionAnalysis/PromoteGlobalToLocalVars.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/OpaqueRegisterUser.h" @@ -48,7 +49,7 @@ PromoteGlobalToLocalPass::run(llvm::Function &F, // Load all the CSVs and store their value onto the local variables. for (const auto &[CSV, Alloca] : CSVMap) - Builder.CreateStore(createLoad(Builder, CSV), Alloca); + Builder.CreateStore(Builder.createLoad(CSV), Alloca); return PreservedAnalyses::none(); } diff --git a/lib/FunctionIsolation/EnforceABI.cpp b/lib/FunctionIsolation/EnforceABI.cpp index 063bcbb54..2641e50dd 100644 --- a/lib/FunctionIsolation/EnforceABI.cpp +++ b/lib/FunctionIsolation/EnforceABI.cpp @@ -39,6 +39,7 @@ #include "revng/Pipes/RootKind.h" #include "revng/Pipes/TaggedFunctionKind.h" #include "revng/Support/BlockType.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/OpaqueFunctionsPool.h" @@ -292,7 +293,7 @@ static Value *loadCSVOrUndef(revng::IRBuilder &Builder, auto *Type = IntegerType::get(M->getContext(), Size * 8); return UndefValue::get(Type); } else { - return createLoad(Builder, CSV); + return Builder.createLoad(CSV); } } diff --git a/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp b/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp index 538715cc9..4ad7fc7ac 100644 --- a/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp +++ b/lib/FunctionIsolation/InvokeIsolatedFunctions.cpp @@ -22,6 +22,7 @@ #include "revng/Pipes/Kinds.h" #include "revng/Pipes/RootKind.h" #include "revng/Pipes/TaggedFunctionKind.h" +#include "revng/Support/IRBuilder.h" using namespace llvm; using std::tuple; @@ -167,7 +168,7 @@ public: auto Name = model::Register::getCSVName(Register); GlobalVariable *CSV = RootModule.getGlobalVariable(Name, true); revng_assert(CSV != nullptr); - Arguments.push_back(createLoad(Builder, CSV)); + Arguments.push_back(Builder.createLoad(CSV)); } } } diff --git a/lib/FunctionIsolation/IsolateFunctions.cpp b/lib/FunctionIsolation/IsolateFunctions.cpp index 2b6f0e406..84f5434d4 100644 --- a/lib/FunctionIsolation/IsolateFunctions.cpp +++ b/lib/FunctionIsolation/IsolateFunctions.cpp @@ -53,6 +53,7 @@ #include "revng/Pipes/StringMap.h" #include "revng/Pipes/TaggedFunctionKind.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/SimplePassManager.h" diff --git a/lib/FunctionIsolation/PromoteCSVs.cpp b/lib/FunctionIsolation/PromoteCSVs.cpp index 0424337fe..0975b02c7 100644 --- a/lib/FunctionIsolation/PromoteCSVs.cpp +++ b/lib/FunctionIsolation/PromoteCSVs.cpp @@ -17,6 +17,7 @@ #include "revng/Pipes/Kinds.h" #include "revng/Pipes/RootKind.h" #include "revng/Pipes/TaggedFunctionKind.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" using namespace llvm; @@ -227,7 +228,7 @@ Function *PromoteCSVs::createWrapper(const WrapperKey &Key) { // Update values of the out arguments unsigned OutArgument = FirstOutArgument; for (GlobalVariable *CSV : Written) { - Builder.CreateStore(createLoad(Builder, CSV), + Builder.CreateStore(Builder.createLoad(CSV), HelperWrapper->getArg(OutArgument)); ++OutArgument; } @@ -283,7 +284,7 @@ void PromoteCSVs::wrap(CallInst *Call, // Add arguments read for (GlobalVariable *CSV : Read) - NewArguments.push_back(createLoad(Builder, CSV)); + NewArguments.push_back(Builder.createLoad(CSV)); SmallVector WrittenCSVAllocas; for (GlobalVariable *CSV : Written) { @@ -300,7 +301,7 @@ void PromoteCSVs::wrap(CallInst *Call, // Restore into CSV the written registers for (const auto &[CSV, Alloca] : zip(Written, WrittenCSVAllocas)) - Builder.CreateStore(createLoad(Builder, Alloca), CSV); + Builder.CreateStore(Builder.createLoad(Alloca), CSV); // Erase the old call eraseFromParent(Call); diff --git a/lib/FunctionIsolation/StructInitializers.cpp b/lib/FunctionIsolation/StructInitializers.cpp index c6d05cf0a..80d7f177f 100644 --- a/lib/FunctionIsolation/StructInitializers.cpp +++ b/lib/FunctionIsolation/StructInitializers.cpp @@ -4,6 +4,7 @@ #include "revng/FunctionIsolation/StructInitializers.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" using namespace llvm; diff --git a/lib/Lift/CodeGenerator.cpp b/lib/Lift/CodeGenerator.cpp index 0790ce7f9..33a8a9621 100644 --- a/lib/Lift/CodeGenerator.cpp +++ b/lib/Lift/CodeGenerator.cpp @@ -54,6 +54,7 @@ #include "revng/Model/RawBinaryView.h" #include "revng/Support/CommandLine.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/SimplePassManager.h" diff --git a/lib/Lift/DropHelperCallsPass.h b/lib/Lift/DropHelperCallsPass.h index 33cf1cbe7..b69e4ed20 100644 --- a/lib/Lift/DropHelperCallsPass.h +++ b/lib/Lift/DropHelperCallsPass.h @@ -11,6 +11,7 @@ #include "llvm/IR/PassManager.h" #include "revng/Model/FunctionTags.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" using CSVToAllocaMap = llvm::DenseMapgetValueType(); Value *ToStore = nullptr; diff --git a/lib/LocalVariables/LocalVariableBuilder.cpp b/lib/LocalVariables/LocalVariableBuilder.cpp index 7358a801d..7da3e74da 100644 --- a/lib/LocalVariables/LocalVariableBuilder.cpp +++ b/lib/LocalVariables/LocalVariableBuilder.cpp @@ -150,7 +150,7 @@ LegacyVB::createLocalVariable(const model::Type &VariableType) { // Here we should definitely use the builder that checks the debug info, // but since this going to go away soon, let it stay as is. revng::NonDebugInfoCheckingIRBuilder B(F->getContext()); - setInsertPointToFirstNonAlloca(B, *F); + B.setInsertPointToFirstNonAlloca(*F); Constant *ReferenceString = toLLVMString(VariableType, *F->getParent()); return B.CreateCall(LocalVarFunction, { ReferenceString }); } @@ -189,7 +189,7 @@ LegacyVB::createCallStackArgumentVariable(const model::Type &VariableType) { llvm::Constant *VarTypeString = toLLVMString(VariableType, *F->getParent()); revng::NonDebugInfoCheckingIRBuilder B(F->getContext()); - setInsertPointToFirstNonAlloca(B, *F); + B.setInsertPointToFirstNonAlloca(*F); Value *Size = ConstantInt::get(Types.InputPointerSizedInteger, VariableSize); Instruction *Reference = B.CreateCall(getCallStackArgumentsAllocator(), @@ -214,7 +214,7 @@ LegacyVB::createStackFrameVariable(model::UpcastableType FrameType) { revng_assert(StackSize); revng::NonDebugInfoCheckingIRBuilder B(F->getContext()); - setInsertPointToFirstNonAlloca(B, *F); + B.setInsertPointToFirstNonAlloca(*F); Instruction *Reference = B.CreateCall(getStackFrameAllocator(), @@ -301,7 +301,7 @@ VB::LocalVarType *VB::createLocalVariable(const model::Type &VariableType) { revng_assert(VariableSize); revng::NonDebugInfoCheckingIRBuilder B(F->getContext()); - setInsertPointToFirstNonAlloca(B, *F); + B.setInsertPointToFirstNonAlloca(*F); return B.CreateAlloca(llvm::ArrayType::get(Types.Int8Ty, VariableSize)); } @@ -310,7 +310,7 @@ template<> std::pair VB::createLocalVariableAndTakeIntAddress(const model::Type &VariableType) { revng::NonDebugInfoCheckingIRBuilder B(F->getContext()); - setInsertPointToFirstNonAlloca(B, *F); + B.setInsertPointToFirstNonAlloca(*F); auto *Variable = createLocalVariable(VariableType); return { Variable, diff --git a/lib/Model/FunctionTags.cpp b/lib/Model/FunctionTags.cpp index 127c49889..a23893589 100644 --- a/lib/Model/FunctionTags.cpp +++ b/lib/Model/FunctionTags.cpp @@ -4,6 +4,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/ProgramCounterHandler.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" namespace FunctionTags { diff --git a/lib/Model/ProgramCounterHandler.cpp b/lib/Model/ProgramCounterHandler.cpp index fc1d2dd29..7d4f8e1ad 100644 --- a/lib/Model/ProgramCounterHandler.cpp +++ b/lib/Model/ProgramCounterHandler.cpp @@ -10,6 +10,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/ProgramCounterHandler.h" #include "revng/Support/Assert.h" +#include "revng/Support/IRBuilder.h" // This name corresponds to a function in `early-linked`. RegisterIRHelper SetMetaAddressHelper("set_PlainMetaAddress"); @@ -62,7 +63,7 @@ public: } Value *loadJumpablePC(revng::IRBuilder &Builder) const final { - return createLoad(Builder, AddressCSV); + return Builder.createLoad(AddressCSV); } std::array @@ -156,10 +157,10 @@ private: } Value *loadJumpablePC(revng::IRBuilder &Builder) const final { - auto *Address = createLoad(Builder, AddressCSV); + auto *Address = Builder.createLoad(AddressCSV); auto *AddressType = Address->getType(); return Builder.CreateOr(Address, - Builder.CreateZExt(createLoad(Builder, IsThumb), + Builder.CreateZExt(Builder.createLoad(IsThumb), AddressType)); } @@ -411,10 +412,10 @@ static void setPlainMetaAddressImpl(revng::IRBuilder &Builder, void PCH::setCurrentPCPlainMetaAddress(revng::IRBuilder &Builder) const { setPlainMetaAddressImpl(Builder, "current_pc", - createLoad(Builder, EpochCSV), - createLoad(Builder, AddressSpaceCSV), - createLoad(Builder, TypeCSV), - createLoad(Builder, AddressCSV)); + Builder.createLoad(EpochCSV), + Builder.createLoad(AddressSpaceCSV), + Builder.createLoad(TypeCSV), + Builder.createLoad(AddressCSV)); } void PCH::setLastPCPlainMetaAddress(revng::IRBuilder &Builder, @@ -618,10 +619,10 @@ public: bool Empty = Root->case_begin() == Root->case_end(); if (Empty) { revng::NonDebugInfoCheckingIRBuilder Builder(Root); - CurrentEpoch = createLoad(Builder, EpochCSV); - CurrentAddressSpace = createLoad(Builder, AddressSpaceCSV); - CurrentType = createLoad(Builder, TypeCSV); - CurrentAddress = createLoad(Builder, AddressCSV); + CurrentEpoch = Builder.createLoad(EpochCSV); + CurrentAddressSpace = Builder.createLoad(AddressSpaceCSV); + CurrentType = Builder.createLoad(TypeCSV); + CurrentAddress = Builder.createLoad(AddressCSV); } else { // Get the switches of the the first MA. This is just in order to get a // reference to their conditions @@ -819,10 +820,10 @@ PCH::buildDispatcher(DispatcherTargets &Targets, }); // First of all, create code to load the components of the MetaAddress - Value *CurrentEpoch = createLoad(Builder, EpochCSV); - Value *CurrentAddressSpace = createLoad(Builder, AddressSpaceCSV); - Value *CurrentType = createLoad(Builder, TypeCSV); - Value *CurrentAddress = createLoad(Builder, AddressCSV); + Value *CurrentEpoch = Builder.createLoad(EpochCSV); + Value *CurrentAddressSpace = Builder.createLoad(AddressSpaceCSV); + Value *CurrentType = Builder.createLoad(TypeCSV); + Value *CurrentAddress = Builder.createLoad(AddressCSV); SwitchManager SM(Default, CurrentEpoch, @@ -952,7 +953,7 @@ void PCH::buildHotPath(revng::IRBuilder &B, auto &[Address, BB] = CandidateTarget; auto CreateCmp = [&B](GlobalVariable *CSV, uint64_t Value) { - Instruction *Load = createLoad(B, CSV); + Instruction *Load = B.createLoad(CSV); Type *LoadType = Load->getType(); return B.CreateICmpEQ(Load, ConstantInt::get(LoadType, Value)); }; diff --git a/lib/PromoteStackPointer/InjectStackSizeProbesAtCallSitesPass.cpp b/lib/PromoteStackPointer/InjectStackSizeProbesAtCallSitesPass.cpp index b9ca368ee..8d0366bd8 100644 --- a/lib/PromoteStackPointer/InjectStackSizeProbesAtCallSitesPass.cpp +++ b/lib/PromoteStackPointer/InjectStackSizeProbesAtCallSitesPass.cpp @@ -6,6 +6,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/PromoteStackPointer/InjectStackSizeProbesAtCallSites.h" #include "revng/PromoteStackPointer/InjectStackSizeProbesAtCallSitesPass.h" +#include "revng/Support/IRBuilder.h" // This name is not present after `CleanupStackSizeMarkers`. RegisterIRHelper StackSizeAtCallSite("stack_size_at_call_site"); @@ -33,9 +34,9 @@ static bool injectStackSizeProbesAtCallSites(llvm::Module &M, for (Function &F : FunctionTags::Isolated.functions(&M)) { if (F.isDeclaration()) continue; - setInsertPointToFirstNonAlloca(B, F); + B.setInsertPointToFirstNonAlloca(F); - auto *SP0 = createLoad(B, SP); + auto *SP0 = B.createLoad(SP); for (BasicBlock &BB : F) { for (Instruction &I : BB) { @@ -45,7 +46,7 @@ static bool injectStackSizeProbesAtCallSites(llvm::Module &M, B.SetInsertPoint(&I); // Inject a call to the marker. First argument is sp - sp0 - auto *Call = B.CreateCall(SSACS, B.CreateSub(SP0, createLoad(B, SP))); + auto *Call = B.CreateCall(SSACS, B.CreateSub(SP0, B.createLoad(SP))); Call->copyMetadata(I); } } diff --git a/lib/PromoteStackPointer/InstrumentStackAccessesPass.cpp b/lib/PromoteStackPointer/InstrumentStackAccessesPass.cpp index ed3d07086..dd3a3cdec 100644 --- a/lib/PromoteStackPointer/InstrumentStackAccessesPass.cpp +++ b/lib/PromoteStackPointer/InstrumentStackAccessesPass.cpp @@ -8,6 +8,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/IRHelpers.h" #include "revng/PromoteStackPointer/InstrumentStackAccessesPass.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/OpaqueFunctionsPool.h" diff --git a/lib/PromoteStackPointer/PromoteStackPointerPass.cpp b/lib/PromoteStackPointer/PromoteStackPointerPass.cpp index d4c045065..2e3cb2ff7 100644 --- a/lib/PromoteStackPointer/PromoteStackPointerPass.cpp +++ b/lib/PromoteStackPointer/PromoteStackPointerPass.cpp @@ -32,6 +32,7 @@ #include "revng/PromoteStackPointer/PromoteStackPointerPass.h" #include "revng/Support/Assert.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" // This name is not present after `promote-stack-pointer`. RegisterIRHelper UndefinedLocalSPMarker("revng_undefined_local_sp"); @@ -77,7 +78,7 @@ static bool adjustStackAfterCalls(const model::Binary &Binary, Changed = true; B.SetInsertPoint(I.getNextNode()); - B.CreateStore(B.CreateAdd(createLoad(B, GlobalSP), FSO), GlobalSP); + B.CreateStore(B.CreateAdd(B.createLoad(GlobalSP), FSO), GlobalSP); } } } @@ -169,7 +170,7 @@ static bool promoteStackPointer(const model::Binary &Binary, AllocaInst *LocalSP = Builder.CreateAlloca(SPType, nullptr, "local_sp"); // Call InitLocalSP, to initialize the value of the local stack pointer. - setInsertPointToFirstNonAlloca(Builder, F); + Builder.setInsertPointToFirstNonAlloca(F); auto *SPVal = Builder.CreateCall(InitLocalSP); // Store the initial SP value in the new alloca. diff --git a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp index 20b96876d..8945d8077 100644 --- a/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp +++ b/lib/PromoteStackPointer/SegregateStackAccessesPass.cpp @@ -1230,7 +1230,7 @@ void SegregateFunctionStack::upgrade() { // TODO: the checks should be enabled conditionally based on the user. revng::NonDebugInfoCheckingIRBuilder B(NewFunction->getContext()); - setInsertPointToFirstNonAlloca(B, *NewFunction); + B.setInsertPointToFirstNonAlloca(*NewFunction); lowerArguments(B); diff --git a/lib/RemoveExtractValues/RemoveExtractValuesPass.cpp b/lib/RemoveExtractValues/RemoveExtractValuesPass.cpp index b0dc3ba7c..5461fa309 100644 --- a/lib/RemoveExtractValues/RemoveExtractValuesPass.cpp +++ b/lib/RemoveExtractValues/RemoveExtractValuesPass.cpp @@ -7,6 +7,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/RemoveExtractValues/RemoveExtractValuesPass.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/OpaqueFunctionsPool.h" using namespace llvm; diff --git a/lib/RemoveLiftingArtifacts/CleanupIRPass.cpp b/lib/RemoveLiftingArtifacts/CleanupIRPass.cpp index 21a487dca..0cb757db4 100644 --- a/lib/RemoveLiftingArtifacts/CleanupIRPass.cpp +++ b/lib/RemoveLiftingArtifacts/CleanupIRPass.cpp @@ -14,6 +14,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/Model/LoadModelPass.h" #include "revng/RemoveLiftingArtifacts/CleanupIR.h" +#include "revng/Support/IRBuilder.h" using namespace llvm; diff --git a/lib/RemoveLiftingArtifacts/MakeSegmentRefPass.cpp b/lib/RemoveLiftingArtifacts/MakeSegmentRefPass.cpp index 07762ccf6..00e87d13d 100644 --- a/lib/RemoveLiftingArtifacts/MakeSegmentRefPass.cpp +++ b/lib/RemoveLiftingArtifacts/MakeSegmentRefPass.cpp @@ -34,6 +34,7 @@ #include "revng/Pipes/Kinds.h" #include "revng/RemoveLiftingArtifacts/MakeSegmentRef.h" #include "revng/Support/Debug.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" #include "revng/Support/MetaAddress.h" #include "revng/Support/OpaqueFunctionsPool.h" diff --git a/lib/RestructureCFG/EnforceSingleExitPass.cpp b/lib/RestructureCFG/EnforceSingleExitPass.cpp index 9c2ebfab2..ad2ace542 100644 --- a/lib/RestructureCFG/EnforceSingleExitPass.cpp +++ b/lib/RestructureCFG/EnforceSingleExitPass.cpp @@ -11,6 +11,7 @@ #include "revng/RestructureCFG/ScopeGraphGraphTraits.h" #include "revng/RestructureCFG/ScopeGraphUtils.h" #include "revng/Support/GraphAlgorithms.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" using namespace llvm; diff --git a/lib/RestructureCFG/ScopeGraphUtils.cpp b/lib/RestructureCFG/ScopeGraphUtils.cpp index ed434b69f..4c0f267c0 100644 --- a/lib/RestructureCFG/ScopeGraphUtils.cpp +++ b/lib/RestructureCFG/ScopeGraphUtils.cpp @@ -10,6 +10,7 @@ #include "revng/Model/FunctionTags.h" #include "revng/RestructureCFG/ScopeGraphUtils.h" +#include "revng/Support/IRBuilder.h" #include "revng/Support/IRHelpers.h" using namespace llvm; diff --git a/lib/RestructureCFG/SimplifyHybridNot.cpp b/lib/RestructureCFG/SimplifyHybridNot.cpp index e20fc8672..538623e53 100644 --- a/lib/RestructureCFG/SimplifyHybridNot.cpp +++ b/lib/RestructureCFG/SimplifyHybridNot.cpp @@ -15,6 +15,7 @@ #include "revng/RestructureCFG/ASTTree.h" #include "revng/RestructureCFG/ExprNode.h" #include "revng/Support/Assert.h" +#include "revng/Support/IRBuilder.h" #include "SimplifyHybridNot.h"