mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-31 17:19:02 +02:00
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 .
This commit is contained in:
@@ -419,11 +419,9 @@ void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
|
||||
{
|
||||
dst = DtoBitCast(dst,getVoidPtrType());
|
||||
|
||||
llvm::Function* fn;
|
||||
if (global.params.is64bit)
|
||||
fn = GET_INTRINSIC_DECL(memset_i64);
|
||||
else
|
||||
fn = GET_INTRINSIC_DECL(memset_i32);
|
||||
const LLType* intTy = DtoSize_t();
|
||||
llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module,
|
||||
llvm::Intrinsic::memset, &intTy, 1);
|
||||
|
||||
gIR->ir->CreateCall4(fn, dst, DtoConstUbyte(0), nbytes, DtoConstUint(0), "");
|
||||
}
|
||||
@@ -435,11 +433,9 @@ void DtoMemCpy(LLValue* dst, LLValue* src, LLValue* nbytes)
|
||||
dst = DtoBitCast(dst,getVoidPtrType());
|
||||
src = DtoBitCast(src,getVoidPtrType());
|
||||
|
||||
llvm::Function* fn;
|
||||
if (global.params.is64bit)
|
||||
fn = GET_INTRINSIC_DECL(memcpy_i64);
|
||||
else
|
||||
fn = GET_INTRINSIC_DECL(memcpy_i32);
|
||||
const LLType* intTy = DtoSize_t();
|
||||
llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module,
|
||||
llvm::Intrinsic::memcpy, &intTy, 1);
|
||||
|
||||
gIR->ir->CreateCall4(fn, dst, src, nbytes, DtoConstUint(0), "");
|
||||
}
|
||||
@@ -700,9 +696,9 @@ size_t getTypeStoreSize(const LLType* t)
|
||||
return gTargetData->getTypeStoreSize(t);
|
||||
}
|
||||
|
||||
size_t getABITypeSize(const LLType* t)
|
||||
size_t getTypePaddedSize(const LLType* t)
|
||||
{
|
||||
size_t sz = gTargetData->getABITypeSize(t);
|
||||
size_t sz = gTargetData->getTypePaddedSize(t);
|
||||
//Logger::cout() << "abi type size of: " << *t << " == " << sz << '\n';
|
||||
return sz;
|
||||
}
|
||||
@@ -728,7 +724,7 @@ const LLType* getBiggestType(const LLType** begin, size_t n)
|
||||
{
|
||||
const LLType* T = *begin;
|
||||
|
||||
size_t sz = getABITypeSize(T);
|
||||
size_t sz = getTypePaddedSize(T);
|
||||
size_t ali = getABITypeAlign(T);
|
||||
if (sz > bigSize || (sz == bigSize && ali > bigAlign))
|
||||
{
|
||||
@@ -881,3 +877,11 @@ LLValue* DtoAggrPaint(LLValue* aggr, const LLType* as)
|
||||
V = DtoBitCast(V, as->getContainedType(1));
|
||||
return gIR->ir->CreateInsertValue(res, V, 1, "tmp");
|
||||
}
|
||||
|
||||
LLValue* DtoAggrPairSwap(LLValue* aggr)
|
||||
{
|
||||
Logger::println("swapping aggr pair");
|
||||
LLValue* r = gIR->ir->CreateExtractValue(aggr, 0);
|
||||
LLValue* i = gIR->ir->CreateExtractValue(aggr, 1);
|
||||
return DtoAggrPair(i, r, "swapped");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user