Mercurial > projects > ldc
comparison gen/tollvm.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 | 9176437d98be |
children |
comparison
equal
deleted
inserted
replaced
1649:36da40ecbbe0 | 1650:40bd4a0d4870 |
---|---|
155 // associative arrays | 155 // associative arrays |
156 case Taarray: | 156 case Taarray: |
157 return getVoidPtrType(); | 157 return getVoidPtrType(); |
158 | 158 |
159 /* | 159 /* |
160 Not needed atm as VarDecls for tuples are rewritten as a string of | 160 Not needed atm as VarDecls for tuples are rewritten as a string of |
161 VarDecls for the fields (u -> _u_field_0, ...) | 161 VarDecls for the fields (u -> _u_field_0, ...) |
162 | 162 |
163 case Ttuple: | 163 case Ttuple: |
164 { | 164 { |
165 TypeTuple* ttupl = (TypeTuple*)t; | 165 TypeTuple* ttupl = (TypeTuple*)t; |
287 } | 287 } |
288 else | 288 else |
289 { | 289 { |
290 assert(0 && "not global/function"); | 290 assert(0 && "not global/function"); |
291 } | 291 } |
292 | 292 |
293 // The following breaks for nested naked functions and other declarations, so check for that. | 293 // The following breaks for nested naked functions and other declarations, so check for that. |
294 bool skipNestedCheck = !mustDefineSymbol(sym); | 294 bool skipNestedCheck = !mustDefineSymbol(sym); |
295 if (FuncDeclaration* fd = sym->isFuncDeclaration()) | 295 if (FuncDeclaration* fd = sym->isFuncDeclaration()) |
296 skipNestedCheck = (fd->naked != 0); | 296 skipNestedCheck = (fd->naked != 0); |
297 | 297 |
298 // Any symbol nested in a function can't be referenced directly from | 298 // Any symbol nested in a function can't be referenced directly from |
299 // outside that function, so we can give such symbols internal linkage. | 299 // outside that function, so we can give such symbols internal linkage. |
300 // This holds even if nested indirectly, such as member functions of | 300 // This holds even if nested indirectly, such as member functions of |
301 // aggregates nested in functions. | 301 // aggregates nested in functions. |
302 // | 302 // |
311 if (!skipNestedCheck) | 311 if (!skipNestedCheck) |
312 for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { | 312 for (Dsymbol* parent = sym->parent; parent ; parent = parent->parent) { |
313 if (parent->isFuncDeclaration()) | 313 if (parent->isFuncDeclaration()) |
314 return llvm::GlobalValue::InternalLinkage; | 314 return llvm::GlobalValue::InternalLinkage; |
315 } | 315 } |
316 | 316 |
317 // default to external linkage | 317 // default to external linkage |
318 return llvm::GlobalValue::ExternalLinkage; | 318 return llvm::GlobalValue::ExternalLinkage; |
319 } | 319 } |
320 | 320 |
321 static bool isAvailableExternally(Dsymbol* sym) | 321 static bool isAvailableExternally(Dsymbol* sym) |
360 if (ptrTy == valTy) | 360 if (ptrTy == valTy) |
361 { | 361 { |
362 return val; | 362 return val; |
363 } | 363 } |
364 // ptr is integer pointer | 364 // ptr is integer pointer |
365 else if (ptrTy->isInteger()) | 365 else if (ptrTy->isIntegerTy()) |
366 { | 366 { |
367 // val is integer | 367 // val is integer |
368 assert(valTy->isInteger()); | 368 assert(valTy->isInteger()); |
369 const LLIntegerType* pt = llvm::cast<const LLIntegerType>(ptrTy); | 369 const LLIntegerType* pt = llvm::cast<const LLIntegerType>(ptrTy); |
370 const LLIntegerType* vt = llvm::cast<const LLIntegerType>(valTy); | 370 const LLIntegerType* vt = llvm::cast<const LLIntegerType>(valTy); |