LLVM  8.0.1
Classes | Macros | Enumerations | Functions | Variables
MemoryBuiltins.cpp File Reference
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/TargetFolder.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/Utils/Local.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <iterator>
#include <utility>
Include dependency graph for MemoryBuiltins.cpp:

Go to the source code of this file.

Classes

struct  AllocFnsTy
 

Macros

#define DEBUG_TYPE   "memory-builtins"
 

Enumerations

enum  AllocType : uint8_t {
  OpNewLike = 1<<0, MallocLike = 1<<1 | OpNewLike, CallocLike = 1<<2, ReallocLike = 1<<3,
  StrDupLike = 1<<4, MallocOrCallocLike = MallocLike | CallocLike, AllocLike = MallocLike | CallocLike | StrDupLike, AnyAlloc = AllocLike | ReallocLike
}
 

Functions

static const FunctiongetCalledFunction (const Value *V, bool LookThroughBitCast, bool &IsNoBuiltin)
 
static Optional< AllocFnsTygetAllocationDataForFunction (const Function *Callee, AllocType AllocTy, const TargetLibraryInfo *TLI)
 Returns the allocation data for the given value if it's either a call to a known allocation function, or a call to a function with the allocsize attribute. More...
 
static Optional< AllocFnsTygetAllocationData (const Value *V, AllocType AllocTy, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
 
static Optional< AllocFnsTygetAllocationSize (const Value *V, const TargetLibraryInfo *TLI)
 
static bool hasNoAliasAttr (const Value *V, bool LookThroughBitCast)
 
static ValuecomputeArraySize (const CallInst *CI, const DataLayout &DL, const TargetLibraryInfo *TLI, bool LookThroughSExt=false)
 
static APInt getSizeWithOverflow (const SizeOffsetType &Data)
 
 STATISTIC (ObjectVisitorArgument, "Number of arguments with unsolved size and offset")
 
 STATISTIC (ObjectVisitorLoad, "Number of load instructions with unsolved size and offset")
 

Variables

static const std::pair< LibFunc, AllocFnsTyAllocationFnData []
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "memory-builtins"

Definition at line 51 of file MemoryBuiltins.cpp.

Enumeration Type Documentation

◆ AllocType

enum AllocType : uint8_t
Enumerator
OpNewLike 
MallocLike 
CallocLike 
ReallocLike 
StrDupLike 
MallocOrCallocLike 
AllocLike 
AnyAlloc 

Definition at line 53 of file MemoryBuiltins.cpp.

Function Documentation

◆ computeArraySize()

static Value* computeArraySize ( const CallInst CI,
const DataLayout DL,
const TargetLibraryInfo TLI,
bool  LookThroughSExt = false 
)
static

◆ getAllocationData()

static Optional<AllocFnsTy> getAllocationData ( const Value V,
AllocType  AllocTy,
const TargetLibraryInfo TLI,
bool  LookThroughBitCast = false 
)
static

◆ getAllocationDataForFunction()

static Optional<AllocFnsTy> getAllocationDataForFunction ( const Function Callee,
AllocType  AllocTy,
const TargetLibraryInfo TLI 
)
static

◆ getAllocationSize()

static Optional<AllocFnsTy> getAllocationSize ( const Value V,
const TargetLibraryInfo TLI 
)
static

◆ getCalledFunction()

static const Function* getCalledFunction ( const Value V,
bool  LookThroughBitCast,
bool IsNoBuiltin 
)
static

◆ getSizeWithOverflow()

static APInt getSizeWithOverflow ( const SizeOffsetType Data)
static

◆ hasNoAliasAttr()

static bool hasNoAliasAttr ( const Value V,
bool  LookThroughBitCast 
)
static

◆ STATISTIC() [1/2]

STATISTIC ( ObjectVisitorArgument  ,
"Number of arguments with unsolved size and offset"   
)

◆ STATISTIC() [2/2]

STATISTIC ( ObjectVisitorLoad  ,
"Number of load instructions with unsolved size and offset"   
)

Variable Documentation

◆ AllocationFnData

const std::pair<LibFunc, AllocFnsTy> AllocationFnData[]
static

Definition at line 73 of file MemoryBuiltins.cpp.

Referenced by getAllocationDataForFunction().