diff options
author | Duncan Sands <baldrick@free.fr> | 2009-10-14 16:11:37 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-10-14 16:11:37 +0000 |
commit | 8e6ccb65df1c5b529c8664222c6a690321b139d3 (patch) | |
tree | 59072db60eb7a4921f7e6c551b9585246f60e1a7 /llvm/lib/VMCore/AutoUpgrade.cpp | |
parent | a44822fdb6456cdc3a496494807ce16160ebb69e (diff) | |
download | bcm5719-llvm-8e6ccb65df1c5b529c8664222c6a690321b139d3.tar.gz bcm5719-llvm-8e6ccb65df1c5b529c8664222c6a690321b139d3.zip |
I don't see any point in having both eh.selector.i32 and eh.selector.i64,
so get rid of eh.selector.i64 and rename eh.selector.i32 to eh.selector.
Likewise for eh.typeid.for. This aligns us with gcc, which always uses a
32 bit value for the selector on all platforms. My understanding is that
the register allocator used to assert if the selector intrinsic size didn't
match the pointer size, and this was the reason for introducing the two
variants. However my testing shows that this is no longer the case (I
fixed some bugs in selector lowering yesterday, and some more today in the
fastisel path; these might have caused the original problems).
llvm-svn: 84106
Diffstat (limited to 'llvm/lib/VMCore/AutoUpgrade.cpp')
-rw-r--r-- | llvm/lib/VMCore/AutoUpgrade.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/AutoUpgrade.cpp b/llvm/lib/VMCore/AutoUpgrade.cpp index f70075d9e60..77ab19f417c 100644 --- a/llvm/lib/VMCore/AutoUpgrade.cpp +++ b/llvm/lib/VMCore/AutoUpgrade.cpp @@ -120,6 +120,31 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { } break; + case 'e': + // The old llvm.eh.selector.i32 is equivalent to the new llvm.eh.selector. + if (Name.compare("llvm.eh.selector.i32") == 0) { + F->setName("llvm.eh.selector"); + NewFn = F; + return true; + } + // The old llvm.eh.typeid.for.i32 is equivalent to llvm.eh.typeid.for. + if (Name.compare("llvm.eh.typeid.for.i32") == 0) { + F->setName("llvm.eh.typeid.for"); + NewFn = F; + return true; + } + // Convert the old llvm.eh.selector.i64 to a call to llvm.eh.selector. + if (Name.compare("llvm.eh.selector.i64") == 0) { + NewFn = Intrinsic::getDeclaration(M, Intrinsic::eh_selector); + return true; + } + // Convert the old llvm.eh.typeid.for.i64 to a call to llvm.eh.typeid.for. + if (Name.compare("llvm.eh.typeid.for.i64") == 0) { + NewFn = Intrinsic::getDeclaration(M, Intrinsic::eh_typeid_for); + return true; + } + break; + case 'p': // This upgrades the llvm.part.select overloaded intrinsic names to only // use one type specifier in the name. We only care about the old format @@ -409,6 +434,27 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { CI->eraseFromParent(); } break; + case Intrinsic::eh_selector: + case Intrinsic::eh_typeid_for: { + // Only the return type changed. + SmallVector<Value*, 8> Operands(CI->op_begin() + 1, CI->op_end()); + CallInst *NewCI = CallInst::Create(NewFn, Operands.begin(), Operands.end(), + "upgraded." + CI->getName(), CI); + NewCI->setTailCall(CI->isTailCall()); + NewCI->setCallingConv(CI->getCallingConv()); + + // Handle any uses of the old CallInst. + if (!CI->use_empty()) { + // Construct an appropriate cast from the new return type to the old. + CastInst *RetCast = + CastInst::Create(CastInst::getCastOpcode(NewCI, true, + F->getReturnType(), true), + NewCI, F->getReturnType(), NewCI->getName(), CI); + CI->replaceAllUsesWith(RetCast); + } + CI->eraseFromParent(); + } + break; } } |