comparison gen/statements.cpp @ 217:0806379a5eca trunk

[svn r233] Added: -oq command line option for writing fully qualified object names. Added: started support for x86 80bit floating point. Changed: aggregates passed by value now use the llvm 'byval' parameter attribute, also lays ground work for using other attributes. Changed: eliminated a lot more std::vectorS, these showed up pretty much at the top when profiling! Changed: performed other misc. cleanups. Changed: halt expression now call the new llvm trap intrinsic instead of an assert(0). Changed: dstress suite now passes -O0 by default, this only eliminates unreferenced globals, which speeds up linking quite a bit.
author lindquist
date Thu, 05 Jun 2008 06:38:36 +0200
parents 7816aafeea3c
children 761c8352f494
comparison
equal deleted inserted replaced
216:3d022aa016ae 217:0806379a5eca
90 if (!e->inPlace()) 90 if (!e->inPlace())
91 DtoAssign(rvar, e); 91 DtoAssign(rvar, e);
92 92
93 emit_finallyblocks(p, enclosingtryfinally, NULL); 93 emit_finallyblocks(p, enclosingtryfinally, NULL);
94 94
95 if (gIR->func()->inVolatile) { 95 if (f->inVolatile) {
96 // store-load barrier 96 // store-load barrier
97 DtoMemoryBarrier(false, false, true, false); 97 DtoMemoryBarrier(false, false, true, false);
98 } 98 }
99 99
100 if (global.params.symdebug) DtoDwarfFuncEnd(f->decl); 100 if (global.params.symdebug) DtoDwarfFuncEnd(f->decl);
126 llvm::ReturnInst::Create(v, p->scopebb()); 126 llvm::ReturnInst::Create(v, p->scopebb());
127 } 127 }
128 } 128 }
129 else 129 else
130 { 130 {
131 if (p->topfunc()->getReturnType() == llvm::Type::VoidTy) { 131 assert(p->topfunc()->getReturnType() == llvm::Type::VoidTy);
132 emit_finallyblocks(p, enclosingtryfinally, NULL); 132 emit_finallyblocks(p, enclosingtryfinally, NULL);
133 133
134 if (gIR->func()->inVolatile) { 134 if (gIR->func()->inVolatile) {
135 // store-load barrier 135 // store-load barrier
136 DtoMemoryBarrier(false, false, true, false); 136 DtoMemoryBarrier(false, false, true, false);
137 } 137 }
138 138
139 if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl); 139 if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl);
140 llvm::ReturnInst::Create(p->scopebb()); 140 llvm::ReturnInst::Create(p->scopebb());
141 }
142 else {
143 assert(0); // why should this ever happen?
144 new llvm::UnreachableInst(p->scopebb());
145 }
146 } 141 }
147 } 142 }
148 143
149 ////////////////////////////////////////////////////////////////////////////// 144 //////////////////////////////////////////////////////////////////////////////
150 145
614 else { 609 else {
615 assert(0 && "not char/wchar/dchar"); 610 assert(0 && "not char/wchar/dchar");
616 } 611 }
617 612
618 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname); 613 llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
619 std::vector<LLValue*> args; 614
620 Logger::cout() << *table->getType() << '\n'; 615 Logger::cout() << *table->getType() << '\n';
621 Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n'; 616 Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n';
622 assert(table->getType() == fn->getFunctionType()->getParamType(0)); 617 assert(table->getType() == fn->getFunctionType()->getParamType(0));
623 args.push_back(table);
624 618
625 DValue* val = e->toElem(gIR); 619 DValue* val = e->toElem(gIR);
626 LLValue* llval; 620 LLValue* llval;
627 if (DSliceValue* sval = val->isSlice()) 621 if (DSliceValue* sval = val->isSlice())
628 { 622 {
634 else 628 else
635 { 629 {
636 llval = val->getRVal(); 630 llval = val->getRVal();
637 } 631 }
638 assert(llval->getType() == fn->getFunctionType()->getParamType(1)); 632 assert(llval->getType() == fn->getFunctionType()->getParamType(1));
639 args.push_back(llval); 633
640 634 return gIR->ir->CreateCall2(fn, table, llval, "tmp");
641 return gIR->ir->CreateCall(fn, args.begin(), args.end(), "tmp");
642 } 635 }
643 636
644 void SwitchStatement::toIR(IRState* p) 637 void SwitchStatement::toIR(IRState* p)
645 { 638 {
646 Logger::println("SwitchStatement::toIR(): %s", loc.toChars()); 639 Logger::println("SwitchStatement::toIR(): %s", loc.toChars());