diff gen/statements.cpp @ 244:a95056b3c996 trunk

[svn r261] Fixed debug info for integer and floating local variables, can now be inspected in GDB. Did a lot of smaller cleans up here and there. Replaced more llvm::Foo with LLFoo for common stuff. Split up tollvm.cpp.
author lindquist
date Mon, 09 Jun 2008 09:37:08 +0200
parents 9760f54af0b7
children 88252a1af660
line wrap: on
line diff
--- a/gen/statements.cpp	Mon Jun 09 03:02:14 2008 +0200
+++ b/gen/statements.cpp	Mon Jun 09 09:37:08 2008 +0200
@@ -20,6 +20,7 @@
 #include "gen/irstate.h"
 #include "gen/logger.h"
 #include "gen/tollvm.h"
+#include "gen/llvmhelpers.h"
 #include "gen/runtime.h"
 #include "gen/arrays.h"
 #include "gen/todebug.h"
@@ -74,7 +75,7 @@
 
     if (exp)
     {
-        if (p->topfunc()->getReturnType() == llvm::Type::VoidTy) {
+        if (p->topfunc()->getReturnType() == LLType::VoidTy) {
             IrFunction* f = p->func();
             assert(f->type->llvmRetInPtr);
             assert(f->decl->ir.irFunc->retArg);
@@ -128,7 +129,7 @@
     }
     else
     {
-        assert(p->topfunc()->getReturnType() == llvm::Type::VoidTy);
+        assert(p->topfunc()->getReturnType() == LLType::VoidTy);
         emit_finallyblocks(p, enclosingtryfinally, NULL);
 
         if (gIR->func()->inVolatile) {
@@ -187,7 +188,7 @@
     llvm::BasicBlock* endbb = llvm::BasicBlock::Create("endif", gIR->topfunc(), oldend);
     llvm::BasicBlock* elsebb = elsebody ? llvm::BasicBlock::Create("else", gIR->topfunc(), endbb) : endbb;
 
-    if (cond_val->getType() != llvm::Type::Int1Ty) {
+    if (cond_val->getType() != LLType::Int1Ty) {
         Logger::cout() << "if conditional: " << *cond_val << '\n';
         cond_val = DtoBoolean(cond_val);
     }
@@ -892,10 +893,10 @@
         else {
             Logger::println("foreach over dynamic array");
             val = aggrval->getRVal();
-            niters = DtoGEPi(val,0,0,"tmp",p->scopebb());
-            niters = p->ir->CreateLoad(niters, "numiterations");
-            val = DtoGEPi(val,0,1,"tmp",p->scopebb());
-            val = p->ir->CreateLoad(val, "collection");
+            niters = DtoGEPi(val,0,0);
+            niters = DtoLoad(niters, "numiterations");
+            val = DtoGEPi(val,0,1);
+            val = DtoLoad(val, "collection");
         }
     }
     else
@@ -935,7 +936,7 @@
     p->scope() = IRScope(condbb,bodybb);
 
     LLValue* done = 0;
-    LLValue* load = new llvm::LoadInst(keyvar, "tmp", p->scopebb());
+    LLValue* load = DtoLoad(keyvar);
     if (op == TOKforeach) {
         done = new llvm::ICmpInst(llvm::ICmpInst::ICMP_ULT, load, niters, "tmp", p->scopebb());
     }