summaryrefslogtreecommitdiff
path: root/lib/VMCore/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-11-27 08:42:07 +0000
committerChris Lattner <sabre@nondot.org>2011-11-27 08:42:07 +0000
commitb5dd9de7240f3018dcd8ce84c158547a5e0f1131 (patch)
treed537d0f5cf866e93514d96ec91525b06334c45f9 /lib/VMCore/AutoUpgrade.cpp
parent5a1731daa75ab4c52718d155e47fd2e3e8f5e74c (diff)
downloadllvm-b5dd9de7240f3018dcd8ce84c158547a5e0f1131.tar.gz
llvm-b5dd9de7240f3018dcd8ce84c158547a5e0f1131.tar.bz2
llvm-b5dd9de7240f3018dcd8ce84c158547a5e0f1131.tar.xz
Eli managed to kill off llvm.membarrier in llvm 3.0 also, this means
that mainline needs no autoupgrade logic for intrinsics yet, woohoo! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145178 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AutoUpgrade.cpp')
-rw-r--r--lib/VMCore/AutoUpgrade.cpp42
1 files changed, 8 insertions, 34 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 76eda7501e..373524cdf3 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -37,13 +37,10 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
if (Name.size() <= 8 || !Name.startswith("llvm."))
return false;
Name = Name.substr(5); // Strip off "llvm."
-
+
switch (Name[0]) {
default: break;
- case 'm':
- if (Name == "memory.barrier")
- return true;
- break;
+ // SOMEDAY: Add some.
}
// This may not belong here. This function is effectively being overloaded
@@ -75,38 +72,15 @@ bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
// order to seamlessly integrate with existing context.
void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
Function *F = CI->getCalledFunction();
- LLVMContext &C = CI->getContext();
- ImmutableCallSite CS(CI);
assert(F && "CallInst has no function associated with it.");
- if (!NewFn) {
- if (F->getName() == "llvm.memory.barrier") {
- IRBuilder<> Builder(C);
- Builder.SetInsertPoint(CI->getParent(), CI);
-
- // Note that this conversion ignores the "device" bit; it was not really
- // well-defined, and got abused because nobody paid enough attention to
- // get it right. In practice, this probably doesn't matter; application
- // code generally doesn't need anything stronger than
- // SequentiallyConsistent (and realistically, SequentiallyConsistent
- // is lowered to a strong enough barrier for almost anything).
-
- if (cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue())
- Builder.CreateFence(SequentiallyConsistent);
- else if (!cast<ConstantInt>(CI->getArgOperand(0))->getZExtValue())
- Builder.CreateFence(Release);
- else if (!cast<ConstantInt>(CI->getArgOperand(3))->getZExtValue())
- Builder.CreateFence(Acquire);
- else
- Builder.CreateFence(AcquireRelease);
-
- // Remove intrinsic.
- CI->eraseFromParent();
- } else {
- llvm_unreachable("Unknown function for CallInst upgrade.");
- }
- return;
+ if (NewFn) return;
+
+ if (F->getName() == "llvm.something eventually") {
+ // UPGRADE HERE.
+ } else {
+ llvm_unreachable("Unknown function for CallInst upgrade.");
}
}