diff gen/tollvm.cpp @ 98:6789050b5ad1 trunk

[svn r102] Further delayed emission of function bodies to avoid problems with circular-forward-references. Now uses the DMD _adEq(void[], void[], TypeInfo) runtime function for array equality comparison.
author lindquist
date Wed, 14 Nov 2007 23:39:10 +0100
parents c4e161556a21
children a676a7743642
line wrap: on
line diff
--- a/gen/tollvm.cpp	Wed Nov 14 20:18:01 2007 +0100
+++ b/gen/tollvm.cpp	Wed Nov 14 23:39:10 2007 +0100
@@ -818,7 +818,7 @@
     std::vector<llvm::Value*> v(2);
     v[0] = i0;
     v[1] = i1;
-    Logger::cout() << "DtoGEP: " << *ptr << '\n';
+    //Logger::cout() << "DtoGEP: " << *ptr << '\n';
     return new llvm::GetElementPtrInst(ptr, v.begin(), v.end(), var, bb?bb:gIR->scopebb());
 }
 
@@ -827,15 +827,15 @@
 llvm::Value* DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb)
 {
     size_t n = src.size();
-    std::vector<llvm::Value*> dst(n);
-    std::ostream& ostr = Logger::cout();
-    ostr << "indices for '" << *ptr << "':";
+    std::vector<llvm::Value*> dst(n, NULL);
+    //std::ostream& ostr = Logger::cout();
+    //ostr << "indices for '" << *ptr << "':";
     for (size_t i=0; i<n; ++i)
     {
-        ostr << ' ' << i;
+        //ostr << ' ' << i;
         dst[i] = llvm::ConstantInt::get(llvm::Type::Int32Ty, src[i], false);
     }
-    ostr << '\n';
+    //ostr << '\n';*/
     return new llvm::GetElementPtrInst(ptr, dst.begin(), dst.end(), var, bb?bb:gIR->scopebb());
 }
 
@@ -1423,7 +1423,7 @@
 {
     const llvm::Type* tolltype = DtoType(_to);
     Type* to = DtoDType(_to);
-    assert(to->ty == Tclass);
+    assert(to->ty == Tclass || to->ty == Tpointer);
     llvm::Value* rval = new llvm::BitCastInst(val->getRVal(), tolltype, "tmp", gIR->scopebb());
     return new DImValue(_to, rval);
 }
@@ -1628,6 +1628,8 @@
 
 llvm::Value* DtoBitCast(llvm::Value* v, const llvm::Type* t)
 {
+    if (v->getType() == t)
+        return v;
     return gIR->ir->CreateBitCast(v, t, "tmp");
 }