15 #ifndef LLVM_TRANSFORMS_UTILS_BUILDLIBCALLS_H
16 #define LLVM_TRANSFORMS_UTILS_BUILDLIBCALLS_H
23 class TargetLibraryInfo;
38 Value *
emitStrLen(Value *
Ptr, IRBuilder<> &
B,
const DataLayout &DL,
39 const TargetLibraryInfo *TLI);
45 const DataLayout &DL,
const TargetLibraryInfo *TLI);
51 const TargetLibraryInfo *TLI);
54 Value *
emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &
B,
55 const DataLayout &DL,
const TargetLibraryInfo *TLI);
59 Value *
emitStrCpy(Value *Dst, Value *Src, IRBuilder<> &
B,
60 const TargetLibraryInfo *TLI, StringRef
Name =
"strcpy");
64 Value *
emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &
B,
65 const TargetLibraryInfo *TLI, StringRef
Name =
"strncpy");
69 Value *
emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
70 IRBuilder<> &
B,
const DataLayout &DL,
71 const TargetLibraryInfo *TLI);
75 Value *
emitMemChr(Value *
Ptr, Value *Val, Value *Len, IRBuilder<> &
B,
76 const DataLayout &DL,
const TargetLibraryInfo *TLI);
79 Value *
emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &
B,
80 const DataLayout &DL,
const TargetLibraryInfo *TLI);
87 const AttributeSet &Attrs);
94 IRBuilder<> &
B,
const AttributeSet &Attrs);
97 Value *
emitPutChar(Value *Char, IRBuilder<> &
B,
const TargetLibraryInfo *TLI);
100 Value *
emitPutS(Value *Str, IRBuilder<> &
B,
const TargetLibraryInfo *TLI);
105 const TargetLibraryInfo *TLI);
110 const TargetLibraryInfo *TLI);
115 const DataLayout &DL,
const TargetLibraryInfo *TLI);
Value * emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, const AttributeSet &Attrs)
Emit a call to the unary function named 'Name' (e.g.
Value * emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B, const TargetLibraryInfo *TLI, StringRef Name="strncpy")
Emit a call to the strncpy function to the builder, for the specified pointer arguments and length...
Value * emitPutChar(Value *Char, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the putchar function. This assumes that Char is an integer.
Value * emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the __memcpy_chk function to the builder.
Value * emitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B, const TargetLibraryInfo *TLI, StringRef Name="strcpy")
Emit a call to the strcpy function to the builder, for the specified pointer arguments.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
Value * emitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the puts function.
bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI)
Analyze the name and prototype of the given function and set any applicable attributes.
Value * castToCStr(Value *V, IRBuilder<> &B)
Return V if it is an i8*, otherwise cast it to i8*.
Value * emitStrChr(Value *Ptr, char C, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the strchr function to the builder, for the specified pointer and character.
Value * emitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the strlen function to the builder, for the specified pointer.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Value * emitFPutC(Value *Char, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputc function.
Value * emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the strncmp function to the builder.
Value * emitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the strnlen function to the builder, for the specified pointer.
Value * emitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fwrite function.
Value * emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the memcmp function.
Value * emitPutS(Value *Str, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the puts function. This assumes that Str is some pointer.
Value * emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the memchr function.
Value * emitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name, IRBuilder<> &B, const AttributeSet &Attrs)
Emit a call to the binary function named 'Name' (e.g.