From 6279cd85e9e59c93d43877bf2cf7d116e51ce021 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 25 Jun 2009 00:04:15 +0000 Subject: [PATCH] Now with EVEN FEWER statics! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74143 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/IntrinsicLowering.h | 39 +++++++++++++++++++++++- 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 6628329895f..c28083a59f3 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 e6912b82c38..c92cd3a76ef 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;