diff options
author | Dale Johannesen <dalej@apple.com> | 2009-10-09 21:42:02 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-10-09 21:42:02 +0000 |
commit | 96a5b87ae21c9692432863ca574ecbd0fb204c7f (patch) | |
tree | 447bc4c2a297f7434897cf22ec7706ee88381844 /llvm/lib/Transforms/Utils/InlineCost.cpp | |
parent | 9f3059a192ca29fd460df71ddbedc69242b88e61 (diff) | |
download | bcm5719-llvm-96a5b87ae21c9692432863ca574ecbd0fb204c7f.tar.gz bcm5719-llvm-96a5b87ae21c9692432863ca574ecbd0fb204c7f.zip |
Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially
those used in more than one file). No functional change.
llvm-svn: 83675
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineCost.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineCost.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineCost.cpp b/llvm/lib/Transforms/Utils/InlineCost.cpp index df03b378f07..496f2e445e9 100644 --- a/llvm/lib/Transforms/Utils/InlineCost.cpp +++ b/llvm/lib/Transforms/Utils/InlineCost.cpp @@ -132,12 +132,12 @@ void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) { // Calls often compile into many machine instructions. Bump up their // cost to reflect this. if (!isa<IntrinsicInst>(II)) - NumInsts += 5; + NumInsts += InlineConstants::CallPenalty; } // These, too, are calls. if (isa<MallocInst>(II) || isa<FreeInst>(II)) - NumInsts += 5; + NumInsts += InlineConstants::CallPenalty; if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) { if (!AI->isStaticAlloca()) @@ -212,21 +212,21 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, // make it almost guaranteed to be inlined. // if (Callee->hasLocalLinkage() && Callee->hasOneUse()) - InlineCost -= 15000; + InlineCost += InlineConstants::LastCallToStaticBonus; // If this function uses the coldcc calling convention, prefer not to inline // it. if (Callee->getCallingConv() == CallingConv::Cold) - InlineCost += 2000; + InlineCost += InlineConstants::ColdccPenalty; // If the instruction after the call, or if the normal destination of the // invoke is an unreachable instruction, the function is noreturn. As such, // there is little point in inlining this. if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) { if (isa<UnreachableInst>(II->getNormalDest()->begin())) - InlineCost += 10000; + InlineCost += InlineConstants::NoreturnPenalty; } else if (isa<UnreachableInst>(++BasicBlock::iterator(TheCall))) - InlineCost += 10000; + InlineCost += InlineConstants::NoreturnPenalty; // Get information about the callee... FunctionInfo &CalleeFI = CachedFunctionInfo[Callee]; |