diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-25 00:04:15 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-25 00:04:15 +0000 |
commit | 6279cd85e9e59c93d43877bf2cf7d116e51ce021 (patch) | |
tree | 35879cb1f9610b9b1c29f211ad6c56f10ce51c78 | |
parent | a09b9ca10fbec13e4ad47d8108e9c6f9a1b53451 (diff) |
Now with EVEN FEWER statics!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74143 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/IntrinsicLowering.h | 39 | ||||
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 28 |
2 files changed, 38 insertions, 29 deletions
diff --git a/include/llvm/CodeGen/IntrinsicLowering.h b/include/llvm/CodeGen/IntrinsicLowering.h index 6628329895..c28083a59f 100644 --- a/include/llvm/CodeGen/IntrinsicLowering.h +++ b/include/llvm/CodeGen/IntrinsicLowering.h @@ -25,8 +25,45 @@ namespace llvm { 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 diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index e6912b82c3..c92cd3a76e 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -668,7 +668,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { // 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) @@ -681,7 +680,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { break; case Intrinsic::longjmp: { - static Constant *LongjmpFCache = 0; ReplaceCallWith("longjmp", CI, CI->op_begin() + 1, CI->op_end(), Type::VoidTy, LongjmpFCache); break; @@ -689,7 +687,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { 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; @@ -728,7 +725,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { 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 ? @@ -783,7 +779,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { 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); @@ -796,7 +791,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { break; } case Intrinsic::memmove: { - static Constant *MemmoveFCache = 0; const IntegerType *IntPtr = TD.getIntPtrType(); Value *Size = Builder.CreateIntCast(CI->getOperand(3), IntPtr, /* isSigned */ false); @@ -809,7 +803,6 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { break; } case Intrinsic::memset: { - static Constant *MemsetFCache = 0; const IntegerType *IntPtr = TD.getIntPtrType(); Value *Size = Builder.CreateIntCast(CI->getOperand(3), IntPtr, /* isSigned */ false); @@ -824,57 +817,36 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { 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; |