LLVM 20.0.0git
Classes | Namespaces | Functions
MemoryBuiltins.h File Reference
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/TargetFolder.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/ValueHandle.h"
#include <cstdint>
#include <optional>
#include <utility>

Go to the source code of this file.

Classes

struct  llvm::ObjectSizeOpts
 Various options to control the behavior of getObjectSize. More...
 
struct  llvm::SizeOffsetType< T, C >
 SizeOffsetType - A base template class for the object size visitors. More...
 
struct  llvm::SizeOffsetAPInt
 SizeOffsetAPInt - Used by ObjectSizeOffsetVisitor, which works with APInts. More...
 
class  llvm::ObjectSizeOffsetVisitor
 Evaluate the size and offset of an object pointed to by a Value* statically. More...
 
struct  llvm::SizeOffsetValue
 
struct  llvm::SizeOffsetWeakTrackingVH
 SizeOffsetWeakTrackingVH - Used by ObjectSizeOffsetEvaluator in a DenseMap. More...
 
class  llvm::ObjectSizeOffsetEvaluator
 Evaluate the size and offset of an object pointed to by a Value*. More...
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 

Functions

bool llvm::isAllocationFn (const Value *V, const TargetLibraryInfo *TLI)
 Tests if a value is a call or invoke to a library function that allocates or reallocates memory (either malloc, calloc, realloc, or strdup like).
 
bool llvm::isAllocationFn (const Value *V, function_ref< const TargetLibraryInfo &(Function &)> GetTLI)
 
bool llvm::isNewLikeFn (const Value *V, const TargetLibraryInfo *TLI)
 Tests if a value is a call or invoke to a library function that allocates memory via new.
 
bool llvm::isMallocOrCallocLikeFn (const Value *V, const TargetLibraryInfo *TLI)
 Tests if a value is a call or invoke to a library function that allocates memory similar to malloc or calloc.
 
bool llvm::isAllocLikeFn (const Value *V, const TargetLibraryInfo *TLI)
 Tests if a value is a call or invoke to a library function that allocates memory (either malloc, calloc, or strdup like).
 
bool llvm::isReallocLikeFn (const Function *F)
 Tests if a function is a call or invoke to a library function that reallocates memory (e.g., realloc).
 
Valuellvm::getReallocatedOperand (const CallBase *CB)
 If this is a call to a realloc function, return the reallocated operand.
 
bool llvm::isLibFreeFunction (const Function *F, const LibFunc TLIFn)
 isLibFreeFunction - Returns true if the function is a builtin free()
 
Valuellvm::getFreedOperand (const CallBase *CB, const TargetLibraryInfo *TLI)
 If this if a call to a free function, return the freed operand.
 
bool llvm::isRemovableAlloc (const CallBase *V, const TargetLibraryInfo *TLI)
 Return true if this is a call to an allocation function that does not have side effects that we are required to preserve beyond the effect of allocating a new object.
 
Valuellvm::getAllocAlignment (const CallBase *V, const TargetLibraryInfo *TLI)
 Gets the alignment argument for an aligned_alloc-like function, using either built-in knowledge based on fuction names/signatures or allocalign attributes.
 
std::optional< APIntllvm::getAllocSize (const CallBase *CB, const TargetLibraryInfo *TLI, function_ref< const Value *(const Value *)> Mapper=[](const Value *V) { return V;})
 Return the size of the requested allocation.
 
Constantllvm::getInitialValueOfAllocation (const Value *V, const TargetLibraryInfo *TLI, Type *Ty)
 If this is a call to an allocation function that initializes memory to a fixed value, return said value in the requested type.
 
std::optional< StringRefllvm::getAllocationFamily (const Value *I, const TargetLibraryInfo *TLI)
 If a function is part of an allocation family (e.g.
 
bool llvm::getObjectSize (const Value *Ptr, uint64_t &Size, const DataLayout &DL, const TargetLibraryInfo *TLI, ObjectSizeOpts Opts={})
 Compute the size of the object pointed by Ptr.
 
Valuellvm::lowerObjectSizeCall (IntrinsicInst *ObjectSize, const DataLayout &DL, const TargetLibraryInfo *TLI, bool MustSucceed)
 Try to turn a call to @llvm.objectsize into an integer value of the given Type.
 
Valuellvm::lowerObjectSizeCall (IntrinsicInst *ObjectSize, const DataLayout &DL, const TargetLibraryInfo *TLI, AAResults *AA, bool MustSucceed, SmallVectorImpl< Instruction * > *InsertedInstructions=nullptr)