diff 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
line wrap: on
line diff
--- a/gen/statements.cpp	Tue Jun 03 22:32:59 2008 +0200
+++ b/gen/statements.cpp	Thu Jun 05 06:38:36 2008 +0200
@@ -92,7 +92,7 @@
 
             emit_finallyblocks(p, enclosingtryfinally, NULL);
 
-            if (gIR->func()->inVolatile) {
+            if (f->inVolatile) {
                 // store-load barrier
                 DtoMemoryBarrier(false, false, true, false);
             }
@@ -128,21 +128,16 @@
     }
     else
     {
-        if (p->topfunc()->getReturnType() == llvm::Type::VoidTy) {
-            emit_finallyblocks(p, enclosingtryfinally, NULL);
-
-            if (gIR->func()->inVolatile) {
-                // store-load barrier
-                DtoMemoryBarrier(false, false, true, false);
-            }
+        assert(p->topfunc()->getReturnType() == llvm::Type::VoidTy);
+        emit_finallyblocks(p, enclosingtryfinally, NULL);
 
-            if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl);
-            llvm::ReturnInst::Create(p->scopebb());
+        if (gIR->func()->inVolatile) {
+            // store-load barrier
+            DtoMemoryBarrier(false, false, true, false);
         }
-        else {
-            assert(0); // why should this ever happen?
-            new llvm::UnreachableInst(p->scopebb());
-        }
+
+        if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl);
+        llvm::ReturnInst::Create(p->scopebb());
     }
 }
 
@@ -616,11 +611,10 @@
     }
 
     llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
-    std::vector<LLValue*> args;
+
     Logger::cout() << *table->getType() << '\n';
     Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n';
     assert(table->getType() == fn->getFunctionType()->getParamType(0));
-    args.push_back(table);
 
     DValue* val = e->toElem(gIR);
     LLValue* llval;
@@ -636,9 +630,8 @@
         llval = val->getRVal();
     }
     assert(llval->getType() == fn->getFunctionType()->getParamType(1));
-    args.push_back(llval);
 
-    return gIR->ir->CreateCall(fn, args.begin(), args.end(), "tmp");
+    return gIR->ir->CreateCall2(fn, table, llval, "tmp");
 }
 
 void SwitchStatement::toIR(IRState* p)