Mercurial > projects > ldc
comparison gen/toir.cpp @ 720:e177ae483f8e
Added inreg attribute where appropriate on x86 to follow ABI docs.
Removed now unnecessary temporary variable in StringExp.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Thu, 23 Oct 2008 00:34:46 +0200 |
parents | 7261ff0f95ff |
children | f04dde6e882c |
comparison
equal
deleted
inserted
replaced
719:7261ff0f95ff | 720:e177ae483f8e |
---|---|
371 LLConstant* idxs[2] = { zero, zero }; | 371 LLConstant* idxs[2] = { zero, zero }; |
372 LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); | 372 LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); |
373 | 373 |
374 if (dtype->ty == Tarray) { | 374 if (dtype->ty == Tarray) { |
375 LLConstant* clen = llvm::ConstantInt::get(DtoSize_t(),len,false); | 375 LLConstant* clen = llvm::ConstantInt::get(DtoSize_t(),len,false); |
376 LLValue* tmpmem = DtoAlloca(DtoType(dtype),"tempstring"); | 376 return new DImValue(type, DtoConstSlice(clen, arrptr)); |
377 DtoSetArray(tmpmem, clen, arrptr); | |
378 return new DVarValue(type, tmpmem); | |
379 } | 377 } |
380 else if (dtype->ty == Tsarray) { | 378 else if (dtype->ty == Tsarray) { |
381 const LLType* dstType = getPtrToType(LLArrayType::get(ct, len)); | 379 const LLType* dstType = getPtrToType(LLArrayType::get(ct, len)); |
382 LLValue* emem = (gvar->getType() == dstType) ? gvar : DtoBitCast(gvar, dstType); | 380 LLValue* emem = (gvar->getType() == dstType) ? gvar : DtoBitCast(gvar, dstType); |
383 return new DVarValue(type, emem); | 381 return new DVarValue(type, emem); |