Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 90:16e88334bba7 trunk
[svn r94] started on complex support
calling final class methods was being treated as a virtual call failing an assertion.
author | lindquist |
---|---|
date | Wed, 07 Nov 2007 03:36:07 +0100 |
parents | 058d3925950e |
children | 3f949c6e2e9d |
comparison
equal
deleted
inserted
replaced
89:ccca1c13e13a | 90:16e88334bba7 |
---|---|
67 case Timaginary80: | 67 case Timaginary80: |
68 return llvm::Type::DoubleTy; | 68 return llvm::Type::DoubleTy; |
69 | 69 |
70 // complex | 70 // complex |
71 case Tcomplex32: | 71 case Tcomplex32: |
72 return DtoComplexType(llvm::Type::FloatTy); | |
72 case Tcomplex64: | 73 case Tcomplex64: |
73 case Tcomplex80: | 74 case Tcomplex80: |
74 assert(0 && "complex number types not yet implemented"); | 75 return DtoComplexType(llvm::Type::DoubleTy); |
75 | 76 |
76 // pointers | 77 // pointers |
77 case Tpointer: { | 78 case Tpointer: { |
78 assert(t->next); | 79 assert(t->next); |
79 if (t->next->ty == Tvoid) | 80 if (t->next->ty == Tvoid) |
369 const llvm::Type* funcptr = llvm::PointerType::get(func); | 370 const llvm::Type* funcptr = llvm::PointerType::get(func); |
370 | 371 |
371 std::vector<const llvm::Type*> types; | 372 std::vector<const llvm::Type*> types; |
372 types.push_back(i8ptr); | 373 types.push_back(i8ptr); |
373 types.push_back(funcptr); | 374 types.push_back(funcptr); |
375 return llvm::StructType::get(types); | |
376 } | |
377 | |
378 ////////////////////////////////////////////////////////////////////////////////////////// | |
379 | |
380 const llvm::StructType* DtoComplexType(const llvm::Type* base) | |
381 { | |
382 std::vector<const llvm::Type*> types; | |
383 types.push_back(base); | |
384 types.push_back(base); | |
374 return llvm::StructType::get(types); | 385 return llvm::StructType::get(types); |
375 } | 386 } |
376 | 387 |
377 ////////////////////////////////////////////////////////////////////////////////////////// | 388 ////////////////////////////////////////////////////////////////////////////////////////// |
378 | 389 |