Mercurial > projects > ldc
comparison gen/tollvm.c @ 58:2c3cd3596187 trunk
[svn r62] Added support for TypeInfo _Array, _Function, _Pointer, _Delegate, _Enum
Added initial support for CatExp aka 'a ~ b'
Fixed global constant static arrays initialized with string literals
Fixed casting any dynamic array to void*
Fixed new expression with temporary storage
Fixed alias declarations in function scope
Fixed relational comparisons of pointers
author | lindquist |
---|---|
date | Thu, 25 Oct 2007 09:02:55 +0200 |
parents | a9d29e9f1fed |
children | b86e00b938a5 |
comparison
equal
deleted
inserted
replaced
57:a9d29e9f1fed | 58:2c3cd3596187 |
---|---|
1380 return LLVM_DtoConstantSlice( | 1380 return LLVM_DtoConstantSlice( |
1381 LLVM_DtoConstSize_t(s.length()), | 1381 LLVM_DtoConstSize_t(s.length()), |
1382 llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2) | 1382 llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2) |
1383 ); | 1383 ); |
1384 } | 1384 } |
1385 | |
1386 ////////////////////////////////////////////////////////////////////////////////////////// | |
1387 | |
1388 void LLVM_DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes) | |
1389 { | |
1390 assert(dst->getType() == src->getType()); | |
1391 | |
1392 llvm::Type* arrty = llvm::PointerType::get(llvm::Type::Int8Ty); | |
1393 llvm::Value *dstarr, *srcarr; | |
1394 if (dst->getType() == arrty) | |
1395 { | |
1396 dstarr = dst; | |
1397 srcarr = src; | |
1398 } | |
1399 else | |
1400 { | |
1401 dstarr = new llvm::BitCastInst(dst,arrty,"tmp",gIR->scopebb()); | |
1402 srcarr = new llvm::BitCastInst(src,arrty,"tmp",gIR->scopebb()); | |
1403 } | |
1404 | |
1405 llvm::Function* fn = (global.params.is64bit) ? LLVM_DeclareMemCpy64() : LLVM_DeclareMemCpy32(); | |
1406 std::vector<llvm::Value*> llargs; | |
1407 llargs.resize(4); | |
1408 llargs[0] = dstarr; | |
1409 llargs[1] = srcarr; | |
1410 llargs[2] = nbytes; | |
1411 llargs[3] = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false); | |
1412 | |
1413 new llvm::CallInst(fn, llargs.begin(), llargs.end(), "", gIR->scopebb()); | |
1414 } |