Added initial D2 support, D2 frontend and changes to codegen to make things compile.

This commit is contained in:
Tomas Lindquist Olsen
2008-11-11 01:38:48 +01:00
parent fe49ee6448
commit c4c1c1d72e
115 changed files with 83772 additions and 110 deletions

View File

@@ -410,7 +410,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs)
if (DSliceValue* s2 = rhs->isSlice()) {
DtoArrayCopySlices(s, s2);
}
else if (t->next->toBasetype()->equals(t2)) {
else if (t->nextOf()->toBasetype()->equals(t2)) {
DtoArrayInit(loc, s, rhs);
}
else {
@@ -441,11 +441,11 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs)
DtoStaticArrayCopy(lhs->getLVal(), rhs->getRVal());
}
// T[n] = T
else if (t->next->toBasetype()->equals(t2)) {
else if (t->nextOf()->toBasetype()->equals(t2)) {
DtoArrayInit(loc, lhs, rhs);
}
// T[n] = T[] - generally only generated by frontend in rare cases
else if (t2->ty == Tarray && t->next->toBasetype()->equals(t2->next->toBasetype())) {
else if (t2->ty == Tarray && t->nextOf()->toBasetype()->equals(t2->nextOf()->toBasetype())) {
DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs));
} else {
assert(0 && "Unimplemented static array assign!");
@@ -531,7 +531,7 @@ DValue* DtoNullValue(Type* type)
else if (basety == Tarray)
{
LLValue* len = DtoConstSize_t(0);
LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->next)));
LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->nextOf())));
return new DSliceValue(type, len, ptr);
}
// delegate
@@ -743,7 +743,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
{
Type* at = to->toBasetype();
assert(at->ty == Tarray);
Type* elem = at->next->pointerTo();
Type* elem = at->nextOf()->pointerTo();
if (DSliceValue* slice = val->isSlice())
{
return new DSliceValue(to, slice->len, DtoBitCast(slice->ptr, DtoType(elem)));
@@ -1188,7 +1188,11 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
Logger::println("vdtype = %s", vd->type->toChars());
// referenced by nested delegate?
#if DMDV2
if (vd->nestedrefs.dim) {
#else
if (vd->nestedref) {
#endif
Logger::println("has nestedref set");
assert(vd->ir.irLocal);
@@ -1330,7 +1334,11 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var)
assert(!var->aliassym);
// referenced by nested function?
#if DMDV2
if (var->nestedrefs.dim)
#else
if (var->nestedref)
#endif
{
assert(var->ir.irLocal);
assert(!var->ir.irLocal->value);
@@ -1519,8 +1527,8 @@ static LLConstant* expand_to_sarray(Type *base, Expression* exp)
assert(t->ty == Tsarray);
TypeSArray* tsa = (TypeSArray*)t;
dims.push_back(tsa->dim->toInteger());
assert(t->next);
t = t->next->toBasetype();
assert(t->nextOf());
t = t->nextOf()->toBasetype();
}
size_t i = dims.size();