Mercurial > projects > ldc
comparison gen/tollvm.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 | 7e2867ed70d9 |
children | 1b62222581fb |
comparison
equal
deleted
inserted
replaced
584:c7d7e2282ba3 | 585:fbb1a366cfbc |
---|---|
23 | 23 |
24 bool DtoIsPassedByRef(Type* type) | 24 bool DtoIsPassedByRef(Type* type) |
25 { | 25 { |
26 Type* typ = type->toBasetype(); | 26 Type* typ = type->toBasetype(); |
27 TY t = typ->ty; | 27 TY t = typ->ty; |
28 return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex()); | 28 return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray); |
29 } | 29 } |
30 | 30 |
31 bool DtoIsReturnedInArg(Type* type) | 31 bool DtoIsReturnedInArg(Type* type) |
32 { | 32 { |
33 Type* typ = type->toBasetype(); | 33 Type* typ = type->toBasetype(); |
34 TY t = typ->ty; | 34 TY t = typ->ty; |
35 return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex()); | 35 return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray); |
36 } | 36 } |
37 | 37 |
38 unsigned DtoShouldExtend(Type* type) | 38 unsigned DtoShouldExtend(Type* type) |
39 { | 39 { |
40 type = type->toBasetype(); | 40 type = type->toBasetype(); |
539 { | 539 { |
540 LLValue* st = gIR->ir->CreateStore(src,dst); | 540 LLValue* st = gIR->ir->CreateStore(src,dst); |
541 //st->setVolatile(gIR->func()->inVolatile); | 541 //st->setVolatile(gIR->func()->inVolatile); |
542 } | 542 } |
543 | 543 |
544 bool DtoCanLoad(LLValue* ptr) | |
545 { | |
546 if (isaPointer(ptr->getType())) { | |
547 const LLType* data = ptr->getType()->getContainedType(0); | |
548 return data->isFirstClassType() && !(isaStruct(data) || isaArray(data)); | |
549 } | |
550 return false; | |
551 } | |
552 | |
553 ////////////////////////////////////////////////////////////////////////////////////////// | 544 ////////////////////////////////////////////////////////////////////////////////////////// |
554 | 545 |
555 LLValue* DtoBitCast(LLValue* v, const LLType* t, const char* name) | 546 LLValue* DtoBitCast(LLValue* v, const LLType* t, const char* name) |
556 { | 547 { |
557 if (v->getType() == t) | 548 if (v->getType() == t) |
768 // done | 759 // done |
769 gIR->moduleRefType = st; | 760 gIR->moduleRefType = st; |
770 gIR->module->addTypeName("ModuleReference", st); | 761 gIR->module->addTypeName("ModuleReference", st); |
771 return st; | 762 return st; |
772 } | 763 } |
764 | |
765 ////////////////////////////////////////////////////////////////////////////////////////// | |
766 | |
767 LLValue* DtoAggrPair(const LLType* type, LLValue* V1, LLValue* V2, const char* name) | |
768 { | |
769 LLValue* res = llvm::UndefValue::get(type); | |
770 res = gIR->ir->CreateInsertValue(res, V1, 0, "tmp"); | |
771 return gIR->ir->CreateInsertValue(res, V2, 1, name?name:"tmp"); | |
772 } |