[svn r66] Added support for imaginary floating point types

This commit is contained in:
Tomas Lindquist Olsen
2007-10-25 09:48:36 +02:00
parent 8e49b3c389
commit 1f13dbd766
11 changed files with 63 additions and 7 deletions
+4 -3
View File
@@ -328,10 +328,11 @@ llvm::Constant* RealExp::toConstElem(IRState* p)
{
Logger::print("RealExp::toConstElem: %s | %s\n", toChars(), type->toChars());
LOG_SCOPE;
const llvm::Type* fty = LLVM_DtoType(type);
if (type->ty == Tfloat32)
Type* t = LLVM_DtoDType(type);
const llvm::Type* fty = LLVM_DtoType(t);
if (t->ty == Tfloat32 || t->ty == Timaginary32)
return llvm::ConstantFP::get(fty,float(value));
else if (type->ty == Tfloat64 || type->ty == Tfloat80)
else if (t->ty == Tfloat64 || t->ty == Timaginary64 || t->ty == Tfloat80 || t->ty == Timaginary80)
return llvm::ConstantFP::get(fty,double(value));
assert(0);
return NULL;
+9
View File
@@ -65,11 +65,20 @@ const llvm::Type* LLVM_DtoType(Type* t)
// floats
case Tfloat32:
case Timaginary32:
return llvm::Type::FloatTy;
case Tfloat64:
case Timaginary64:
case Tfloat80:
case Timaginary80:
return llvm::Type::DoubleTy;
// complex
case Tcomplex32:
case Tcomplex64:
case Tcomplex80:
assert(0 && "complex number types not yet implemented");
// pointers
case Tpointer: {
assert(t->next);