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.
This commit is contained in:
Tomas Lindquist Olsen
2009-05-16 18:19:52 +02:00
parent 61514569ff
commit c0f2af5afd
20 changed files with 148 additions and 129 deletions

View File

@@ -24,6 +24,7 @@
#include "ir/irtype.h"
#include "ir/irtypeclass.h"
#include "ir/irtypefunction.h"
bool DtoIsPassedByRef(Type* type)
{
@@ -131,27 +132,15 @@ const LLType* DtoType(Type* t)
// 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 LLType* DtoTypeNotVoid(Type* t)
//////////////////////////////////////////////////////////////////////////////////////////
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 @@ const LLStructType* DtoInterfaceInfoType()
// 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());