mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-06-08 17:54:10 +02:00
[svn r112] Fixed 'case 1,2,3:' style case statements.
Fixed a bunch of bugs with return/break/continue in loops. Fixed support for the DMDFE hidden implicit return value variable. This can be needed for some foreach statements where the loop body is converted to a nested delegate, but also possibly returns from the function. Added std.math to phobos. Added AA runtime support code, done ground work for implementing AAs. Several other bugfixes.
This commit is contained in:
@@ -174,6 +174,13 @@ const llvm::Type* DtoType(Type* t)
|
||||
return DtoType(bt);
|
||||
}
|
||||
|
||||
// associative arrays
|
||||
case Taarray:
|
||||
{
|
||||
// TODO this is a kludge
|
||||
return llvm::PointerType::get(llvm::Type::Int8Ty);
|
||||
}
|
||||
|
||||
default:
|
||||
printf("trying to convert unknown type with value %d\n", t->ty);
|
||||
assert(0);
|
||||
@@ -796,7 +803,15 @@ llvm::Value* DtoNestedVariable(VarDeclaration* vd)
|
||||
|
||||
// on this stack
|
||||
if (fd == f) {
|
||||
llvm::Value* v = DtoGEPi(vd->llvmValue,0,unsigned(vd->llvmNestedIndex),"tmp");
|
||||
llvm::Value* vdv = vd->llvmValue;
|
||||
if (!vdv)
|
||||
{
|
||||
Logger::println(":o null vd->llvmValue for: %s", vd->toChars());
|
||||
vdv = fd->llvmNested;
|
||||
assert(vdv);
|
||||
}
|
||||
assert(vd->llvmNestedIndex != ~0);
|
||||
llvm::Value* v = DtoGEPi(vdv,0,unsigned(vd->llvmNestedIndex),"tmp");
|
||||
if (vd->isParameter() && (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type))) {
|
||||
Logger::cout() << "1267 loading: " << *v << '\n';
|
||||
v = gIR->ir->CreateLoad(v,"tmp");
|
||||
@@ -859,7 +874,7 @@ void DtoAssign(DValue* lhs, DValue* rhs)
|
||||
// lhs is slice
|
||||
if (DSliceValue* s = lhs->isSlice()) {
|
||||
if (DSliceValue* s2 = rhs->isSlice()) {
|
||||
DtoArrayCopy(s, s2);
|
||||
DtoArrayCopySlices(s, s2);
|
||||
}
|
||||
else if (t->next == t2) {
|
||||
if (s->len)
|
||||
@@ -867,8 +882,9 @@ void DtoAssign(DValue* lhs, DValue* rhs)
|
||||
else
|
||||
DtoArrayInit(s->ptr, rhs->getRVal());
|
||||
}
|
||||
else
|
||||
assert(rhs->inPlace());
|
||||
else {
|
||||
DtoArrayCopyToSlice(s, rhs);
|
||||
}
|
||||
}
|
||||
// rhs is slice
|
||||
else if (DSliceValue* s = rhs->isSlice()) {
|
||||
@@ -926,8 +942,15 @@ void DtoAssign(DValue* lhs, DValue* rhs)
|
||||
DtoComplexAssign(dst, rhs->getRVal());
|
||||
}
|
||||
else {
|
||||
llvm::Value* l;
|
||||
if (DLRValue* lr = lhs->isLRValue()) {
|
||||
l = lr->getLVal();
|
||||
rhs = DtoCast(rhs, lr->getLType());
|
||||
}
|
||||
else {
|
||||
l = lhs->getLVal();
|
||||
}
|
||||
llvm::Value* r = rhs->getRVal();
|
||||
llvm::Value* l = lhs->getLVal();
|
||||
Logger::cout() << "assign\nlhs: " << *l << "rhs: " << *r << '\n';
|
||||
const llvm::Type* lit = l->getType()->getContainedType(0);
|
||||
if (r->getType() != lit) { // :(
|
||||
@@ -1124,6 +1147,7 @@ DValue* DtoCastClass(DValue* val, Type* _to)
|
||||
DValue* DtoCast(DValue* val, Type* to)
|
||||
{
|
||||
Type* fromtype = DtoDType(val->getType());
|
||||
Logger::println("Casting from '%s' to '%s'", fromtype->toChars(), to->toChars());
|
||||
if (fromtype->isintegral()) {
|
||||
return DtoCastInt(val, to);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user