LLVM 20.0.0git
|
#include "BPF.h"
#include "BPFCORE.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.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 122 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 407 of file BPFPreserveStaticOffset.cpp.
References llvm::all_of(), llvm::SmallVectorBase< Size_T >::empty(), and GEP.
Referenced by rewriteAccessChain().
|
static |
Definition at line 593 of file BPFPreserveStaticOffset.cpp.
References F, Insn, instructions, and isPreserveStaticOffsetCall().
Referenced by rewriteFunction().
|
static |
Definition at line 208 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 331 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 371 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 267 of file BPFPreserveStaticOffset.cpp.
References Int, and llvm::report_fatal_error().
Referenced by reconstructCommon(), and reconstructGEP().
Definition at line 140 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 146 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 449 of file BPFPreserveStaticOffset.cpp.
Referenced by rewriteAccessChain(), and rewriteUses().
|
static |
Definition at line 129 of file BPFPreserveStaticOffset.cpp.
References I.
Referenced by isGEPAndLoad(), isGEPAndStore(), and isPreserveStaticOffsetCall().
Definition at line 435 of file BPFPreserveStaticOffset.cpp.
References GEP, I, isGEPAndLoad(), and isGEPAndStore().
Referenced by isInterestingPointerComparison(), isInterestingPointerSubtraction(), and rewriteUses().
Definition at line 601 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 136 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by collectPreserveStaticOffsetCalls(), removePAICalls(), rewriteAccessChain(), and rewriteUses().
Definition at line 605 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 609 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 323 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 223 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndLoadFirstIdxArg, I, makeIntrinsicCall(), mergeDILocations(), setParamElementType(), and setParamReadOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 243 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndStoreFirstIdxArg, getType(), I, makeIntrinsicCall(), mergeDILocations(), setParamElementType(), setParamReadNone(), and setParamWriteOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 160 of file BPFPreserveStaticOffset.cpp.
References llvm::CallInst::Create(), and llvm::Intrinsic::getOrInsertDeclaration().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 153 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 290 of file BPFPreserveStaticOffset.cpp.
References GEP, getOperandAsUnsigned(), and Insn.
Referenced by llvm::BPFPreserveStaticOffsetPass::reconstructLoad(), and llvm::BPFPreserveStaticOffsetPass::reconstructStore().
|
static |
Definition at line 277 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 568 of file BPFPreserveStaticOffset.cpp.
References llvm::Instruction::eraseFromParent(), llvm::User::getOperand(), and llvm::Value::replaceAllUsesWith().
Referenced by rewriteAccessChain(), and rewriteFunction().
|
static |
Definition at line 613 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 395 of file BPFPreserveStaticOffset.cpp.
References llvm::concat(), llvm::DS_Warning, and Insn.
Referenced by rewriteAccessChain().
|
static |
Definition at line 501 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 648 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 460 of file BPFPreserveStaticOffset.cpp.
References llvm::dbgs(), Insn, isInlineableCall(), isPointerOperand(), isPreserveStaticOffsetCall(), LLVM_DEBUG, and rewriteAccessChain().
Referenced by rewriteAccessChain().
Definition at line 169 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
Definition at line 174 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
Definition at line 179 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad().
Definition at line 184 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
|
static |
Definition at line 413 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 126 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndLoad().
Definition at line 127 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndStore().