Mercurial > projects > ldc
diff gen/abi.cpp @ 1050:32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
pointer to that struct...
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 06 Mar 2009 21:15:13 +0100 |
parents | 6bb04dbee21f |
children | dc608dc33081 |
line wrap: on
line diff
--- a/gen/abi.cpp Fri Mar 06 19:12:48 2009 +0100 +++ b/gen/abi.cpp Fri Mar 06 21:15:13 2009 +0100 @@ -133,9 +133,9 @@ const LLType* t = LLIntegerType::get(dty->size()*8); DtoLoad(DtoBitCast(mem, getPtrToType(t))); } - const LLType* type(Type*, const LLType* t) + const LLType* type(Type* t, const LLType*) { - size_t sz = getTypePaddedSize(t)*8; + size_t sz = t->size()*8; return LLIntegerType::get(sz); } }; @@ -178,6 +178,7 @@ // complex {re,im} -> {im,re} if (rt->iscomplex()) { + Logger::println("Rewriting complex return value"); fty->ret->rewrite = &swapComplex; } @@ -186,10 +187,12 @@ // mark this/nested params inreg if (fty->arg_this) { + Logger::println("Putting 'this' in register"); fty->arg_this->attrs = llvm::Attribute::InReg; } else if (fty->arg_nest) { + Logger::println("Putting context ptr in register"); fty->arg_nest->attrs = llvm::Attribute::InReg; } // otherwise try to mark the last param inreg @@ -206,6 +209,7 @@ if (last->byref && !last->isByVal()) { + Logger::println("Putting last (byref) parameter in register"); last->attrs |= llvm::Attribute::InReg; } else if (!lastTy->isfloating() && (sz == 1 || sz == 2 || sz == 4)) // right?