LLVM 20.0.0git
|
#include "BPF.h"
#include "BPFCORE.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsBPF.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "bpf-preserve-static-offset" |
Variables | |
static const unsigned | GepAndLoadFirstIdxArg = 6 |
static const unsigned | GepAndStoreFirstIdxArg = 7 |
#define DEBUG_TYPE "bpf-preserve-static-offset" |
Definition at line 123 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 408 of file BPFPreserveStaticOffset.cpp.
References llvm::all_of(), llvm::SmallVectorBase< Size_T >::empty(), and GEP.
Referenced by rewriteAccessChain().
|
static |
Definition at line 594 of file BPFPreserveStaticOffset.cpp.
References F, Insn, instructions, and isPreserveStaticOffsetCall().
Referenced by rewriteFunction().
|
static |
Definition at line 209 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, GEP, llvm::Type::getInt1Ty(), llvm::Type::getInt8Ty(), Insn, and llvm::Log2_64().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 332 of file BPFPreserveStaticOffset.cpp.
References llvm::all_of(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::First, GEP, Info, and isZero().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 372 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, DL, llvm::SmallVectorBase< Size_T >::empty(), llvm::First, GEP, llvm::Type::getInt8Ty(), Info, and llvm::Offset.
Referenced by tryToReplaceWithGEPBuiltin().
Definition at line 268 of file BPFPreserveStaticOffset.cpp.
References Int, and llvm::report_fatal_error().
Referenced by reconstructCommon(), and reconstructGEP().
Definition at line 141 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 147 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 450 of file BPFPreserveStaticOffset.cpp.
Referenced by rewriteAccessChain(), and rewriteUses().
|
static |
Definition at line 130 of file BPFPreserveStaticOffset.cpp.
References I.
Referenced by isGEPAndLoad(), isGEPAndStore(), and isPreserveStaticOffsetCall().
Definition at line 436 of file BPFPreserveStaticOffset.cpp.
References GEP, I, isGEPAndLoad(), and isGEPAndStore().
Referenced by isInterestingPointerComparison(), isInterestingPointerSubtraction(), and rewriteUses().
Definition at line 602 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 137 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by collectPreserveStaticOffsetCalls(), removePAICalls(), rewriteAccessChain(), and rewriteUses().
Definition at line 606 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 610 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 324 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 224 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndLoadFirstIdxArg, I, makeIntrinsicCall(), mergeDILocations(), setParamElementType(), and setParamReadOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 244 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndStoreFirstIdxArg, getType(), I, makeIntrinsicCall(), mergeDILocations(), setParamElementType(), setParamReadNone(), and setParamWriteOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 161 of file BPFPreserveStaticOffset.cpp.
References llvm::CallInst::Create(), and llvm::Intrinsic::getDeclaration().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 154 of file BPFPreserveStaticOffset.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), getDebugLoc(), llvm::DILocation::getMergedLocation(), and I.
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 291 of file BPFPreserveStaticOffset.cpp.
References GEP, getOperandAsUnsigned(), and Insn.
Referenced by llvm::BPFPreserveStaticOffsetPass::reconstructLoad(), and llvm::BPFPreserveStaticOffsetPass::reconstructStore().
|
static |
Definition at line 278 of file BPFPreserveStaticOffset.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::GetElementPtrInst::Create(), GEP, and getOperandAsUnsigned().
Referenced by llvm::BPFPreserveStaticOffsetPass::reconstructLoad(), and llvm::BPFPreserveStaticOffsetPass::reconstructStore().
|
static |
Definition at line 569 of file BPFPreserveStaticOffset.cpp.
References llvm::Instruction::eraseFromParent(), llvm::User::getOperand(), and llvm::Value::replaceAllUsesWith().
Referenced by rewriteAccessChain(), and rewriteFunction().
|
static |
Definition at line 614 of file BPFPreserveStaticOffset.cpp.
References llvm::SmallVectorBase< Size_T >::empty(), GEP, isPreserveArrayIndex(), isPreserveStaticOffsetCall(), isPreserveStructIndex(), isPreserveUnionIndex(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BPFCoreSharedInfo::removeArrayAccessCall(), llvm::BPFCoreSharedInfo::removeStructAccessCall(), and llvm::BPFCoreSharedInfo::removeUnionAccessCall().
Referenced by rewriteFunction().
|
static |
Definition at line 396 of file BPFPreserveStaticOffset.cpp.
References llvm::concat(), llvm::DS_Warning, and Insn.
Referenced by rewriteAccessChain().
|
static |
Definition at line 502 of file BPFPreserveStaticOffset.cpp.
References allZeroIndices(), llvm::concat(), GEP, Insn, isGEPAndLoad(), isGEPAndStore(), isInlineableCall(), isPreserveStaticOffsetCall(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BPFPreserveStaticOffsetPass::reconstructLoad(), llvm::BPFPreserveStaticOffsetPass::reconstructStore(), llvm::report_fatal_error(), reportNonStaticGEPChain(), rewriteUses(), and tryToReplaceWithGEPBuiltin().
Referenced by rewriteFunction(), and rewriteUses().
|
static |
Definition at line 649 of file BPFPreserveStaticOffset.cpp.
References collectPreserveStaticOffsetCalls(), llvm::SmallPtrSetImpl< PtrType >::contains(), llvm::dbgs(), F, LLVM_DEBUG, removeMarkerCall(), removePAICalls(), and rewriteAccessChain().
Referenced by llvm::BPFPreserveStaticOffsetPass::run().
|
static |
Definition at line 461 of file BPFPreserveStaticOffset.cpp.
References llvm::dbgs(), Insn, isInlineableCall(), isPointerOperand(), isPreserveStaticOffsetCall(), LLVM_DEBUG, and rewriteAccessChain().
Referenced by rewriteAccessChain().
Definition at line 170 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
Definition at line 175 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
Definition at line 180 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad().
Definition at line 185 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
|
static |
Definition at line 414 of file BPFPreserveStaticOffset.cpp.
References foldGEPChainAsStructAccess(), foldGEPChainAsU8Access(), llvm::Instruction::getModule(), llvm::Instruction::insertBefore(), makeGEPAndLoad(), makeGEPAndStore(), and llvm::Value::replaceAllUsesWith().
Referenced by rewriteAccessChain().
Definition at line 127 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndLoad().
Definition at line 128 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndStore().