1515#define LLVM_TRANSFORMS_UTILS_BUILDLIBCALLS_H
1616
1717#include " llvm/Analysis/TargetLibraryInfo.h"
18- #include " llvm/IR/IRBuilder.h"
1918
2019namespace llvm {
2120 class Value ;
2221 class DataLayout ;
2322 class TargetLibraryInfo ;
23+ class IRBuilderBase ;
2424
2525 // / Analyze the name and prototype of the given function and set any
2626 // / applicable attributes.
@@ -42,197 +42,198 @@ namespace llvm {
4242 LibFunc LongDoubleFn);
4343
4444 // / Return V if it is an i8*, otherwise cast it to i8*.
45- Value *castToCStr (Value *V, IRBuilder<> &B);
45+ Value *castToCStr (Value *V, IRBuilderBase &B);
4646
4747 // / Emit a call to the strlen function to the builder, for the specified
4848 // / pointer. Ptr is required to be some pointer type, and the return value has
4949 // / 'intptr_t' type.
50- Value *emitStrLen (Value *Ptr, IRBuilder<> &B, const DataLayout &DL,
50+ Value *emitStrLen (Value *Ptr, IRBuilderBase &B, const DataLayout &DL,
5151 const TargetLibraryInfo *TLI);
5252
5353 // / Emit a call to the strdup function to the builder, for the specified
5454 // / pointer. Ptr is required to be some pointer type, and the return value has
5555 // / 'i8*' type.
56- Value *emitStrDup (Value *Ptr, IRBuilder<> &B, const TargetLibraryInfo *TLI);
56+ Value *emitStrDup (Value *Ptr, IRBuilderBase &B, const TargetLibraryInfo *TLI);
5757
5858 // / Emit a call to the strnlen function to the builder, for the specified
5959 // / pointer. Ptr is required to be some pointer type, MaxLen must be of size_t
6060 // / type, and the return value has 'intptr_t' type.
61- Value *emitStrNLen (Value *Ptr, Value *MaxLen, IRBuilder<> &B,
61+ Value *emitStrNLen (Value *Ptr, Value *MaxLen, IRBuilderBase &B,
6262 const DataLayout &DL, const TargetLibraryInfo *TLI);
6363
6464 // / Emit a call to the strchr function to the builder, for the specified
6565 // / pointer and character. Ptr is required to be some pointer type, and the
6666 // / return value has 'i8*' type.
67- Value *emitStrChr (Value *Ptr, char C, IRBuilder<> &B,
67+ Value *emitStrChr (Value *Ptr, char C, IRBuilderBase &B,
6868 const TargetLibraryInfo *TLI);
6969
7070 // / Emit a call to the strncmp function to the builder.
71- Value *emitStrNCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
71+ Value *emitStrNCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B,
7272 const DataLayout &DL, const TargetLibraryInfo *TLI);
7373
7474 // / Emit a call to the strcpy function to the builder, for the specified
7575 // / pointer arguments.
76- Value *emitStrCpy (Value *Dst, Value *Src, IRBuilder<> &B,
76+ Value *emitStrCpy (Value *Dst, Value *Src, IRBuilderBase &B,
7777 const TargetLibraryInfo *TLI);
7878
7979 // / Emit a call to the stpcpy function to the builder, for the specified
8080 // / pointer arguments.
81- Value *emitStpCpy (Value *Dst, Value *Src, IRBuilder<> &B,
81+ Value *emitStpCpy (Value *Dst, Value *Src, IRBuilderBase &B,
8282 const TargetLibraryInfo *TLI);
8383
8484 // / Emit a call to the strncpy function to the builder, for the specified
8585 // / pointer arguments and length.
86- Value *emitStrNCpy (Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
86+ Value *emitStrNCpy (Value *Dst, Value *Src, Value *Len, IRBuilderBase &B,
8787 const TargetLibraryInfo *TLI);
8888
8989 // / Emit a call to the stpncpy function to the builder, for the specified
9090 // / pointer arguments and length.
91- Value *emitStpNCpy (Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
91+ Value *emitStpNCpy (Value *Dst, Value *Src, Value *Len, IRBuilderBase &B,
9292 const TargetLibraryInfo *TLI);
9393
9494 // / Emit a call to the __memcpy_chk function to the builder. This expects that
9595 // / the Len and ObjSize have type 'intptr_t' and Dst/Src are pointers.
9696 Value *emitMemCpyChk (Value *Dst, Value *Src, Value *Len, Value *ObjSize,
97- IRBuilder<> &B, const DataLayout &DL,
97+ IRBuilderBase &B, const DataLayout &DL,
9898 const TargetLibraryInfo *TLI);
9999
100100 // / Emit a call to the memchr function. This assumes that Ptr is a pointer,
101101 // / Val is an i32 value, and Len is an 'intptr_t' value.
102- Value *emitMemChr (Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
102+ Value *emitMemChr (Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B,
103103 const DataLayout &DL, const TargetLibraryInfo *TLI);
104104
105105 // / Emit a call to the memcmp function.
106- Value *emitMemCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
106+ Value *emitMemCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B,
107107 const DataLayout &DL, const TargetLibraryInfo *TLI);
108108
109109 // / Emit a call to the bcmp function.
110- Value *emitBCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
110+ Value *emitBCmp (Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B,
111111 const DataLayout &DL, const TargetLibraryInfo *TLI);
112112
113113 // / Emit a call to the memccpy function.
114114 Value *emitMemCCpy (Value *Ptr1, Value *Ptr2, Value *Val, Value *Len,
115- IRBuilder<> &B, const TargetLibraryInfo *TLI);
115+ IRBuilderBase &B, const TargetLibraryInfo *TLI);
116116
117117 // / Emit a call to the snprintf function.
118118 Value *emitSNPrintf (Value *Dest, Value *Size, Value *Fmt,
119- ArrayRef<Value *> Args, IRBuilder<> &B,
119+ ArrayRef<Value *> Args, IRBuilderBase &B,
120120 const TargetLibraryInfo *TLI);
121121
122122 // / Emit a call to the sprintf function.
123123 Value *emitSPrintf (Value *Dest, Value *Fmt, ArrayRef<Value *> VariadicArgs,
124- IRBuilder<> &B, const TargetLibraryInfo *TLI);
124+ IRBuilderBase &B, const TargetLibraryInfo *TLI);
125125
126126 // / Emit a call to the strcat function.
127- Value *emitStrCat (Value *Dest, Value *Src, IRBuilder<> &B,
127+ Value *emitStrCat (Value *Dest, Value *Src, IRBuilderBase &B,
128128 const TargetLibraryInfo *TLI);
129129
130130 // / Emit a call to the strlcpy function.
131- Value *emitStrLCpy (Value *Dest, Value *Src, Value *Size, IRBuilder<> &B,
131+ Value *emitStrLCpy (Value *Dest, Value *Src, Value *Size, IRBuilderBase &B,
132132 const TargetLibraryInfo *TLI);
133133
134134 // / Emit a call to the strlcat function.
135- Value *emitStrLCat (Value *Dest, Value *Src, Value *Size, IRBuilder<> &B,
135+ Value *emitStrLCat (Value *Dest, Value *Src, Value *Size, IRBuilderBase &B,
136136 const TargetLibraryInfo *TLI);
137137
138138 // / Emit a call to the strncat function.
139- Value *emitStrNCat (Value *Dest, Value *Src, Value *Size, IRBuilder<> &B,
139+ Value *emitStrNCat (Value *Dest, Value *Src, Value *Size, IRBuilderBase &B,
140140 const TargetLibraryInfo *TLI);
141141
142142 // / Emit a call to the vsnprintf function.
143143 Value *emitVSNPrintf (Value *Dest, Value *Size, Value *Fmt, Value *VAList,
144- IRBuilder<> &B, const TargetLibraryInfo *TLI);
144+ IRBuilderBase &B, const TargetLibraryInfo *TLI);
145145
146146 // / Emit a call to the vsprintf function.
147- Value *emitVSPrintf (Value *Dest, Value *Fmt, Value *VAList, IRBuilder<> &B,
147+ Value *emitVSPrintf (Value *Dest, Value *Fmt, Value *VAList, IRBuilderBase &B,
148148 const TargetLibraryInfo *TLI);
149149
150150 // / Emit a call to the unary function named 'Name' (e.g. 'floor'). This
151151 // / function is known to take a single of type matching 'Op' and returns one
152152 // / value with the same type. If 'Op' is a long double, 'l' is added as the
153153 // / suffix of name, if 'Op' is a float, we add a 'f' suffix.
154- Value *emitUnaryFloatFnCall (Value *Op, StringRef Name, IRBuilder<> &B,
154+ Value *emitUnaryFloatFnCall (Value *Op, StringRef Name, IRBuilderBase &B,
155155 const AttributeList &Attrs);
156156
157157 // / Emit a call to the unary function DoubleFn, FloatFn or LongDoubleFn,
158158 // / depending of the type of Op.
159159 Value *emitUnaryFloatFnCall (Value *Op, const TargetLibraryInfo *TLI,
160160 LibFunc DoubleFn, LibFunc FloatFn,
161- LibFunc LongDoubleFn, IRBuilder<> &B,
161+ LibFunc LongDoubleFn, IRBuilderBase &B,
162162 const AttributeList &Attrs);
163163
164164 // / Emit a call to the binary function named 'Name' (e.g. 'fmin'). This
165165 // / function is known to take type matching 'Op1' and 'Op2' and return one
166166 // / value with the same type. If 'Op1/Op2' are long double, 'l' is added as
167167 // / the suffix of name, if 'Op1/Op2' are float, we add a 'f' suffix.
168168 Value *emitBinaryFloatFnCall (Value *Op1, Value *Op2, StringRef Name,
169- IRBuilder<> &B, const AttributeList &Attrs);
169+ IRBuilderBase &B, const AttributeList &Attrs);
170170
171171 // / Emit a call to the binary function DoubleFn, FloatFn or LongDoubleFn,
172172 // / depending of the type of Op1.
173173 Value *emitBinaryFloatFnCall (Value *Op1, Value *Op2,
174174 const TargetLibraryInfo *TLI, LibFunc DoubleFn,
175175 LibFunc FloatFn, LibFunc LongDoubleFn,
176- IRBuilder<> &B, const AttributeList &Attrs);
176+ IRBuilderBase &B, const AttributeList &Attrs);
177177
178178 // / Emit a call to the putchar function. This assumes that Char is an integer.
179- Value *emitPutChar (Value *Char, IRBuilder<> &B, const TargetLibraryInfo *TLI);
179+ Value *emitPutChar (Value *Char, IRBuilderBase &B,
180+ const TargetLibraryInfo *TLI);
180181
181182 // / Emit a call to the puts function. This assumes that Str is some pointer.
182- Value *emitPutS (Value *Str, IRBuilder<> &B, const TargetLibraryInfo *TLI);
183+ Value *emitPutS (Value *Str, IRBuilderBase &B, const TargetLibraryInfo *TLI);
183184
184185 // / Emit a call to the fputc function. This assumes that Char is an i32, and
185186 // / File is a pointer to FILE.
186- Value *emitFPutC (Value *Char, Value *File, IRBuilder<> &B,
187+ Value *emitFPutC (Value *Char, Value *File, IRBuilderBase &B,
187188 const TargetLibraryInfo *TLI);
188189
189190 // / Emit a call to the fputc_unlocked function. This assumes that Char is an
190191 // / i32, and File is a pointer to FILE.
191- Value *emitFPutCUnlocked (Value *Char, Value *File, IRBuilder<> &B,
192+ Value *emitFPutCUnlocked (Value *Char, Value *File, IRBuilderBase &B,
192193 const TargetLibraryInfo *TLI);
193194
194195 // / Emit a call to the fputs function. Str is required to be a pointer and
195196 // / File is a pointer to FILE.
196- Value *emitFPutS (Value *Str, Value *File, IRBuilder<> &B,
197+ Value *emitFPutS (Value *Str, Value *File, IRBuilderBase &B,
197198 const TargetLibraryInfo *TLI);
198199
199200 // / Emit a call to the fputs_unlocked function. Str is required to be a
200201 // / pointer and File is a pointer to FILE.
201- Value *emitFPutSUnlocked (Value *Str, Value *File, IRBuilder<> &B,
202+ Value *emitFPutSUnlocked (Value *Str, Value *File, IRBuilderBase &B,
202203 const TargetLibraryInfo *TLI);
203204
204205 // / Emit a call to the fwrite function. This assumes that Ptr is a pointer,
205206 // / Size is an 'intptr_t', and File is a pointer to FILE.
206- Value *emitFWrite (Value *Ptr, Value *Size, Value *File, IRBuilder<> &B,
207+ Value *emitFWrite (Value *Ptr, Value *Size, Value *File, IRBuilderBase &B,
207208 const DataLayout &DL, const TargetLibraryInfo *TLI);
208209
209210 // / Emit a call to the malloc function.
210- Value *emitMalloc (Value *Num, IRBuilder<> &B, const DataLayout &DL,
211+ Value *emitMalloc (Value *Num, IRBuilderBase &B, const DataLayout &DL,
211212 const TargetLibraryInfo *TLI);
212213
213214 // / Emit a call to the calloc function.
214215 Value *emitCalloc (Value *Num, Value *Size, const AttributeList &Attrs,
215- IRBuilder<> &B, const TargetLibraryInfo &TLI);
216+ IRBuilderBase &B, const TargetLibraryInfo &TLI);
216217
217218 // / Emit a call to the fwrite_unlocked function. This assumes that Ptr is a
218219 // / pointer, Size is an 'intptr_t', N is nmemb and File is a pointer to FILE.
219220 Value *emitFWriteUnlocked (Value *Ptr, Value *Size, Value *N, Value *File,
220- IRBuilder<> &B, const DataLayout &DL,
221+ IRBuilderBase &B, const DataLayout &DL,
221222 const TargetLibraryInfo *TLI);
222223
223224 // / Emit a call to the fgetc_unlocked function. File is a pointer to FILE.
224- Value *emitFGetCUnlocked (Value *File, IRBuilder<> &B,
225+ Value *emitFGetCUnlocked (Value *File, IRBuilderBase &B,
225226 const TargetLibraryInfo *TLI);
226227
227228 // / Emit a call to the fgets_unlocked function. Str is required to be a
228229 // / pointer, Size is an i32 and File is a pointer to FILE.
229- Value *emitFGetSUnlocked (Value *Str, Value *Size, Value *File, IRBuilder<> &B,
230- const TargetLibraryInfo *TLI);
230+ Value *emitFGetSUnlocked (Value *Str, Value *Size, Value *File,
231+ IRBuilderBase &B, const TargetLibraryInfo *TLI);
231232
232233 // / Emit a call to the fread_unlocked function. This assumes that Ptr is a
233234 // / pointer, Size is an 'intptr_t', N is nmemb and File is a pointer to FILE.
234235 Value *emitFReadUnlocked (Value *Ptr, Value *Size, Value *N, Value *File,
235- IRBuilder<> &B, const DataLayout &DL,
236+ IRBuilderBase &B, const DataLayout &DL,
236237 const TargetLibraryInfo *TLI);
237238}
238239
0 commit comments