diff gen/structs.cpp @ 945:03d7c4aac654

SWITCHED TO LLVM 2.5 ! Applied patch from ticket #129 to compile against latest LLVM. Thanks Frits van Bommel. Fixed implicit return by asm block at the end of a function on x86-32. Other architectures will produce an error at the moment. Adding support for new targets is fairly simple. Fixed return calling convention for complex numbers, ST and ST(1) were switched around. Added some testcases. I've run a dstress test and there are no regressions. However, the runtime does not seem to compile with symbolic debug information. -O3 -release -inline works well and is what I used for the dstress run. Tango does not compile, a small workaround is needed in tango.io.digest.Digest.Digest.hexDigest. See ticket #206 .
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 08 Feb 2009 05:26:54 +0100
parents 39519a1ff603
children 9a10fa839dc5
line wrap: on
line diff
--- a/gen/structs.cpp	Sun Feb 08 05:14:24 2009 +0100
+++ b/gen/structs.cpp	Sun Feb 08 05:26:54 2009 +0100
@@ -239,7 +239,7 @@
     }
 
     // there might still be padding after the last one, make sure that is defaulted/zeroed as well
-    size_t structsize = getABITypeSize(structtype);
+    size_t structsize = getTypePaddedSize(structtype);
 
     // if there is space before the next explicit initializer
     // FIXME: this should be handled in the loop above as well
@@ -292,7 +292,7 @@
     {
         Logger::cout() << "constant struct initializer: " << *c << '\n';
     }
-    assert(getABITypeSize(c->getType()) == structsize);
+    assert(getTypePaddedSize(c->getType()) == structsize);
     return c;
 }
 
@@ -406,7 +406,7 @@
 
     // fill out rest with default initializers
     const LLType* structtype = DtoType(sd->type);
-    size_t structsize = getABITypeSize(structtype);
+    size_t structsize = getTypePaddedSize(structtype);
 
     // FIXME: this could probably share some code with the above
     if (structsize > lastoffset+lastsize)
@@ -558,7 +558,7 @@
         printf("    index: %u offset: %u\n", v->ir.irField->index, v->ir.irField->unionOffset);
     }
 
-    unsigned llvmSize = (unsigned)getABITypeSize(ST);
+    unsigned llvmSize = (unsigned)getTypePaddedSize(ST);
     unsigned dmdSize = (unsigned)sd->type->size();
     printf("  llvm size: %u     dmd size: %u\n", llvmSize, dmdSize);
     assert(llvmSize == dmdSize);
@@ -685,7 +685,7 @@
         cmpop = llvm::ICmpInst::ICMP_NE;
 
     // call memcmp
-    size_t sz = getABITypeSize(DtoType(t));
+    size_t sz = getTypePaddedSize(DtoType(t));
     LLValue* val = DtoMemCmp(lhs->getRVal(), rhs->getRVal(), DtoConstSize_t(sz));
     return gIR->ir->CreateICmp(cmpop, val, LLConstantInt::get(val->getType(), 0, false), "tmp");
 }