diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-09 15:52:43 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-09 15:52:43 +0000 |
commit | 30759542aa820b9fc74c77bfa3c011cb0a106ef9 (patch) | |
tree | 9698461a0cd7c16beea9446415a512f3e3bcde0e /lib/VMCore/AutoUpgrade.cpp | |
parent | 80fa4723b9b7cb9d78d71648095e4e2804681402 (diff) |
change the objectsize intrinsic signature: add a 3rd parameter to denote the maximum runtime performance penalty that the user is willing to accept.
This commit only adds the parameter. Code taking advantage of it will follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AutoUpgrade.cpp')
-rw-r--r-- | lib/VMCore/AutoUpgrade.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp index 522b07e454..1b259d7f07 100644 --- a/lib/VMCore/AutoUpgrade.cpp +++ b/lib/VMCore/AutoUpgrade.cpp @@ -52,6 +52,20 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { } break; } + case 'o': { + // FIXME: remove in LLVM 3.3 + if (Name.startswith("objectsize.") && F->arg_size() == 2) { + Type *Tys[] = {F->getReturnType(), + F->arg_begin()->getType(), + Type::getInt1Ty(F->getContext()), + Type::getInt32Ty(F->getContext())}; + NewFn = Intrinsic::getDeclaration(F->getParent(), Intrinsic::objectsize, + Tys); + NewFn->takeName(F); + return true; + } + break; + } case 'x': { if (Name.startswith("x86.sse2.pcmpeq.") || Name.startswith("x86.sse2.pcmpgt.") || @@ -195,7 +209,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { llvm_unreachable("Unknown function for CallInst upgrade."); case Intrinsic::ctlz: - case Intrinsic::cttz: + case Intrinsic::cttz: { assert(CI->getNumArgOperands() == 1 && "Mismatch between function args and call args"); StringRef Name = CI->getName(); @@ -205,6 +219,16 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { CI->eraseFromParent(); return; } + case Intrinsic::objectsize: { + StringRef Name = CI->getName(); + CI->setName(Name + ".old"); + CI->replaceAllUsesWith(Builder.CreateCall3(NewFn, CI->getArgOperand(0), + CI->getArgOperand(1), + Builder.getInt32(0), Name)); + CI->eraseFromParent(); + return; + } + } } // This tests each Function to determine if it needs upgrading. When we find |