[svn r217] Updated: the rebuild profiles.

Fixed: way to find class data fields was too strict type wise.
Fixed: foreach resulting in an implicit delegate could fail.
This commit is contained in:
Tomas Lindquist Olsen
2008-05-12 22:44:25 +02:00
parent ee551c95b9
commit c571bf0f70
6 changed files with 22 additions and 12 deletions

View File

@@ -1153,7 +1153,7 @@ llvm::Value* DtoIndexClass(llvm::Value* ptr, ClassDeclaration* cd, Type* t, unsi
Type* vdtype = DtoDType(vd->type);
//Logger::println("found %u type %s", vd->offset, vdtype->toChars());
assert(vd->ir.irField->index >= 0);
if (os == vd->offset && vdtype == t) {
if (os == vd->offset && vdtype->toBasetype() == t->toBasetype()) {
Logger::println("found %s %s", vdtype->toChars(), vd->toChars());
idxs.push_back(vd->ir.irField->index + dataoffset);
//Logger::cout() << "indexing: " << *ptr << '\n';

View File

@@ -842,12 +842,13 @@ void ForeachStatement::toIR(IRState* p)
llvm::Value* zerokey = llvm::ConstantInt::get(keytype,0,false);
// value
Logger::println("value = %s", value->toPrettyChars());
const llvm::Type* valtype = DtoType(value->type);
llvm::Value* valvar = NULL;
if (!value->isRef() && !value->isOut())
valvar = new llvm::AllocaInst(valtype, "foreachval", p->topallocapoint());
assert(!value->ir.irLocal);
value->ir.irLocal = new IrLocal(value);
if (!value->ir.irLocal)
value->ir.irLocal = new IrLocal(value);
// what to iterate
DValue* aggrval = aggr->toElem(p);

View File

@@ -1246,7 +1246,10 @@ DValue* CastExp::toElem(IRState* p)
return v;
}
else if (u->isLRValue() || (u->isVar() && u->isVar()->lval))
else if (DLRValue* lr = u->isLRValue())
return new DLRValue(lr->getLType(), lr->getLVal(), to, v->getRVal());
else if (u->isVar() && u->isVar()->lval)
return new DLRValue(e1->type, u->getLVal(), to, v->getRVal());
else if (gIR->topexp() && gIR->topexp()->e1 == this)

View File

@@ -1006,11 +1006,16 @@ void DtoAssign(DValue* lhs, DValue* rhs)
Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n';
const llvm::Type* lit = l->getType()->getContainedType(0);
if (r->getType() != lit) {
if (DLRValue* lr = lhs->isLRValue()) // handle lvalue cast assignments
// handle lvalue cast assignments
if (DLRValue* lr = lhs->isLRValue()) {
Logger::println("lvalue cast!");
r = DtoCast(rhs, lr->getLType())->getRVal();
else
}
else {
r = DtoCast(rhs, lhs->getType())->getRVal();
}
Logger::cout() << "really assign\nlhs: " << *l << "rhs: " << *r << '\n';
assert(r->getType() == l->getType()->getContainedType(0));
}
gIR->ir->CreateStore(r, l);
}

View File

@@ -43,7 +43,7 @@ version=-version=$i
[link]
oneatatime=yes
#oneatatime=yes
cmd=llvmdc $i -of$o
libdir=-L-L$i
@@ -53,7 +53,7 @@ flag=-L$i
[liblink]
safe=yes
oneatatime=yes
#oneatatime=yes
cmd=llvm-link -f -o=$o $i
libdir=
@@ -67,7 +67,7 @@ cmd=
[shliblink]
shlibs=no
oneatatime=yes
#oneatatime=yes
cmd=llvm-link $i | llc -filetype=dynlib -f -o=$o
libdir=

View File

@@ -7,12 +7,13 @@ exeext=
objext=bc
version=LLVM
version=LLVMDC
noversion=DigitalMars
noversion=GNU
testversion=linux
testversion=Unix
testversion=Posix
version=Posix
testversion=Windows
testversion=Win32
testversion=Win64
@@ -41,7 +42,7 @@ version=-version=$i
[link]
oneatatime=yes
#oneatatime=yes
cmd=llvmdc $i -of$o
libdir=-L-L=$i
@@ -51,7 +52,7 @@ flag=-L$i
[liblink]
safe=yes
oneatatime=yes
#oneatatime=yes
cmd=llvm-ar rsc $o $i
libdir=-L=$i