comparison gen/statements.cpp @ 486:a34078905d01

Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in. Reimplemented support for nested functions/class using a new approach. Added error on taking address of intrinsic. Fixed problems with the ->syntaxCopy of TypeFunction delegate exp. Removed DtoDType and replaced all uses with ->toBasetype() instead. Removed unused inplace stuff. Fixed a bunch of issues in the runtime unittests, not complete yet. Added mini tests.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 10 Aug 2008 08:37:38 +0200
parents 672eb4893b55
children 9534dbc70a56
comparison
equal deleted inserted replaced
485:50f6e2337a6b 486:a34078905d01
55 55
56 if (exp) 56 if (exp)
57 { 57 {
58 if (p->topfunc()->getReturnType() == LLType::VoidTy) { 58 if (p->topfunc()->getReturnType() == LLType::VoidTy) {
59 IrFunction* f = p->func(); 59 IrFunction* f = p->func();
60 assert(f->type->llvmRetInPtr); 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, true);
66 66
67 DValue* e = exp->toElem(p); 67 DValue* e = exp->toElem(p);
68 68
69 if (!e->inPlace()) 69 DtoAssign(loc, rvar, e);
70 DtoAssign(loc, rvar, e);
71 70
72 DtoEnclosingHandlers(enclosinghandler, NULL); 71 DtoEnclosingHandlers(enclosinghandler, NULL);
73 72
74 if (global.params.symdebug) DtoDwarfFuncEnd(f->decl); 73 if (global.params.symdebug) DtoDwarfFuncEnd(f->decl);
75 llvm::ReturnInst::Create(p->scopebb()); 74 llvm::ReturnInst::Create(p->scopebb());
645 } 644 }
646 }; 645 };
647 646
648 static LLValue* call_string_switch_runtime(llvm::GlobalVariable* table, Expression* e) 647 static LLValue* call_string_switch_runtime(llvm::GlobalVariable* table, Expression* e)
649 { 648 {
650 Type* dt = DtoDType(e->type); 649 Type* dt = e->type->toBasetype();
651 Type* dtnext = DtoDType(dt->next); 650 Type* dtnext = dt->next->toBasetype();
652 TY ty = dtnext->ty; 651 TY ty = dtnext->ty;
653 const char* fname; 652 const char* fname;
654 if (ty == Tchar) { 653 if (ty == Tchar) {
655 fname = "_d_switch_string"; 654 fname = "_d_switch_string";
656 } 655 }
932 if (!value->ir.irLocal) 931 if (!value->ir.irLocal)
933 value->ir.irLocal = new IrLocal(value); 932 value->ir.irLocal = new IrLocal(value);
934 933
935 // what to iterate 934 // what to iterate
936 DValue* aggrval = aggr->toElem(p); 935 DValue* aggrval = aggr->toElem(p);
937 Type* aggrtype = DtoDType(aggr->type); 936 Type* aggrtype = aggr->type->toBasetype();
938 937
939 // get length and pointer 938 // get length and pointer
940 LLValue* niters = DtoArrayLen(aggrval); 939 LLValue* niters = DtoArrayLen(aggrval);
941 LLValue* val = DtoArrayPtr(aggrval); 940 LLValue* val = DtoArrayPtr(aggrval);
942 941