LLVM 22.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/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 121 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 403 of file BPFPreserveStaticOffset.cpp.
References llvm::all_of(), llvm::SmallVectorBase< Size_T >::empty(), and GEP.
Referenced by rewriteAccessChain().
|
static |
Definition at line 589 of file BPFPreserveStaticOffset.cpp.
References F, instructions, and isPreserveStaticOffsetCall().
Referenced by rewriteFunction().
|
static |
Definition at line 207 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, GEP, llvm::Type::getInt1Ty(), llvm::Type::getInt8Ty(), and llvm::Log2_64().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 329 of file BPFPreserveStaticOffset.cpp.
References llvm::all_of(), llvm::drop_begin(), llvm::SmallVectorBase< Size_T >::empty(), llvm::First, GEP, Info, and isZero().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 368 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 265 of file BPFPreserveStaticOffset.cpp.
References Int, and llvm::report_fatal_error().
Referenced by reconstructCommon(), and reconstructGEP().
Definition at line 139 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 145 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by isPointerOperand(), and rewriteAccessChain().
Definition at line 445 of file BPFPreserveStaticOffset.cpp.
Referenced by rewriteAccessChain(), and rewriteUses().
|
static |
Definition at line 128 of file BPFPreserveStaticOffset.cpp.
References I.
Referenced by isGEPAndLoad(), isGEPAndStore(), and isPreserveStaticOffsetCall().
Definition at line 431 of file BPFPreserveStaticOffset.cpp.
References GEP, I, isGEPAndLoad(), and isGEPAndStore().
Referenced by isInterestingPointerComparison(), isInterestingPointerSubtraction(), and rewriteUses().
Definition at line 597 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 135 of file BPFPreserveStaticOffset.cpp.
References I, and isIntrinsicCall().
Referenced by collectPreserveStaticOffsetCalls(), removePAICalls(), rewriteAccessChain(), and rewriteUses().
Definition at line 601 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 605 of file BPFPreserveStaticOffset.cpp.
References isIntrinsicCall().
Referenced by removePAICalls().
Definition at line 321 of file BPFPreserveStaticOffset.cpp.
|
static |
Definition at line 222 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndLoadFirstIdxArg, I, makeIntrinsicCall(), mergeDebugLocs(), setParamElementType(), and setParamReadOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 242 of file BPFPreserveStaticOffset.cpp.
References fillCommonArgs(), GEP, GepAndStoreFirstIdxArg, getType(), I, makeIntrinsicCall(), mergeDebugLocs(), setParamElementType(), setParamReadNone(), and setParamWriteOnly().
Referenced by tryToReplaceWithGEPBuiltin().
|
static |
Definition at line 159 of file BPFPreserveStaticOffset.cpp.
References llvm::CallInst::Create(), and llvm::Intrinsic::getOrInsertDeclaration().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 152 of file BPFPreserveStaticOffset.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), getDebugLoc(), llvm::DebugLoc::getMergedLocation(), and I.
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
|
static |
Definition at line 288 of file BPFPreserveStaticOffset.cpp.
References GEP, and getOperandAsUnsigned().
Referenced by llvm::BPFPreserveStaticOffsetPass::reconstructLoad(), and llvm::BPFPreserveStaticOffsetPass::reconstructStore().
|
static |
Definition at line 275 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 564 of file BPFPreserveStaticOffset.cpp.
References llvm::Instruction::eraseFromParent(), llvm::User::getOperand(), and llvm::Value::replaceAllUsesWith().
Referenced by rewriteAccessChain(), and rewriteFunction().
|
static |
Definition at line 609 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 392 of file BPFPreserveStaticOffset.cpp.
References llvm::concat(), llvm::LLVMContext::diagnose(), llvm::DS_Warning, llvm::Value::getContext(), llvm::Instruction::getDebugLoc(), and llvm::Instruction::getFunction().
Referenced by rewriteAccessChain().
|
static |
Definition at line 497 of file BPFPreserveStaticOffset.cpp.
References allZeroIndices(), llvm::concat(), GEP, 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 644 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 456 of file BPFPreserveStaticOffset.cpp.
References llvm::dbgs(), isInlineableCall(), isPointerOperand(), isPreserveStaticOffsetCall(), LLVM_DEBUG, rewriteAccessChain(), and llvm::Value::users().
Referenced by rewriteAccessChain().
Definition at line 168 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad(), and makeGEPAndStore().
Definition at line 173 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
Definition at line 178 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndLoad().
Definition at line 183 of file BPFPreserveStaticOffset.cpp.
References llvm::CallingConv::C, and llvm::Attribute::get().
Referenced by makeGEPAndStore().
|
static |
Definition at line 409 of file BPFPreserveStaticOffset.cpp.
References foldGEPChainAsStructAccess(), foldGEPChainAsU8Access(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getModule(), llvm::Instruction::insertBefore(), makeGEPAndLoad(), makeGEPAndStore(), and llvm::Value::replaceAllUsesWith().
Referenced by rewriteAccessChain().
Definition at line 125 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndLoad().
Definition at line 126 of file BPFPreserveStaticOffset.cpp.
Referenced by makeGEPAndStore().