LLVM 18.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::ObjectSizeOffsetVisitor Class Reference

Evaluate the size and offset of an object pointed to by a Value* statically. More...

#include "llvm/Analysis/MemoryBuiltins.h"

Inheritance diagram for llvm::ObjectSizeOffsetVisitor:
Inheritance graph

Public Member Functions

 ObjectSizeOffsetVisitor (const DataLayout &DL, const TargetLibraryInfo *TLI, LLVMContext &Context, ObjectSizeOpts Options={})
SizeOffsetType compute (Value *V)
SizeOffsetType visitAllocaInst (AllocaInst &I)
SizeOffsetType visitArgument (Argument &A)
SizeOffsetType visitCallBase (CallBase &CB)
SizeOffsetType visitConstantPointerNull (ConstantPointerNull &)
SizeOffsetType visitExtractElementInst (ExtractElementInst &I)
SizeOffsetType visitExtractValueInst (ExtractValueInst &I)
SizeOffsetType visitGlobalAlias (GlobalAlias &GA)
SizeOffsetType visitGlobalVariable (GlobalVariable &GV)
SizeOffsetType visitIntToPtrInst (IntToPtrInst &)
SizeOffsetType visitLoadInst (LoadInst &I)
SizeOffsetType visitPHINode (PHINode &)
SizeOffsetType visitSelectInst (SelectInst &I)
SizeOffsetType visitUndefValue (UndefValue &)
SizeOffsetType visitInstruction (Instruction &I)
- Public Member Functions inherited from llvm::InstVisitor< ObjectSizeOffsetVisitor, SizeOffsetType >
void visit (Iterator Start, Iterator End)
void visit (Module &M)
void visit (Function &F)
void visit (BasicBlock &BB)
void visit (Module *M)
void visit (Function *F)
void visit (BasicBlock *BB)
SizeOffsetType visit (Instruction *I)
SizeOffsetType visit (Instruction &I)
void visitModule (Module &M)
void visitFunction (Function &F)
void visitBasicBlock (BasicBlock &BB)
SizeOffsetType visitICmpInst (ICmpInst &I)
SizeOffsetType visitFCmpInst (FCmpInst &I)
SizeOffsetType visitAllocaInst (AllocaInst &I)
SizeOffsetType visitLoadInst (LoadInst &I)
SizeOffsetType visitStoreInst (StoreInst &I)
SizeOffsetType visitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
SizeOffsetType visitAtomicRMWInst (AtomicRMWInst &I)
SizeOffsetType visitFenceInst (FenceInst &I)
SizeOffsetType visitGetElementPtrInst (GetElementPtrInst &I)
SizeOffsetType visitPHINode (PHINode &I)
SizeOffsetType visitTruncInst (TruncInst &I)
SizeOffsetType visitZExtInst (ZExtInst &I)
SizeOffsetType visitSExtInst (SExtInst &I)
SizeOffsetType visitFPTruncInst (FPTruncInst &I)
SizeOffsetType visitFPExtInst (FPExtInst &I)
SizeOffsetType visitFPToUIInst (FPToUIInst &I)
SizeOffsetType visitFPToSIInst (FPToSIInst &I)
SizeOffsetType visitUIToFPInst (UIToFPInst &I)
SizeOffsetType visitSIToFPInst (SIToFPInst &I)
SizeOffsetType visitPtrToIntInst (PtrToIntInst &I)
SizeOffsetType visitIntToPtrInst (IntToPtrInst &I)
SizeOffsetType visitBitCastInst (BitCastInst &I)
SizeOffsetType visitAddrSpaceCastInst (AddrSpaceCastInst &I)
SizeOffsetType visitSelectInst (SelectInst &I)
SizeOffsetType visitVAArgInst (VAArgInst &I)
SizeOffsetType visitExtractElementInst (ExtractElementInst &I)
SizeOffsetType visitInsertElementInst (InsertElementInst &I)
SizeOffsetType visitShuffleVectorInst (ShuffleVectorInst &I)
SizeOffsetType visitExtractValueInst (ExtractValueInst &I)
SizeOffsetType visitInsertValueInst (InsertValueInst &I)
SizeOffsetType visitLandingPadInst (LandingPadInst &I)
SizeOffsetType visitFuncletPadInst (FuncletPadInst &I)
SizeOffsetType visitCleanupPadInst (CleanupPadInst &I)
SizeOffsetType visitCatchPadInst (CatchPadInst &I)
SizeOffsetType visitFreezeInst (FreezeInst &I)
SizeOffsetType visitDbgDeclareInst (DbgDeclareInst &I)
SizeOffsetType visitDbgValueInst (DbgValueInst &I)
SizeOffsetType visitDbgVariableIntrinsic (DbgVariableIntrinsic &I)
SizeOffsetType visitDbgLabelInst (DbgLabelInst &I)
SizeOffsetType visitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
SizeOffsetType visitMemSetInst (MemSetInst &I)
SizeOffsetType visitMemSetInlineInst (MemSetInlineInst &I)
SizeOffsetType visitMemCpyInst (MemCpyInst &I)
SizeOffsetType visitMemCpyInlineInst (MemCpyInlineInst &I)
SizeOffsetType visitMemMoveInst (MemMoveInst &I)
SizeOffsetType visitMemTransferInst (MemTransferInst &I)
SizeOffsetType visitMemIntrinsic (MemIntrinsic &I)
SizeOffsetType visitVAStartInst (VAStartInst &I)
SizeOffsetType visitVAEndInst (VAEndInst &I)
SizeOffsetType visitVACopyInst (VACopyInst &I)
SizeOffsetType visitIntrinsicInst (IntrinsicInst &I)
SizeOffsetType visitCallInst (CallInst &I)
SizeOffsetType visitInvokeInst (InvokeInst &I)
SizeOffsetType visitCallBrInst (CallBrInst &I)
SizeOffsetType visitReturnInst (ReturnInst &I)
SizeOffsetType visitBranchInst (BranchInst &I)
SizeOffsetType visitSwitchInst (SwitchInst &I)
SizeOffsetType visitIndirectBrInst (IndirectBrInst &I)
SizeOffsetType visitResumeInst (ResumeInst &I)
SizeOffsetType visitUnreachableInst (UnreachableInst &I)
SizeOffsetType visitCleanupReturnInst (CleanupReturnInst &I)
SizeOffsetType visitCatchReturnInst (CatchReturnInst &I)
SizeOffsetType visitCatchSwitchInst (CatchSwitchInst &I)
SizeOffsetType visitTerminator (Instruction &I)
SizeOffsetType visitCastInst (CastInst &I)
SizeOffsetType visitUnaryOperator (UnaryOperator &I)
SizeOffsetType visitBinaryOperator (BinaryOperator &I)
SizeOffsetType visitCmpInst (CmpInst &I)
SizeOffsetType visitUnaryInstruction (UnaryInstruction &I)
SizeOffsetType visitCallBase (CallBase &I)
void visitInstruction (Instruction &I)

