44 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
73 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
102 AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
110 I8Ptr, I8Ptr, I32Ty, NULL);
130 AS[2] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
161 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
166 I8Ptr, I8Ptr, I8Ptr, NULL);
185 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
211 AS = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
240 AS = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
270 AS[2] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
349 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
358 if (
const Function *
F = dyn_cast<Function>(PutS->stripPointerCasts()))
373 AS[1] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
391 if (
const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
407 AS[2] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
440 AS[2] = AttributeSet::get(M->
getContext(), AttributeSet::FunctionIndex,
472 if (!TD)
return false;
481 if (Name ==
"__memcpy_chk") {
500 if (Name ==
"__mempcpy_chk") {
504 if (Name ==
"__memmove_chk") {
522 if (Name ==
"__memset_chk") {
541 if (Name ==
"__strcpy_chk" || Name ==
"__stpcpy_chk") {
567 if (Name ==
"__strncpy_chk" || Name ==
"__stpncpy_chk") {
588 if (Name ==
"__strcat_chk") {
592 if (Name ==
"__strncat_chk") {
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
The main container class for the LLVM Intermediate Representation.
unsigned getNumParams() const
StringRef substr(size_t Start, size_t N=npos) const
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
Value * EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
const Function * getParent() const
Return the enclosing method, or null if none.
size_t strnlen(const char *s, size_t maxlen);
Value * EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
StringRef getName() const
void setCallingConv(CallingConv::ID CC)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
CallInst * CreateMemMove(Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0)
Create and insert a memmove between the specified pointers.
bool has(LibFunc::Func F) const
Value * EmitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, const AttributeSet &Attrs)
bool fold(CallInst *CI, const DataLayout *TD, const TargetLibraryInfo *TLI)
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
virtual bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp, bool isString) const =0
char *strchr(const char *s, int c);
Function creates no aliases of pointer.
Value * EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
static StrNCmpOpt StrNCmp
virtual ~SimplifyFortifiedLibCalls()
CallInst * CreateCall4(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, Value *Arg4, const Twine &Name="")
Value * EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI, StringRef Name="strncpy")
int memcmp(const void *s1, const void *s2, size_t n);
virtual void replaceCall(Value *With)=0
Type * getParamType(unsigned i) const
Parameter type accessors.
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
LLVM Constant Representation.
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
Value * EmitPutChar(Value *Char, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
void *memchr(const void *s, int c, size_t n);
Value * EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
Function doesn't unwind stack.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
Value * EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
int fputs(const char *s, FILE *stream);
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Value * EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI, StringRef Name="strcpy")
void *__memcpy_chk(void *s1, const void *s2, size_t n, size_t s1size);
Value * CastToCStr(Value *V, IRBuilder<> &B)
CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
BasicBlock * GetInsertBlock() const
Value * stripPointerCasts()
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
Function * getCalledFunction() const
size_t strlen(const char *s);
Value * getArgOperand(unsigned i) const
Function only reads from memory.
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
int fputc(int c, FILE *stream);
StringRef getName(LibFunc::Func F) const
FunctionType * getFunctionType() const
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0)
Create and insert a memset to the specified pointer and the specified value.
static StrNCpyOpt StrNCpy
CallInst * CreateCall2(Value *Callee, Value *Arg1, Value *Arg2, const Twine &Name="")
void setAttributes(const AttributeSet &Attrs)
Type * getReturnType() const
LLVMContext & getContext() const
Get the context in which this basic block lives.
Value * EmitPutS(Value *Str, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
LLVM Value Representation.
CallInst * CreateCall(Value *Callee, const Twine &Name="")
char *strcpy(char *s1, const char *s2);
Value * EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
int strncmp(const char *s1, const char *s2, size_t n);
Value * EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
EmitMemCmp - Emit a call to the memcmp function.
Value * EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
EmitStrNCmp - Emit a call to the strncmp function to the builder.
const BasicBlock * getParent() const
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
Value * EmitFPutC(Value *Char, Value *File, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
CallInst * CreateMemCpy(Value *Dst, Value *Src, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=0, MDNode *TBAAStructTag=0)
Create and insert a memcpy between the specified pointers.
LLVMContext & getContext() const
CallInst * CreateCall3(Value *Callee, Value *Arg1, Value *Arg2, Value *Arg3, const Twine &Name="")
char *strncpy(char *s1, const char *s2, size_t n);