Mercurial > projects > ldc
comparison gen/statements.cpp @ 585:fbb1a366cfbc
Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 09 Sep 2008 16:49:47 -0700 |
parents | bc0835cd3440 |
children | 1b62222581fb |
comparison
equal
deleted
inserted
replaced
584:c7d7e2282ba3 | 585:fbb1a366cfbc |
---|---|
60 assert(f->type->retInPtr); | 60 assert(f->type->retInPtr); |
61 assert(f->decl->ir.irFunc->retArg); | 61 assert(f->decl->ir.irFunc->retArg); |
62 | 62 |
63 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); | 63 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); |
64 | 64 |
65 DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg, true); | 65 DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg); |
66 | 66 |
67 DValue* e = exp->toElem(p); | 67 DValue* e = exp->toElem(p); |
68 | 68 |
69 DtoAssign(loc, rvar, e); | 69 DtoAssign(loc, rvar, e); |
70 | 70 |
685 LLValue* llval; | 685 LLValue* llval; |
686 if (DSliceValue* sval = val->isSlice()) | 686 if (DSliceValue* sval = val->isSlice()) |
687 { | 687 { |
688 // give storage | 688 // give storage |
689 llval = DtoAlloca(DtoType(e->type), "tmp"); | 689 llval = DtoAlloca(DtoType(e->type), "tmp"); |
690 DVarValue* vv = new DVarValue(e->type, llval, true); | 690 DVarValue* vv = new DVarValue(e->type, llval); |
691 DtoAssign(e->loc, vv, val); | 691 DtoAssign(e->loc, vv, val); |
692 } | 692 } |
693 else | 693 else |
694 { | 694 { |
695 llval = val->getRVal(); | 695 llval = val->getRVal(); |
1000 LLConstant* zero = llvm::ConstantInt::get(keytype,0,false); | 1000 LLConstant* zero = llvm::ConstantInt::get(keytype,0,false); |
1001 LLValue* loadedKey = p->ir->CreateLoad(keyvar,"tmp"); | 1001 LLValue* loadedKey = p->ir->CreateLoad(keyvar,"tmp"); |
1002 value->ir.irLocal->value = DtoGEP1(val,loadedKey); | 1002 value->ir.irLocal->value = DtoGEP1(val,loadedKey); |
1003 | 1003 |
1004 if (!value->isRef() && !value->isOut()) { | 1004 if (!value->isRef() && !value->isOut()) { |
1005 DValue* dst = new DVarValue(value->type, valvar, true); | 1005 DVarValue dst(value->type, valvar); |
1006 DValue* src = new DVarValue(value->type, value->ir.irLocal->value, true); | 1006 DVarValue src(value->type, value->ir.irLocal->value); |
1007 DtoAssign(loc, dst, src); | 1007 DtoAssign(loc, &dst, &src); |
1008 value->ir.irLocal->value = valvar; | 1008 value->ir.irLocal->value = valvar; |
1009 } | 1009 } |
1010 | 1010 |
1011 // emit body | 1011 // emit body |
1012 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,nextbb,endbb)); | 1012 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,nextbb,endbb)); |
1149 assert(body); | 1149 assert(body); |
1150 | 1150 |
1151 DValue* e = exp->toElem(p); | 1151 DValue* e = exp->toElem(p); |
1152 assert(!wthis->ir.isSet()); | 1152 assert(!wthis->ir.isSet()); |
1153 wthis->ir.irLocal = new IrLocal(wthis); | 1153 wthis->ir.irLocal = new IrLocal(wthis); |
1154 wthis->ir.irLocal->value = e->getRVal(); | 1154 wthis->ir.irLocal->value = DtoAlloca(DtoType(wthis->type), wthis->toChars()); |
1155 DtoStore(e->getRVal(), wthis->ir.irLocal->value); | |
1155 | 1156 |
1156 body->toIR(p); | 1157 body->toIR(p); |
1157 } | 1158 } |
1158 | 1159 |
1159 ////////////////////////////////////////////////////////////////////////////// | 1160 ////////////////////////////////////////////////////////////////////////////// |