LLVM API Documentation
#include "llvm/Transforms/Scalar.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionTracker.h"
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include <list>
Go to the source code of this file.
Defines | |
#define | DEBUG_TYPE "memcpyopt" |
Functions | |
STATISTIC (NumMemCpyInstr,"Number of memcpy instructions deleted") | |
STATISTIC (NumMemSetInfer,"Number of memsets inferred") | |
STATISTIC (NumMoveToCpy,"Number of memmoves converted to memcpy") | |
STATISTIC (NumCpyToSet,"Number of memcpys converted to memset") | |
static int64_t | GetOffsetFromIndex (const GEPOperator *GEP, unsigned Idx, bool &VariableIdxFound, const DataLayout &TD) |
static bool | IsPointerOffset (Value *Ptr1, Value *Ptr2, int64_t &Offset, const DataLayout &TD) |
INITIALIZE_PASS_BEGIN (MemCpyOpt,"memcpyopt","MemCpy Optimization", false, false) INITIALIZE_PASS_END(MemCpyOpt | |
Variables | |
memcpyopt | |
MemCpy | Optimization |
MemCpy | false |
#define DEBUG_TYPE "memcpyopt" |
Definition at line 36 of file MemCpyOptimizer.cpp.
static int64_t GetOffsetFromIndex | ( | const GEPOperator * | GEP, |
unsigned | Idx, | ||
bool & | VariableIdxFound, | ||
const DataLayout & | TD | ||
) | [static] |
Definition at line 43 of file MemCpyOptimizer.cpp.
References llvm::dyn_cast(), llvm::gep_type_begin(), llvm::StructLayout::getElementOffset(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::ConstantInt::getSExtValue(), llvm::DataLayout::getStructLayout(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), and llvm::ConstantInt::isZero().
Referenced by IsPointerOffset().
INITIALIZE_PASS_BEGIN | ( | MemCpyOpt | , |
"memcpyopt" | , | ||
"MemCpy Optimization" | , | ||
false | , | ||
false | |||
) |
static bool IsPointerOffset | ( | Value * | Ptr1, |
Value * | Ptr2, | ||
int64_t & | Offset, | ||
const DataLayout & | TD | ||
) | [static] |
IsPointerOffset - Return true if Ptr1 is provably equal to Ptr2 plus a constant offset, and return that constant offset. For example, Ptr1 might be &A[42], and Ptr2 might be &A[40]. In this case offset would be -8.
Definition at line 76 of file MemCpyOptimizer.cpp.
References llvm::dyn_cast(), llvm::User::getNumOperands(), GetOffsetFromIndex(), llvm::User::getOperand(), and llvm::Value::stripPointerCasts().
STATISTIC | ( | NumMemCpyInstr | , |
"Number of memcpy instructions deleted" | |||
) |
STATISTIC | ( | NumMemSetInfer | , |
"Number of memsets inferred" | |||
) |
STATISTIC | ( | NumMoveToCpy | , |
"Number of memmoves converted to memcpy" | |||
) |
STATISTIC | ( | NumCpyToSet | , |
"Number of memcpys converted to memset" | |||
) |
MemCpy false |
Definition at line 371 of file MemCpyOptimizer.cpp.
Definition at line 371 of file MemCpyOptimizer.cpp.
MemCpy Optimization |
Definition at line 371 of file MemCpyOptimizer.cpp.