43 class LibCallOptimization {
51 LibCallOptimization() { }
52 virtual ~LibCallOptimization() {}
64 virtual bool ignoreCallingConv() {
return false; }
90 static bool isOnlyUsedInZeroEqualityComparison(
Value *V) {
93 if (
ICmpInst *IC = dyn_cast<ICmpInst>(*UI))
95 if (
Constant *
C = dyn_cast<Constant>(IC->getOperand(1)))
106 static bool isOnlyUsedInEqualityComparison(
Value *V,
Value *With) {
109 if (
ICmpInst *IC = dyn_cast<ICmpInst>(*UI))
110 if (IC->isEquality() && IC->getOperand(1) == With)
118 static bool callHasFloatingPointArgument(
const CallInst *CI) {
121 if ((*it)->getType()->isFloatingPointTy())
134 return TLI->
has(FloatFn);
136 return TLI->
has(DoubleFn);
138 return TLI->
has(LongDoubleFn);
146 struct FortifiedLibCallOptimization :
public LibCallOptimization {
148 virtual bool isFoldable(
unsigned SizeCIOp,
unsigned SizeArgOp,
149 bool isString)
const = 0;
152 struct InstFortifiedLibCallOptimization :
public FortifiedLibCallOptimization {
155 bool isFoldable(
unsigned SizeCIOp,
unsigned SizeArgOp,
bool isString)
const {
160 if (SizeCI->isAllOnesValue())
166 if (Len == 0)
return false;
167 return SizeCI->getZExtValue() >= Len;
171 return SizeCI->getZExtValue() >= Arg->getZExtValue();
177 struct MemCpyChkOpt :
public InstFortifiedLibCallOptimization {
191 if (isFoldable(3, 2,
false)) {
200 struct MemMoveChkOpt :
public InstFortifiedLibCallOptimization {
214 if (isFoldable(3, 2,
false)) {
223 struct MemSetChkOpt :
public InstFortifiedLibCallOptimization {
237 if (isFoldable(3, 2,
false)) {
247 struct StrCpyChkOpt :
public InstFortifiedLibCallOptimization {
271 if (isFoldable(2, 1,
true)) {
277 if (Len == 0)
return 0;
292 struct StpCpyChkOpt :
public InstFortifiedLibCallOptimization {
318 if (isFoldable(2, 1,
true)) {
324 if (Len == 0)
return 0;
342 struct StrNCpyChkOpt :
public InstFortifiedLibCallOptimization {
357 if (isFoldable(3, 2,
false)) {
371 struct StrCatOpt :
public LibCallOptimization {
387 if (Len == 0)
return 0;
397 return emitStrLenMemCpy(Src, Dst, Len, B);
421 struct StrNCatOpt :
public StrCatOpt {
439 Len = LengthArg->getZExtValue();
445 if (SrcLen == 0)
return 0;
451 if (SrcLen == 0 || Len == 0)
return Dst;
457 if (Len < SrcLen)
return 0;
461 return emitStrLenMemCpy(Src, Dst, SrcLen, B);
465 struct StrChrOpt :
public LibCallOptimization {
511 struct StrRChrOpt :
public LibCallOptimization {
531 if (TD && CharC->
isZero())
547 struct StrCmpOpt :
public LibCallOptimization {
566 if (HasStr1 && HasStr2)
569 if (HasStr1 && Str1.empty())
573 if (HasStr2 && Str2.empty())
585 std::min(Len1, Len2)), B, TD, TLI);
592 struct StrNCmpOpt :
public LibCallOptimization {
610 Length = LengthArg->getZExtValue();
617 if (TD && Length == 1)
625 if (HasStr1 && HasStr2) {
631 if (HasStr1 && Str1.empty())
635 if (HasStr2 && Str2.empty())
642 struct StrCpyOpt :
public LibCallOptimization {
661 if (Len == 0)
return 0;
671 struct StpCpyOpt:
public LibCallOptimization {
692 if (Len == 0)
return 0;
707 struct StrNCpyOpt :
public LibCallOptimization {
722 if (SrcLen == 0)
return 0;
732 if (
ConstantInt *LengthArg = dyn_cast<ConstantInt>(LenOp))
733 Len = LengthArg->getZExtValue();
737 if (Len == 0)
return Dst;
743 if (Len > SrcLen+1)
return 0;
754 struct StrLenOpt :
public LibCallOptimization {
755 virtual bool ignoreCallingConv() {
return true; }
771 if (isOnlyUsedInZeroEqualityComparison(CI))
777 struct StrPBrkOpt :
public LibCallOptimization {
792 if ((HasS1 && S1.
empty()) || (HasS2 && S2.
empty()))
796 if (HasS1 && HasS2) {
805 if (TD && HasS2 && S2.
size() == 1)
812 struct StrToOpt :
public LibCallOptimization {
821 if (isa<ConstantPointerNull>(EndPtr)) {
831 struct StrSpnOpt :
public LibCallOptimization {
846 if ((HasS1 && S1.
empty()) || (HasS2 && S2.
empty()))
850 if (HasS1 && HasS2) {
860 struct StrCSpnOpt :
public LibCallOptimization {
874 if (HasS1 && S1.
empty())
878 if (HasS1 && HasS2) {
885 if (TD && HasS2 && S2.
empty())
892 struct StrStrOpt :
public LibCallOptimization {
906 if (TD && isOnlyUsedInEqualityComparison(CI, CI->
getArgOperand(0))) {
916 ICmpInst *Old = cast<ICmpInst>(*UI++);
931 if (HasStr2 && ToFindStr.
empty())
935 if (HasStr1 && HasStr2) {
936 size_t Offset = SearchStr.
find(ToFindStr);
943 Result = B.CreateConstInBoundsGEP1_64(Result, Offset,
"strstr");
944 return B.CreateBitCast(Result, CI->
getType());
948 if (HasStr2 && ToFindStr.
size() == 1) {
950 return StrChr ? B.CreateBitCast(StrChr, CI->
getType()) : 0;
956 struct MemCmpOpt :
public LibCallOptimization {
983 return B.
CreateSub(LHSV, RHSV,
"chardiff");
991 if (Len > LHSStr.
size() || Len > RHSStr.
size())
1008 struct MemCpyOpt :
public LibCallOptimization {
1027 struct MemMoveOpt :
public LibCallOptimization {
1046 struct MemSetOpt :
public LibCallOptimization {
1072 struct UnaryDoubleFPOpt :
public LibCallOptimization {
1074 UnaryDoubleFPOpt(
bool CheckReturnType): CheckRetType(CheckReturnType) {}
1103 struct UnsafeFPLibCallOptimization :
public LibCallOptimization {
1110 struct CosOpt :
public UnsafeFPLibCallOptimization {
1111 CosOpt(
bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
1137 struct PowOpt :
public UnsafeFPLibCallOptimization {
1138 PowOpt(
bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
1156 if (
ConstantFP *Op1C = dyn_cast<ConstantFP>(Op1)) {
1158 if (Op1C->isExactlyValue(1.0))
1161 if (Op1C->isExactlyValue(2.0) &&
1168 if (Op2C == 0)
return Ret;
1205 struct Exp2Opt :
public UnsafeFPLibCallOptimization {
1206 Exp2Opt(
bool UnsafeFPShrink) : UnsafeFPLibCallOptimization(UnsafeFPShrink) {}
1210 TLI->
has(LibFunc::exp2f)) {
1225 Value *LdExpArg = 0;
1226 if (
SIToFPInst *OpC = dyn_cast<SIToFPInst>(Op)) {
1227 if (OpC->getOperand(0)->getType()->getPrimitiveSizeInBits() <= 32)
1229 }
else if (
UIToFPInst *OpC = dyn_cast<UIToFPInst>(Op)) {
1230 if (OpC->getOperand(0)->getType()->getPrimitiveSizeInBits() < 32)
1247 Module *M = Caller->getParent();
1261 struct SinCosPiOpt :
public LibCallOptimization {
1267 if (!isTrigLibCall(CI))
1282 classifyArgUse(*UI, CI->
getParent(), IsFloat, SinCalls, CosCalls,
1286 if (SinCosCalls.
empty() && (SinCalls.empty() || CosCalls.empty()))
1289 Value *Sin, *Cos, *SinCos;
1293 replaceTrigInsts(SinCalls, Sin);
1294 replaceTrigInsts(CosCalls, Cos);
1295 replaceTrigInsts(SinCosCalls, SinCos);
1366 Name =
"__sincospi_stretf";
1368 assert(
T.getArch() !=
Triple::x86 &&
"x86 messy and unsupported for now");
1375 Name =
"__sincospi_stret";
1381 ResTy, ArgTy, NULL);
1383 if (
Instruction *ArgInst = dyn_cast<Instruction>(Arg)) {
1395 SinCos = B.
CreateCall(Callee, Arg,
"sincospi");
1414 struct FFSOpt :
public LibCallOptimization {
1427 if (
ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
1431 return B.
getInt32(CI->getValue().countTrailingZeros() + 1);
1447 struct AbsOpt :
public LibCallOptimization {
1448 virtual bool ignoreCallingConv() {
return true; }
1465 struct IsDigitOpt :
public LibCallOptimization {
1481 struct IsAsciiOpt :
public LibCallOptimization {
1496 struct ToAsciiOpt :
public LibCallOptimization {
1514 struct ErrorReportingOpt :
public LibCallOptimization {
1515 ErrorReportingOpt(
int S = -1) : StreamArg(S) {}
1556 return GV->
getName() ==
"stderr";
1562 struct PrintFOpt :
public LibCallOptimization {
1571 if (FormatStr.
empty())
1582 if (FormatStr.
size() == 1) {
1584 if (CI->
use_empty() || !Res)
return Res;
1589 if (FormatStr[FormatStr.
size()-1] ==
'\n' &&
1607 if (CI->
use_empty() || !Res)
return Res;
1627 if (
Value *V = optimizeFixedFormatString(Callee, CI, B)) {
1646 struct SPrintFOpt :
public LibCallOptimization {
1658 for (
unsigned i = 0, e = FormatStr.
size(); i != e; ++i)
1659 if (FormatStr[i] ==
'%')
1668 FormatStr.
size() + 1), 1);
1674 if (FormatStr.
size() != 2 || FormatStr[0] !=
'%' ||
1679 if (FormatStr[1] ==
'c') {
1691 if (FormatStr[1] ==
's') {
1720 if (
Value *V = OptimizeFixedFormatString(Callee, CI, B)) {
1739 struct FPrintFOpt :
public LibCallOptimization {
1742 ErrorReportingOpt ER( 0);
1743 (void) ER.callOptimizer(Callee, CI, B);
1758 for (
unsigned i = 0, e = FormatStr.
size(); i != e; ++i)
1759 if (FormatStr[i] ==
'%')
1773 if (FormatStr.
size() != 2 || FormatStr[0] !=
'%' ||
1778 if (FormatStr[1] ==
'c') {
1784 if (FormatStr[1] ==
's') {
1801 if (
Value *V = optimizeFixedFormatString(Callee, CI, B)) {
1820 struct FWriteOpt :
public LibCallOptimization {
1822 ErrorReportingOpt ER( 3);
1823 (void) ER.callOptimizer(Callee, CI, B);
1837 if (!SizeC || !CountC)
return 0;
1838 uint64_t Bytes = SizeC->
getZExtValue()*CountC->getZExtValue();
1856 struct FPutsOpt :
public LibCallOptimization {
1858 ErrorReportingOpt ER( 1);
1859 (void) ER.callOptimizer(Callee, CI, B);
1881 struct PutsOpt :
public LibCallOptimization {
1898 if (CI->
use_empty() || !Res)
return Res;
1914 bool UnsafeFPShrink;
1923 bool UnsafeFPShrink =
false)
1924 : Cos(UnsafeFPShrink), Pow(UnsafeFPShrink), Exp2(UnsafeFPShrink) {
1928 this->UnsafeFPShrink = UnsafeFPShrink;
1939 FloatFuncName +=
'f';
1941 return TLI->
has(Func);
2006 switch (II->getIntrinsicID()) {
2078 case LibFunc::exp2f:
2156 if (FuncName ==
"__memmove_chk")
2158 else if (FuncName ==
"__memset_chk")
2160 else if (FuncName ==
"__strcpy_chk")
2162 else if (FuncName ==
"__stpcpy_chk")
2164 else if (FuncName ==
"__strncpy_chk")
2166 else if (FuncName ==
"__stpncpy_chk")
2178 return LCO->optimizeCall(CI, TD, TLI, LCS, Builder);
static StrNCpyChkOpt StrNCpyChk
Value * CreateGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
int strcmp(const char *s1, const char *s2);
void push_back(const T &Elt)
virtual ~LibCallSimplifier()
static StrCSpnOpt StrCSpn
int sprintf(char *str, const char *format, ...);
uint64_t GetStringLength(Value *V)
LoadInst * CreateLoad(Value *Ptr, const char *Name)
LLVMContext & getContext() const
void *memcpy(void *s1, const void *s2, size_t n);
size_t size() const
size - Get the string size.
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
char *strpbrk(const char *s1, const char *s2);
The main container class for the LLVM Intermediate Representation.
unsigned getNumParams() const
2: 32-bit floating point type
int printf(const char *format, ...);
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
LibCallSimplifierImpl(const DataLayout *TD, const TargetLibraryInfo *TLI, const LibCallSimplifier *LCS, bool UnsafeFPShrink=false)
long int strtol(const char *nptr, char **endptr, int base);
size_t find(char C, size_t From=0) const
bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
float strtof(const char *nptr, char **endptr);
size_t rfind(char C, size_t From=npos) 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.
double __sinpi(double x);
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
const Function * getParent() const
Return the enclosing method, or null if none.
double nearbyint(double x);
char *strcat(char *s1, const char *s2);
static cl::opt< bool > ColdErrorCalls("error-reporting-is-cold", cl::init(true), cl::Hidden, cl::desc("Treat error-reporting calls as cold"))
StringRef drop_back(size_t N=1) const
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
const std::string & getTargetTriple() const
static ErrorReportingOpt ErrorReporting0(0)
static UnaryDoubleFPOpt UnsafeUnaryDoubleFP(true)
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LoopInfoBase< BlockT, LoopT > * LI
double strtod(const char *nptr, char **endptr);
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Value * EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
static Constant * getNullValue(Type *Ty)
StringRef getName() const
void setCallingConv(CallingConv::ID CC)
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
int compare(StringRef RHS) const
Value * CreateFMul(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=0)
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.
long double fabsl(long double x);
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
long double cosl(long double x);
static IsAsciiOpt IsAscii
bool getLibFunc(StringRef funcName, LibFunc::Func &F) const
double __sincospi_stret(double x);
bool has(LibFunc::Func F) const
Value * EmitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, const AttributeSet &Attrs)
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="")
unsigned getNumArgOperands() const
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
static MemCpyChkOpt MemCpyChk
char *strchr(const char *s, int c);
Instruction * clone() const
Value * CreateICmpSGT(Value *LHS, Value *RHS, const Twine &Name="")
Function does not access memory.
Function creates no aliases of pointer.
uint64_t getZExtValue() const
Return the zero extended value.
static MemMoveOpt MemMove
static FPrintFOpt FPrintF
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
static StrNCatOpt StrNCat
static StrRChrOpt StrRChr
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool hasFnAttr(Attribute::AttrKind A) const
Determine whether this call has the given attribute.
const char * data() const
static MemMoveChkOpt MemMoveChk
long long int strtoll(const char *nptr, char **endptr, int base);
static cl::opt< std::string > FuncName("cppfname", cl::desc("Specify the name of the generated function"), cl::value_desc("function name"))
Value * EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
static StrNCmpOpt StrNCmp
bool isFloatingPointTy() const
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
static UnaryDoubleFPOpt UnaryDoubleFP(false)
void replaceAllUsesWith(Value *V)
static StrCpyChkOpt StrCpyChk
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
static ToAsciiOpt ToAscii
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
void addAttribute(unsigned i, Attribute::AttrKind attr)
addAttribute - adds the attribute to the list of attributes.
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);
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
Type * getParamType(unsigned i) const
Parameter type accessors.
initializer< Ty > init(const Ty &Val)
char *strrchr(const char *s, int c);
int vfprintf(FILE *stream, const char *format, va_list ap);
static MemSetChkOpt MemSetChk
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeSet AttributeList)
LLVM Basic Block Representation.
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
LLVM Constant Representation.
static cl::opt< bool > UnsafeFPShrink("enable-double-float-shrink", cl::Hidden, cl::init(false), cl::desc("Enable unsafe double to float ""shrinking for math lib calls"))
LibCallOptimization * lookupOptimization(CallInst *CI)
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
long double strtold(const char *nptr, char **endptr);
static SPrintFOpt SPrintF
Represent an integer comparison operator.
float __sincospi_stretf(float x);
double pow(double x, double y);
Value * EmitPutChar(Value *Char, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
Value * getOperand(unsigned i) const
Value * getPointerOperand()
void perror(const char *s);
Value * EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
Function doesn't unwind stack.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
Predicate getPredicate() const
Return the predicate for this instruction.
void *memmove(void *s1, const void *s2, size_t n);
Marks function as being in a cold path.
LibCallSimplifier(const DataLayout *TD, const TargetLibraryInfo *TLI, bool UnsafeFPShrink)
static Constant * getAllOnesValue(Type *Ty)
Get the all ones value.
Value * CreateInBoundsGEP(Value *Ptr, ArrayRef< Value * > IdxList, const Twine &Name="")
static Constant * getFPExtend(Constant *C, Type *Ty)
size_t find_first_not_of(char C, size_t From=0) const
static SinCosPiOpt SinCosPi
char *strstr(const char *s1, const char *s2);
PointerType * getInt8PtrTy(unsigned AddrSpace=0)
Fetch the type representing a pointer to an 8-bit integer value.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
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")
char *strncat(char *s1, const char *s2, size_t n);
void *__memcpy_chk(void *s1, const void *s2, size_t n, size_t s1size);
int fiprintf(FILE *stream, const char *format, ...);
Class for constant integers.
Value * CastToCStr(Value *V, IRBuilder<> &B)
CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
Value * optimizeCall(CallInst *CI)
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
int fprintf(FILE *stream, const char *format, ...);
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
size_t strcspn(const char *s1, const char *s2);
unsigned long int strtoul(const char *nptr, char **endptr, int base);
static StrPBrkOpt StrPBrk
long int labs(long int j);
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
BasicBlock * GetInsertBlock() const
Value * stripPointerCasts()
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value...
void *memset(void *b, int c, size_t len);
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
Function * getCalledFunction() const
const BasicBlock & getEntryBlock() const
static Constant * get(Type *Ty, double V)
size_t strlen(const char *s);
static ErrorReportingOpt ErrorReporting1(1)
char *stpcpy(char *s1, const char *s2);
int ffsll(long long int i);
AttributeSet getAttributes() const
Return the attribute list for this Function.
Value * getArgOperand(unsigned i) const
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="")
float powf(float x, float y);
Value * CreateFDiv(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=0)
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);
ConstantInt * getFalse()
Get the constant value for i1 false.
double __cospi(double x);
void setCalledFunction(Value *Fn)
setCalledFunction - Set the function called.
bool isDeclaration() const
static ErrorReportingOpt ErrorReporting
virtual void replaceAllUsesWith(Instruction *I, Value *With) const
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
FunctionType * getFunctionType() const
This class represents a cast unsigned integer to floating point.
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.
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
size_t find_first_of(char C, size_t From=0) const
long long int llabs(long long int j);
static IsDigitOpt IsDigit
static StrNCpyOpt StrNCpy
const APFloat & getValueAPF() const
bool getConstantStringInfo(const Value *V, StringRef &Str, uint64_t Offset=0, bool TrimAtNul=true)
Value * optimizeCall(CallInst *CI)
bool isExactlyValue(const APFloat &V) const
3: 64-bit floating point type
This class represents a cast from signed integer to floating point.
CallInst * CreateCall2(Value *Callee, Value *Arg1, Value *Arg2, const Twine &Name="")
Type * getReturnType() const
LLVMContext & getContext() const
Get the context in which this basic block lives.
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
This class represents a truncation of floating point types.
Value * EmitPutS(Value *Str, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
LLVM Value Representation.
bool isZero() const
Returns true if and only if the float is plus or minus zero.
CallInst * CreateCall(Value *Callee, const Twine &Name="")
static VectorType * get(Type *ElementType, unsigned NumElements)
long double exp2l(long double x);
char *strcpy(char *s1, const char *s2);
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
Value * EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
Value * CreateGlobalString(StringRef Str, const Twine &Name="")
Make a new global variable with initializer type i8*.
CallingConv::ID getCallingConv() const
int siprintf(char *str, const char *format, ...);
int strncmp(const char *s1, const char *s2, size_t n);
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
This class represents an extension of floating point types.
static StpCpyChkOpt StpCpyChk
int64_t getSExtValue() const
Return the sign extended value.
long double powl(long double x, long double y);
Value * EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout *TD, const TargetLibraryInfo *TLI)
EmitMemCmp - Emit a call to the memcmp function.
int iprintf(const char *format, ...);
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)
size_t strspn(const char *s1, const char *s2);
static ConstantFP * getInfinity(Type *Ty, bool Negative=false)
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.
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
long double sqrtl(long double x);
bool empty() const
empty - Check if the string is empty.
bool hasFloatVersion(StringRef FuncName)
const Use * const_op_iterator
char *strncpy(char *s1, const char *s2, size_t n);