class IntrinsicLowering {
const TargetData& TD;
+
+ Constant *SetjmpFCache;
+ Constant *LongjmpFCache;
+ Constant *AbortFCache;
+ Constant *MemcpyFCache;
+ Constant *MemmoveFCache;
+ Constant *MemsetFCache;
+ Constant *sqrtFCache;
+ Constant *sqrtDCache;
+ Constant *sqrtLDCache;
+ Constant *logFCache;
+ Constant *logDCache;
+ Constant *logLDCache;
+ Constant *log2FCache;
+ Constant *log2DCache;
+ Constant *log2LDCache;
+ Constant *log10FCache;
+ Constant *log10DCache;
+ Constant *log10LDCache;
+ Constant *expFCache;
+ Constant *expDCache;
+ Constant *expLDCache;
+ Constant *exp2FCache;
+ Constant *exp2DCache;
+ Constant *exp2LDCache;
+ Constant *powFCache;
+ Constant *powDCache;
+ Constant *powLDCache;
+
+ bool Warned;
public:
- explicit IntrinsicLowering(const TargetData &td) : TD(td) {}
+ explicit IntrinsicLowering(const TargetData &td) :
+ TD(td), SetjmpFCache(0), LongjmpFCache(0), AbortFCache(0),
+ MemcpyFCache(0), MemmoveFCache(0), MemsetFCache(0), sqrtFCache(0),
+ sqrtDCache(0), sqrtLDCache(0), logFCache(0), logDCache(0), logLDCache(0),
+ log2FCache(0), log2DCache(0), log2LDCache(0), log10FCache(0),
+ log10DCache(0), log10LDCache(0), expFCache(0), expDCache(0),
+ expLDCache(0), exp2FCache(0), exp2DCache(0), exp2LDCache(0), powFCache(0),
+ powDCache(0), powLDCache(0), Warned(false) {}
/// AddPrototypes - This method, if called, causes all of the prototypes
/// that might be needed by an intrinsic lowering implementation to be
// by the lowerinvoke pass. In both cases, the right thing to do is to
// convert the call to an explicit setjmp or longjmp call.
case Intrinsic::setjmp: {
- static Constant *SetjmpFCache = 0;
Value *V = ReplaceCallWith("setjmp", CI, CI->op_begin() + 1, CI->op_end(),
Type::Int32Ty, SetjmpFCache);
if (CI->getType() != Type::VoidTy)
break;
case Intrinsic::longjmp: {
- static Constant *LongjmpFCache = 0;
ReplaceCallWith("longjmp", CI, CI->op_begin() + 1, CI->op_end(),
Type::VoidTy, LongjmpFCache);
break;
case Intrinsic::siglongjmp: {
// Insert the call to abort
- static Constant *AbortFCache = 0;
ReplaceCallWith("abort", CI, CI->op_end(), CI->op_end(),
Type::VoidTy, AbortFCache);
break;
case Intrinsic::stacksave:
case Intrinsic::stackrestore: {
- static bool Warned = false;
if (!Warned)
cerr << "WARNING: this target does not support the llvm.stack"
<< (Callee->getIntrinsicID() == Intrinsic::stacksave ?
break; // Strip out annotate intrinsic
case Intrinsic::memcpy: {
- static Constant *MemcpyFCache = 0;
const IntegerType *IntPtr = TD.getIntPtrType();
Value *Size = Builder.CreateIntCast(CI->getOperand(3), IntPtr,
/* isSigned */ false);
break;
}
case Intrinsic::memmove: {
- static Constant *MemmoveFCache = 0;
const IntegerType *IntPtr = TD.getIntPtrType();
Value *Size = Builder.CreateIntCast(CI->getOperand(3), IntPtr,
/* isSigned */ false);
break;
}
case Intrinsic::memset: {
- static Constant *MemsetFCache = 0;
const IntegerType *IntPtr = TD.getIntPtrType();
Value *Size = Builder.CreateIntCast(CI->getOperand(3), IntPtr,
/* isSigned */ false);
break;
}
case Intrinsic::sqrt: {
- static Constant *sqrtFCache = 0;
- static Constant *sqrtDCache = 0;
- static Constant *sqrtLDCache = 0;
ReplaceFPIntrinsicWithCall(CI, sqrtFCache, sqrtDCache, sqrtLDCache,
"sqrtf", "sqrt", "sqrtl");
break;
}
case Intrinsic::log: {
- static Constant *logFCache = 0;
- static Constant *logDCache = 0;
- static Constant *logLDCache = 0;
ReplaceFPIntrinsicWithCall(CI, logFCache, logDCache, logLDCache,
"logf", "log", "logl");
break;
}
case Intrinsic::log2: {
- static Constant *log2FCache = 0;
- static Constant *log2DCache = 0;
- static Constant *log2LDCache = 0;
ReplaceFPIntrinsicWithCall(CI, log2FCache, log2DCache, log2LDCache,
"log2f", "log2", "log2l");
break;
}
case Intrinsic::log10: {
- static Constant *log10FCache = 0;
- static Constant *log10DCache = 0;
- static Constant *log10LDCache = 0;
ReplaceFPIntrinsicWithCall(CI, log10FCache, log10DCache, log10LDCache,
"log10f", "log10", "log10l");
break;
}
case Intrinsic::exp: {
- static Constant *expFCache = 0;
- static Constant *expDCache = 0;
- static Constant *expLDCache = 0;
ReplaceFPIntrinsicWithCall(CI, expFCache, expDCache, expLDCache,
"expf", "exp", "expl");
break;
}
case Intrinsic::exp2: {
- static Constant *exp2FCache = 0;
- static Constant *exp2DCache = 0;
- static Constant *exp2LDCache = 0;
ReplaceFPIntrinsicWithCall(CI, exp2FCache, exp2DCache, exp2LDCache,
"exp2f", "exp2", "exp2l");
break;
}
case Intrinsic::pow: {
- static Constant *powFCache = 0;
- static Constant *powDCache = 0;
- static Constant *powLDCache = 0;
ReplaceFPIntrinsicWithCall(CI, powFCache, powDCache, powLDCache,
"powf", "pow", "powl");
break;