Static Public Member Functions

static bool knownSize (const SizeOffsetType &SizeOffset)
static bool knownOffset (const SizeOffsetType &SizeOffset)
static bool bothKnown (const SizeOffsetType &SizeOffset)

Detailed Description

Evaluate the size and offset of an object pointed to by a Value* statically.

Fails if size or offset are not known at compile time.

Definition at line 194 of file MemoryBuiltins.h.

Constructor & Destructor Documentation

◆ ObjectSizeOffsetVisitor()

ObjectSizeOffsetVisitor::ObjectSizeOffsetVisitor ( const DataLayout DL,
const TargetLibraryInfo TLI,
LLVMContext Context,
ObjectSizeOpts  Options = {} 

Definition at line 691 of file MemoryBuiltins.cpp.

Member Function Documentation

◆ bothKnown()

static bool llvm::ObjectSizeOffsetVisitor::bothKnown ( const SizeOffsetType SizeOffset)

Definition at line 224 of file MemoryBuiltins.h.

References knownOffset(), and knownSize().

Referenced by llvm::getObjectSize(), and visitLoadInst().

◆ compute()

SizeOffsetType ObjectSizeOffsetVisitor::compute ( Value V)

Definition at line 700 of file MemoryBuiltins.cpp.

Referenced by llvm::getObjectSize().

◆ knownOffset()

static bool llvm::ObjectSizeOffsetVisitor::knownOffset ( const SizeOffsetType SizeOffset)

Definition at line 220 of file MemoryBuiltins.h.

Referenced by bothKnown().

◆ knownSize()

static bool llvm::ObjectSizeOffsetVisitor::knownSize ( const SizeOffsetType SizeOffset)

Definition at line 216 of file MemoryBuiltins.h.

Referenced by bothKnown().

◆ visitAllocaInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitAllocaInst ( AllocaInst I)

◆ visitArgument()

SizeOffsetType ObjectSizeOffsetVisitor::visitArgument ( Argument A)

◆ visitCallBase()

SizeOffsetType ObjectSizeOffsetVisitor::visitCallBase ( CallBase CB)

Definition at line 812 of file MemoryBuiltins.cpp.

References llvm::getAllocSize(), and Size.

◆ visitConstantPointerNull()

SizeOffsetType ObjectSizeOffsetVisitor::visitConstantPointerNull ( ConstantPointerNull CPN)

◆ visitExtractElementInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitExtractElementInst ( ExtractElementInst I)

Definition at line 833 of file MemoryBuiltins.cpp.

◆ visitExtractValueInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitExtractValueInst ( ExtractValueInst I)

Definition at line 838 of file MemoryBuiltins.cpp.

◆ visitGlobalAlias()

SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias ( GlobalAlias GA)

◆ visitGlobalVariable()

SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable ( GlobalVariable GV)

◆ visitInstruction()

SizeOffsetType ObjectSizeOffsetVisitor::visitInstruction ( Instruction I)

Definition at line 1029 of file MemoryBuiltins.cpp.

References llvm::dbgs(), I, and LLVM_DEBUG.

◆ visitIntToPtrInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitIntToPtrInst ( IntToPtrInst )

Definition at line 859 of file MemoryBuiltins.cpp.

◆ visitLoadInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitLoadInst ( LoadInst I)

◆ visitPHINode()

SizeOffsetType ObjectSizeOffsetVisitor::visitPHINode ( PHINode PN)

◆ visitSelectInst()

SizeOffsetType ObjectSizeOffsetVisitor::visitSelectInst ( SelectInst I)

Definition at line 1020 of file MemoryBuiltins.cpp.

References I.

◆ visitUndefValue()

SizeOffsetType ObjectSizeOffsetVisitor::visitUndefValue ( UndefValue )

Definition at line 1025 of file MemoryBuiltins.cpp.

The documentation for this class was generated from the following files: