comparison gen/naked.cpp @ 1350:15e9762bb620

Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Thu, 14 May 2009 13:26:40 +0200
parents ea7b8b6c96c0
children 8d086d552909
comparison
equal deleted inserted replaced
1349:a376776e2301 1350:15e9762bb620
256 // note that "$<<out0>>" etc in the asm will translate to the correct 256 // note that "$<<out0>>" etc in the asm will translate to the correct
257 // numbered output when the asm block in finalized 257 // numbered output when the asm block in finalized
258 258
259 // generate asm 259 // generate asm
260 as->out_c = "=*m,=*m,"; 260 as->out_c = "=*m,=*m,";
261 LLValue* tmp = DtoAlloca(llretTy, ".tmp_asm_ret"); 261 LLValue* tmp = DtoRawAlloca(llretTy, 0, ".tmp_asm_ret");
262 as->out.push_back( tmp ); 262 as->out.push_back( tmp );
263 as->out.push_back( DtoGEPi(tmp, 0,1) ); 263 as->out.push_back( DtoGEPi(tmp, 0,1) );
264 as->code = "movd %eax, $<<out0>>" "\n\t" "mov %edx, $<<out1>>"; 264 as->code = "movd %eax, $<<out0>>" "\n\t" "mov %edx, $<<out1>>";
265 265
266 // fix asmblock 266 // fix asmblock
411 411
412 // work around missing tuple support for users of the return value 412 // work around missing tuple support for users of the return value
413 if (type->ty == Tstruct) 413 if (type->ty == Tstruct)
414 { 414 {
415 // make a copy 415 // make a copy
416 llvm::Value* mem = DtoAlloca(ret_type, ".__asm_tuple_ret"); 416 llvm::Value* mem = DtoAlloca(type, ".__asm_tuple_ret");
417 417
418 TypeStruct* ts = (TypeStruct*)type; 418 TypeStruct* ts = (TypeStruct*)type;
419 size_t n = ts->sym->fields.dim; 419 size_t n = ts->sym->fields.dim;
420 for (size_t i = 0; i < n; i++) 420 for (size_t i = 0; i < n; i++)
421 { 421 {