Mercurial > projects > ldc
diff gen/tollvm.cpp @ 1364:46f6365a50d7
Added IrTypeFunction and IrTypeDelegate and eliminated IrDType. This means the Type::ir field can be removed. It's the final part needed for the move to a slightly more sane type system. Now the whole thing just needs to be cleaned up :P
Added -v-cg switch, which right now just prints "codegen: module.name (module/name.d)" to stdout, this can really help figuring out where, in some complex build command, things go wrong.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Sat, 16 May 2009 18:19:52 +0200 |
parents | 45aca7e7cc88 |
children | 63f4afd01036 |
line wrap: on
line diff
--- a/gen/tollvm.cpp Sat May 16 14:22:23 2009 +0200 +++ b/gen/tollvm.cpp Sat May 16 18:19:52 2009 +0200 @@ -24,6 +24,7 @@ #include "ir/irtype.h" #include "ir/irtypeclass.h" +#include "ir/irtypefunction.h" bool DtoIsPassedByRef(Type* type) { @@ -131,27 +132,15 @@ // functions case Tfunction: { - if (!t->ir.type || *t->ir.type == NULL) { - TypeFunction* tf = (TypeFunction*)t; - if (tf->funcdecl) - return DtoFunctionType(tf->funcdecl); - else - return DtoFunctionType(tf,NULL,NULL); - } - else { - return t->ir.type->get(); - } + t->irtype = new IrTypeFunction(t); + return t->irtype->buildType(); } // delegates case Tdelegate: { - if (!t->ir.type || *t->ir.type == NULL) { - return DtoDelegateType(t); - } - else { - return t->ir.type->get(); - } + t->irtype = new IrTypeDelegate(t); + return t->irtype->buildType(); } // typedefs @@ -220,19 +209,6 @@ ////////////////////////////////////////////////////////////////////////////////////////// -const LLStructType* DtoDelegateType(Type* t) -{ - assert(t->ty == Tdelegate); - const LLType* i8ptr = getVoidPtrType(); - const LLType* func = DtoFunctionType(t->nextOf(), NULL, Type::tvoid->pointerTo()); - const LLType* funcptr = getPtrToType(func); - const LLStructType* dgtype = LLStructType::get(i8ptr, funcptr, NULL); - gIR->module->addTypeName(t->toChars(), dgtype); - return dgtype; -} - -////////////////////////////////////////////////////////////////////////////////////////// - LLValue* DtoDelegateEquals(TOK op, LLValue* lhs, LLValue* rhs) { Logger::println("Doing delegate equality"); @@ -799,7 +775,7 @@ // ClassInfo classinfo ClassDeclaration* cd2 = ClassDeclaration::classinfo; DtoResolveClass(cd2); - types.push_back(getPtrToType(cd2->type->ir.type->get())); + types.push_back(DtoType(cd2->type)); // void*[] vtbl std::vector<const LLType*> vtbltypes; vtbltypes.push_back(DtoSize_t());