diff ir/irlandingpad.cpp @ 1650:40bd4a0d4870

Update to work with LLVM 2.7. Removed use of dyn_cast, llvm no compiles without exceptions and rtti by default. We do need exceptions for the libconfig stuff, but rtti isn't necessary (anymore). Debug info needs to be rewritten, as in LLVM 2.7 the format has completely changed. To have something to look at while rewriting, the old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means that you have to define this to compile at the moment. Updated tango 0.99.9 patch to include updated EH runtime code, which is needed for LLVM 2.7 as well.
author Tomas Lindquist Olsen
date Wed, 19 May 2010 12:42:32 +0200
parents f4c56ed32238
children
line wrap: on
line diff
--- a/ir/irlandingpad.cpp	Fri Mar 19 09:31:25 2010 +0100
+++ b/ir/irlandingpad.cpp	Wed May 19 12:42:32 2010 +0200
@@ -133,7 +133,7 @@
     }
     // if there's a finally, the eh table has to have a 0 action
     if(hasFinally)
-        selectorargs.push_back(DtoConstSize_t(0));//LLConstantInt::get(LLType::getInt32Ty(gIR->context()), 0));
+        selectorargs.push_back(DtoConstUint(0));
 
     // personality fn
     llvm::Function* personality_fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_eh_personality");
@@ -144,18 +144,14 @@
     selectorargs.insert(selectorargs.begin(), eh_ptr);
 
     // if there is a catch and some catch allocated storage, store exception object
-    if(catchToInt.size() && catch_var) 
+    if(catchToInt.size() && catch_var)
     {
         const LLType* objectTy = DtoType(ClassDeclaration::object->type);
         gIR->ir->CreateStore(gIR->ir->CreateBitCast(eh_ptr, objectTy), catch_var);
     }
 
     // eh_sel = llvm.eh.selector(eh_ptr, cast(byte*)&_d_eh_personality, <selectorargs>);
-    llvm::Function* eh_selector_fn;
-    if (global.params.is64bit)
-        eh_selector_fn = GET_INTRINSIC_DECL(eh_selector_i64);
-    else
-        eh_selector_fn = GET_INTRINSIC_DECL(eh_selector_i32);
+    llvm::Function* eh_selector_fn = GET_INTRINSIC_DECL(eh_selector);
     LLValue* eh_sel = gIR->ir->CreateCall(eh_selector_fn, selectorargs.begin(), selectorargs.end());
 
     // emit finallys and switches that branch to catches until there are no more catches
@@ -186,7 +182,7 @@
             }
             // dubious comment
             // catches matched first get the largest switchval, so do size - unique int
-            llvm::ConstantInt* switchval = LLConstantInt::get(DtoSize_t(), catchToInt[rit->catchType]);
+            llvm::ConstantInt* switchval = DtoConstUint(catchToInt[rit->catchType]);
             // and make sure we don't add the same switchval twice, may happen with nested trys
             if(!switchinst->findCaseValue(switchval))
                 switchinst->addCase(switchval, rit->target);