Mercurial > projects > ldc
comparison gen/arrays.cpp @ 350:b85cf5faccfc trunk
[svn r371] Fixed array init was still broken for immediate slices and complex values.
author | lindquist |
---|---|
date | Mon, 14 Jul 2008 01:03:53 +0200 |
parents | 351c0077d0b3 |
children | 9c9544fd769d |
comparison
equal
deleted
inserted
replaced
349:d22d8d63c1fd | 350:b85cf5faccfc |
---|---|
111 Logger::println("DtoArrayInit"); | 111 Logger::println("DtoArrayInit"); |
112 LOG_SCOPE; | 112 LOG_SCOPE; |
113 | 113 |
114 LLValue* dim = DtoArrayLen(array); | 114 LLValue* dim = DtoArrayLen(array); |
115 LLValue* ptr = DtoArrayPtr(array); | 115 LLValue* ptr = DtoArrayPtr(array); |
116 LLValue* val = value->getRVal(); | 116 LLValue* val; |
117 | |
118 // give slices and complex values storage (and thus an address to pass) | |
119 if (value->isSlice() || value->isComplex()) | |
120 { | |
121 val = new llvm::AllocaInst(DtoType(value->getType()), ".tmpparam", gIR->topallocapoint()); | |
122 DVarValue lval(value->getType(), val, true); | |
123 DtoAssign(&lval, value); | |
124 } | |
125 else | |
126 { | |
127 val = value->getRVal(); | |
128 } | |
129 assert(val); | |
117 | 130 |
118 // prepare runtime call | 131 // prepare runtime call |
119 LLSmallVector<LLValue*, 4> args; | 132 LLSmallVector<LLValue*, 4> args; |
120 args.push_back(ptr); | 133 args.push_back(ptr); |
121 args.push_back(dim); | 134 args.push_back(dim); |