15 #ifndef LLVM_TRANSFORMS_UTILS_BUILDLIBCALLS_H 16 #define LLVM_TRANSFORMS_UTILS_BUILDLIBCALLS_H 24 class TargetLibraryInfo;
45 Value *
emitStrLen(Value *
Ptr, IRBuilder<> &
B,
const DataLayout &DL,
46 const TargetLibraryInfo *TLI);
52 const DataLayout &DL,
const TargetLibraryInfo *TLI);
58 const TargetLibraryInfo *TLI);
61 Value *
emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &
B,
62 const DataLayout &DL,
const TargetLibraryInfo *TLI);
66 Value *
emitStrCpy(Value *Dst, Value *Src, IRBuilder<> &
B,
67 const TargetLibraryInfo *TLI, StringRef
Name =
"strcpy");
71 Value *
emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &
B,
72 const TargetLibraryInfo *TLI, StringRef
Name =
"strncpy");
76 Value *
emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
77 IRBuilder<> &
B,
const DataLayout &DL,
78 const TargetLibraryInfo *TLI);
82 Value *
emitMemChr(Value *
Ptr, Value *Val, Value *Len, IRBuilder<> &
B,
83 const DataLayout &DL,
const TargetLibraryInfo *TLI);
86 Value *
emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &
B,
87 const DataLayout &DL,
const TargetLibraryInfo *TLI);
94 const AttributeList &
Attrs);
101 IRBuilder<> &
B,
const AttributeList &
Attrs);
104 Value *
emitPutChar(Value *
Char, IRBuilder<> &
B,
const TargetLibraryInfo *TLI);
107 Value *
emitPutS(Value *Str, IRBuilder<> &
B,
const TargetLibraryInfo *TLI);
112 const TargetLibraryInfo *TLI);
117 const TargetLibraryInfo *TLI);
122 const TargetLibraryInfo *TLI);
127 const TargetLibraryInfo *TLI);
132 const DataLayout &DL,
const TargetLibraryInfo *TLI);
135 Value *
emitMalloc(Value *Num, IRBuilder<> &
B,
const DataLayout &DL,
136 const TargetLibraryInfo *TLI);
140 IRBuilder<> &
B,
const TargetLibraryInfo &TLI);
145 IRBuilder<> &
B,
const DataLayout &DL,
146 const TargetLibraryInfo *TLI);
150 const TargetLibraryInfo *TLI);
155 const TargetLibraryInfo *TLI);
160 IRBuilder<> &
B,
const DataLayout &DL,
161 const TargetLibraryInfo *TLI);
Compute iterated dominance frontiers using a linear time algorithm.
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 * emitFPutSUnlocked(Value *Str, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputs_unlocked function.
Value * emitMalloc(Value *Num, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the malloc function.
Value * emitPutChar(Value *Char, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the putchar function. This assumes that Char is an integer.
Value * emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, const AttributeList &Attrs)
Emit a call to the unary function named 'Name' (e.g.
Value * emitFPutCUnlocked(Value *Char, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputc_unlocked function.
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.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
Value * emitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputs function.
bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI)
Analyze the name and prototype of the given function and set any applicable attributes.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
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 * emitFWriteUnlocked(Value *Ptr, Value *Size, Value *N, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fwrite_unlocked function.
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.
Value * emitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name, IRBuilder<> &B, const AttributeList &Attrs)
Emit a call to the binary function named 'Name' (e.g.
Value * emitFGetCUnlocked(Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fgetc_unlocked function. File is a pointer to FILE.
Value * emitFPutC(Value *Char, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputc function.
Value * emitFGetSUnlocked(Value *Str, Value *Size, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fgets_unlocked 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 * emitFReadUnlocked(Value *Ptr, Value *Size, Value *N, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fread_unlocked function.
Value * emitPutS(Value *Str, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the puts function. This assumes that Str is some pointer.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Value * emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the memchr function.
Value * emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs, IRBuilder<> &B, const TargetLibraryInfo &TLI)
Emit a call to the calloc function.
bool hasUnaryFloatFn(const TargetLibraryInfo *TLI, Type *Ty, LibFunc DoubleFn, LibFunc FloatFn, LibFunc LongDoubleFn)
Check whether the overloaded unary floating point function corresponding to Ty is available...