LLVM: lib/Target/BPF/BPFPreserveStaticOffset.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "bpf-preserve-static-offset"
Functions
static bool isIntrinsicCall (Value *I, Intrinsic::ID Id)
static bool isPreserveStaticOffsetCall (Value *I)
static CallInst * isGEPAndLoad (Value *I)
static CallInst * isGEPAndStore (Value *I)
template<class T = Instruction>
static DebugLoc mergeDebugLocs (SmallVector< T * > &Insns)
static CallInst * makeIntrinsicCall (Module *M, Intrinsic::BPFIntrinsics Intrinsic, ArrayRef< Type * > Types, ArrayRef< Value * > Args)
static void setParamElementType (CallInst *Call, unsigned ArgNo, Type *Type)
static void setParamReadNone (CallInst *Call, unsigned ArgNo)
static void setParamReadOnly (CallInst *Call, unsigned ArgNo)
static void setParamWriteOnly (CallInst *Call, unsigned ArgNo)
template<class T = std::disjunction<LoadInst, StoreInst>>
static void fillCommonArgs (LLVMContext &C, SmallVector< Value * > &Args, GEPChainInfo &GEP, T *Insn)
static Instruction * makeGEPAndLoad (Module *M, GEPChainInfo &GEP, LoadInst *Load)
static Instruction * makeGEPAndStore (Module *M, GEPChainInfo &GEP, StoreInst *Store)
static unsigned getOperandAsUnsigned (CallInst *Call, unsigned ArgNo)
static GetElementPtrInst * reconstructGEP (CallInst *Call, int Delta)
template<class T = std::disjunction<LoadInst, StoreInst>>
static void reconstructCommon (CallInst *Call, GetElementPtrInst *GEP, T *Insn, int Delta)
static bool isZero (Value *V)
static bool foldGEPChainAsStructAccess (SmallVector< GetElementPtrInst * > &GEPs, GEPChainInfo &Info)
static bool foldGEPChainAsU8Access (SmallVector< GetElementPtrInst * > &GEPs, GEPChainInfo &Info)
static void reportNonStaticGEPChain (Instruction *Insn)
static bool allZeroIndices (SmallVector< GetElementPtrInst * > &GEPs)
static bool tryToReplaceWithGEPBuiltin (Instruction *LoadOrStoreTemplate, SmallVector< GetElementPtrInst * > &GEPs, Instruction *InsnToReplace)
static bool isPointerOperand (Value *I, User *U)
static bool isInlineableCall (User *U)
static void rewriteAccessChain (Instruction *Insn, SmallVector< GetElementPtrInst * > &GEPs, SmallVector< Instruction * > &Visited, bool AllowPatial, bool &StillUsed)
static void rewriteUses (Instruction *Insn, SmallVector< GetElementPtrInst * > &GEPs, SmallVector< Instruction * > &Visited, bool AllowPatial, bool &StillUsed)
static void removeMarkerCall (Instruction *Marker)
static bool rewriteAccessChain (Instruction *Marker, bool AllowPatial, SmallPtrSetImpl< Instruction * > &RemovedMarkers)
static std::vector< Instruction * > collectPreserveStaticOffsetCalls (Function &F)
bool isPreserveArrayIndex (Value *V)
bool isPreserveStructIndex (Value *V)
bool isPreserveUnionIndex (Value *V)
static void removePAICalls (Instruction *Marker)
static bool rewriteFunction (Function &F, bool AllowPartial)

DEBUG_TYPE

#define DEBUG_TYPE "bpf-preserve-static-offset"

allZeroIndices()

collectPreserveStaticOffsetCalls()

fillCommonArgs()

template<class T = std::disjunction<LoadInst, StoreInst>>

foldGEPChainAsStructAccess()

foldGEPChainAsU8Access()

getOperandAsUnsigned()

isGEPAndLoad()

isGEPAndStore()

isInlineableCall()

bool isInlineableCall ( User * U) static

isIntrinsicCall()

isPointerOperand()

isPreserveArrayIndex()

isPreserveStaticOffsetCall()

bool isPreserveStaticOffsetCall ( Value * I) static

isPreserveStructIndex()

isPreserveUnionIndex()

isZero()

makeGEPAndLoad()

makeGEPAndStore()

makeIntrinsicCall()

mergeDebugLocs()

template<class T = Instruction>

reconstructCommon()

template<class T = std::disjunction<LoadInst, StoreInst>>

reconstructGEP()

removeMarkerCall()

removePAICalls()

Definition at line 609 of file BPFPreserveStaticOffset.cpp.

References Call, llvm::cast(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), GEP, isPreserveArrayIndex(), isPreserveStaticOffsetCall(), isPreserveStructIndex(), isPreserveUnionIndex(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::BPFCoreSharedInfo::removeArrayAccessCall(), llvm::BPFCoreSharedInfo::removeStructAccessCall(), llvm::BPFCoreSharedInfo::removeUnionAccessCall(), and llvm::Value::users().

Referenced by rewriteFunction().

reportNonStaticGEPChain()

void reportNonStaticGEPChain ( Instruction * Insn) static

rewriteAccessChain() [1/2]

Definition at line 497 of file BPFPreserveStaticOffset.cpp.

References allZeroIndices(), llvm::cast(), llvm::concat(), llvm::dyn_cast(), GEP, llvm::isa(), 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().

rewriteAccessChain() [2/2]

rewriteFunction()

rewriteUses()

setParamElementType()

setParamReadNone()

setParamReadOnly()

setParamWriteOnly()

tryToReplaceWithGEPBuiltin()

GepAndLoadFirstIdxArg

GepAndStoreFirstIdxArg