Mercurial > projects > ldc
comparison gen/tocall.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 | 207a8a438dea |
children |
comparison
equal
deleted
inserted
replaced
1649:36da40ecbbe0 | 1650:40bd4a0d4870 |
---|---|
33 return 0; | 33 return 0; |
34 } | 34 } |
35 | 35 |
36 ////////////////////////////////////////////////////////////////////////////////////////// | 36 ////////////////////////////////////////////////////////////////////////////////////////// |
37 | 37 |
38 unsigned DtoCallingConv(Loc loc, LINK l) | 38 llvm::CallingConv::ID DtoCallingConv(Loc loc, LINK l) |
39 { | 39 { |
40 if (l == LINKc || l == LINKcpp || l == LINKintrinsic) | 40 if (l == LINKc || l == LINKcpp || l == LINKintrinsic) |
41 return llvm::CallingConv::C; | 41 return llvm::CallingConv::C; |
42 else if (l == LINKd || l == LINKdefault) | 42 else if (l == LINKd || l == LINKdefault) |
43 { | 43 { |
205 // put data in d-array | 205 // put data in d-array |
206 std::vector<LLConstant*> pinits; | 206 std::vector<LLConstant*> pinits; |
207 pinits.push_back(DtoConstSize_t(vtype->getNumElements())); | 207 pinits.push_back(DtoConstSize_t(vtype->getNumElements())); |
208 pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))); | 208 pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))); |
209 const LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf()); | 209 const LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf()); |
210 tiinits = LLConstantStruct::get(gIR->context(), pinits); | 210 tiinits = LLConstantStruct::get(gIR->context(), pinits, false); |
211 LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty, | 211 LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty, |
212 true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array"); | 212 true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array"); |
213 | 213 |
214 llvm::AttributeWithIndex Attr; | 214 llvm::AttributeWithIndex Attr; |
215 // specify arguments | 215 // specify arguments |
277 bool thiscall = tf->fty.arg_this; | 277 bool thiscall = tf->fty.arg_this; |
278 bool delegatecall = (calleeType->toBasetype()->ty == Tdelegate); | 278 bool delegatecall = (calleeType->toBasetype()->ty == Tdelegate); |
279 bool nestedcall = tf->fty.arg_nest; | 279 bool nestedcall = tf->fty.arg_nest; |
280 bool dvarargs = (tf->linkage == LINKd && tf->varargs == 1); | 280 bool dvarargs = (tf->linkage == LINKd && tf->varargs == 1); |
281 | 281 |
282 unsigned callconv = DtoCallingConv(loc, tf->linkage); | 282 llvm::CallingConv::ID callconv = DtoCallingConv(loc, tf->linkage); |
283 | 283 |
284 // get callee llvm value | 284 // get callee llvm value |
285 LLValue* callable = DtoCallableValue(fnval); | 285 LLValue* callable = DtoCallableValue(fnval); |
286 const LLFunctionType* callableTy = DtoExtractFunctionType(callable->getType()); | 286 const LLFunctionType* callableTy = DtoExtractFunctionType(callable->getType()); |
287 assert(callableTy); | 287 assert(callableTy); |