summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerInvoke.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2007-02-22 16:21:18 +0000
committerJim Laskey <jlaskey@mac.com>2007-02-22 16:21:18 +0000
commit7d4853896c98b8eb3d7eb4a6fea38a4dd3e0bcf3 (patch)
tree86385cf484c42a9daaff21e2b6203482d36bf9a2 /lib/Transforms/Utils/LowerInvoke.cpp
parentf9b1cbc80d89b9a03d73b8b3c1703b344e1d9b70 (diff)
downloadllvm-7d4853896c98b8eb3d7eb4a6fea38a4dd3e0bcf3.tar.gz
llvm-7d4853896c98b8eb3d7eb4a6fea38a4dd3e0bcf3.tar.bz2
llvm-7d4853896c98b8eb3d7eb4a6fea38a4dd3e0bcf3.tar.xz
Revert changes for a simplier solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerInvoke.cpp')
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp86
1 files changed, 36 insertions, 50 deletions
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index a611e89654..e1712bce43 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -57,9 +57,6 @@ STATISTIC(NumSpilled, "Number of registers live across unwind edges");
static cl::opt<bool> ExpensiveEHSupport("enable-correct-eh-support",
cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code"));
-
-static cl::opt<bool> ItaniumEHSupport("enable-real-eh-support",
- cl::desc("Make the -lowerinvoke pass insert itanium ABI EH code"));
namespace {
class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass {
@@ -97,7 +94,6 @@ namespace {
void splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes);
void rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
AllocaInst *InvokeNum, SwitchInst *CatchSwitch);
- bool insertItaniumEHSupport(Function &F);
bool insertExpensiveEHSupport(Function &F);
};
@@ -115,50 +111,46 @@ FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI) {
// doInitialization - Make sure that there is a prototype for abort in the
// current module.
bool LowerInvoke::doInitialization(Module &M) {
- if (ItaniumEHSupport) {
- // Let Invoke pass through for ItaniumEHSupport support.
- } else {
- const Type *VoidPtrTy = PointerType::get(Type::Int8Ty);
- AbortMessage = 0;
- if (ExpensiveEHSupport) {
- // Insert a type for the linked list of jump buffers.
- unsigned JBSize = TLI ? TLI->getJumpBufSize() : 0;
- JBSize = JBSize ? JBSize : 200;
- const Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize);
-
- { // The type is recursive, so use a type holder.
- std::vector<const Type*> Elements;
- Elements.push_back(JmpBufTy);
- OpaqueType *OT = OpaqueType::get();
- Elements.push_back(PointerType::get(OT));
- PATypeHolder JBLType(StructType::get(Elements));
- OT->refineAbstractTypeTo(JBLType.get()); // Complete the cycle.
- JBLinkTy = JBLType.get();
- M.addTypeName("llvm.sjljeh.jmpbufty", JBLinkTy);
- }
+ const Type *VoidPtrTy = PointerType::get(Type::Int8Ty);
+ AbortMessage = 0;
+ if (ExpensiveEHSupport) {
+ // Insert a type for the linked list of jump buffers.
+ unsigned JBSize = TLI ? TLI->getJumpBufSize() : 0;
+ JBSize = JBSize ? JBSize : 200;
+ const Type *JmpBufTy = ArrayType::get(VoidPtrTy, JBSize);
+
+ { // The type is recursive, so use a type holder.
+ std::vector<const Type*> Elements;
+ Elements.push_back(JmpBufTy);
+ OpaqueType *OT = OpaqueType::get();
+ Elements.push_back(PointerType::get(OT));
+ PATypeHolder JBLType(StructType::get(Elements));
+ OT->refineAbstractTypeTo(JBLType.get()); // Complete the cycle.
+ JBLinkTy = JBLType.get();
+ M.addTypeName("llvm.sjljeh.jmpbufty", JBLinkTy);
+ }
- const Type *PtrJBList = PointerType::get(JBLinkTy);
+ const Type *PtrJBList = PointerType::get(JBLinkTy);
- // Now that we've done that, insert the jmpbuf list head global, unless it
- // already exists.
- if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))){
- JBListHead = new GlobalVariable(PtrJBList, false,
- GlobalValue::LinkOnceLinkage,
- Constant::getNullValue(PtrJBList),
- "llvm.sjljeh.jblist", &M);
- }
- SetJmpFn = M.getOrInsertFunction("llvm.setjmp", Type::Int32Ty,
- PointerType::get(JmpBufTy), (Type *)0);
- LongJmpFn = M.getOrInsertFunction("llvm.longjmp", Type::VoidTy,
- PointerType::get(JmpBufTy),
- Type::Int32Ty, (Type *)0);
+ // Now that we've done that, insert the jmpbuf list head global, unless it
+ // already exists.
+ if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
+ JBListHead = new GlobalVariable(PtrJBList, false,
+ GlobalValue::LinkOnceLinkage,
+ Constant::getNullValue(PtrJBList),
+ "llvm.sjljeh.jblist", &M);
}
-
- // We need the 'write' and 'abort' functions for both models.
- AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, (Type *)0);
- WriteFn = M.getOrInsertFunction("write", Type::VoidTy, Type::Int32Ty,
- VoidPtrTy, Type::Int32Ty, (Type *)0);
+ SetJmpFn = M.getOrInsertFunction("llvm.setjmp", Type::Int32Ty,
+ PointerType::get(JmpBufTy), (Type *)0);
+ LongJmpFn = M.getOrInsertFunction("llvm.longjmp", Type::VoidTy,
+ PointerType::get(JmpBufTy),
+ Type::Int32Ty, (Type *)0);
}
+
+ // We need the 'write' and 'abort' functions for both models.
+ AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, (Type *)0);
+ WriteFn = M.getOrInsertFunction("write", Type::VoidTy, Type::Int32Ty,
+ VoidPtrTy, Type::Int32Ty, (Type *)0);
return true;
}
@@ -396,10 +388,6 @@ splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes) {
}
}
-bool LowerInvoke::insertItaniumEHSupport(Function &F) {
- return true;
-}
-
bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
std::vector<ReturnInst*> Returns;
std::vector<UnwindInst*> Unwinds;
@@ -581,8 +569,6 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
}
bool LowerInvoke::runOnFunction(Function &F) {
- if (ItaniumEHSupport)
- return insertItaniumEHSupport(F);
if (ExpensiveEHSupport)
return insertExpensiveEHSupport(F);
else