LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Enumerations | Functions | Variables
MemoryBuiltins.cpp File Reference
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
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 {
  OpNewLike = 1<<0, MallocLike = 1<<1 | OpNewLike, CallocLike = 1<<2, ReallocLike = 1<<3,
  StrDupLike = 1<<4, AllocLike = MallocLike | CallocLike | StrDupLike, AnyAlloc = AllocLike | ReallocLike
}
 

Functions

static FunctiongetCalledFunction (const Value *V, bool LookThroughBitCast)
 
static const AllocFnsTygetAllocationData (const Value *V, AllocType AllocTy, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
 Returns the allocation data for the given value if it is a call to a known allocation function, and NULL otherwise. More...
 
static bool hasNoAliasAttr (const Value *V, bool LookThroughBitCast)
 
static ValuecomputeArraySize (const CallInst *CI, const DataLayout *DL, const TargetLibraryInfo *TLI, bool LookThroughSExt=false)
 
 STATISTIC (ObjectVisitorArgument,"Number of arguments with unsolved size and offset")
 
 STATISTIC (ObjectVisitorLoad,"Number of load instructions with unsolved size and offset")
 

Variables

static const AllocFnsTy AllocationFnData []
 

Macro Definition Documentation

#define DEBUG_TYPE   "memory-builtins"

Definition at line 15 of file MemoryBuiltins.cpp.

Enumeration Type Documentation

enum AllocType
Enumerator
OpNewLike 
MallocLike 
CallocLike 
ReallocLike 
StrDupLike 
AllocLike 
AnyAlloc 

Definition at line 33 of file MemoryBuiltins.cpp.

Function Documentation

static Value* computeArraySize ( const CallInst CI,
const DataLayout DL,
const TargetLibraryInfo TLI,
bool  LookThroughSExt = false 
)
static
static const AllocFnsTy* getAllocationData ( const Value V,
AllocType  AllocTy,
const TargetLibraryInfo TLI,
bool  LookThroughBitCast = false 
)
static
static Function* getCalledFunction ( const Value V,
bool  LookThroughBitCast 
)
static
static bool hasNoAliasAttr ( const Value V,
bool  LookThroughBitCast 
)
static
STATISTIC ( ObjectVisitorArgument  ,
"Number of arguments with unsolved size and offset"   
)
STATISTIC ( ObjectVisitorLoad  ,
"Number of load instructions with unsolved size and offset"   
)

Variable Documentation

const AllocFnsTy AllocationFnData[]
static
Initial value:
= {
{LibFunc::Znwj, OpNewLike, 1, 0, -1},
{LibFunc::Znwm, OpNewLike, 1, 0, -1},
{LibFunc::Znaj, OpNewLike, 1, 0, -1},
{LibFunc::Znam, OpNewLike, 1, 0, -1},
{LibFunc::strdup, StrDupLike, 1, -1, -1},
}
void *new(unsigned int);
void *reallocf(void *ptr, size_t size);
void *new(unsigned int, nothrow);
char *strndup(const char *s1, size_t n);
void *new[](unsigned int);
void *new(unsigned long);
void *realloc(void *ptr, size_t size);
void *valloc(size_t size);
void *new[](unsigned int, nothrow);
void *new[](unsigned long);
void *new[](unsigned long, nothrow);
char *strdup(const char *s1);
void *malloc(size_t size);
void *new(unsigned long, nothrow);
void *calloc(size_t count, size_t size);

Definition at line 53 of file MemoryBuiltins.cpp.

Referenced by getAllocationData().