comparison gen/tollvm.cpp @ 705:5a2983f97498

Fixed weird struct problem from downs, see mini/compile_structs1.d Rewrote DtoIndexStruct/Class , the old implementation were way too complex for what we really need now - since the DotVar changes.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 14 Oct 2008 15:35:49 +0200
parents 06576ece1a1b
children 30b42a283c8e
comparison
equal deleted inserted replaced
704:43165a082535 705:5a2983f97498
387 return llvm::GetElementPtrInst::Create(ptr, v.begin(), v.end(), var?var:"tmp", bb?bb:gIR->scopebb()); 387 return llvm::GetElementPtrInst::Create(ptr, v.begin(), v.end(), var?var:"tmp", bb?bb:gIR->scopebb());
388 } 388 }
389 389
390 ////////////////////////////////////////////////////////////////////////////////////////// 390 //////////////////////////////////////////////////////////////////////////////////////////
391 391
392 LLValue* DtoGEPi(LLValue* ptr, const DStructIndexVector& src, const char* var, llvm::BasicBlock* bb)
393 {
394 size_t n = src.size();
395 LLSmallVector<LLValue*, 3> dst(n);
396
397 size_t j=0;
398 for (DStructIndexVector::const_iterator i=src.begin(); i!=src.end(); ++i)
399 dst[j++] = DtoConstUint(*i);
400
401 return llvm::GetElementPtrInst::Create(ptr, dst.begin(), dst.end(), var?var:"tmp", bb?bb:gIR->scopebb());
402 }
403
404 //////////////////////////////////////////////////////////////////////////////////////////
405
406 LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb) 392 LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb)
407 { 393 {
408 return llvm::GetElementPtrInst::Create(ptr, DtoConstUint(i), var?var:"tmp", bb?bb:gIR->scopebb()); 394 return llvm::GetElementPtrInst::Create(ptr, DtoConstUint(i), var?var:"tmp", bb?bb:gIR->scopebb());
409 } 395 }
410 396