[llvm-commits] [llvm] r74143 - in /llvm/trunk: include/llvm/CodeGen/IntrinsicLowering.h lib/CodeGen/IntrinsicLowering.cpp

Chris Lattner clattner at apple.com
Wed Jun 24 17:56:57 PDT 2009


On Jun 24, 2009, at 5:04 PM, Owen Anderson wrote:

> Author: resistor
> Date: Wed Jun 24 19:04:15 2009
> New Revision: 74143
>
> URL: http://llvm.org/viewvc/llvm-project?rev=74143&view=rev
> Log:
> Now with EVEN FEWER statics!

How about just not caching them?  This was important when we had "type  
planes", but now a lookup in the module symbol table is "fast enough"  
that we don't need a cache.

-Chris

>
>
> Modified:
>    llvm/trunk/include/llvm/CodeGen/IntrinsicLowering.h
>    llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/IntrinsicLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/IntrinsicLowering.h?rev=74143&r1=74142&r2=74143&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/include/llvm/CodeGen/IntrinsicLowering.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/IntrinsicLowering.h Wed Jun 24  
> 19:04:15 2009
> @@ -25,8 +25,45 @@
>
>   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
>
> Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=74143&r1=74142&r2=74143&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original)
> +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Wed Jun 24 19:04:15  
> 2009
> @@ -668,7 +668,6 @@
>     // 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 @@
>      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 @@
>
>   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 @@
>
>   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 @@
>     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 @@
>     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 @@
>     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 @@
>     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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list