Mercurial > projects > ldc
comparison gen/naked.cpp @ 1153:4454126b4345
Added support for single D type register return from __asm.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Sat, 28 Mar 2009 07:24:53 +0100 |
parents | 521dd1626d76 |
children | 9279a9dc6df3 |
comparison
equal
deleted
inserted
replaced
1152:521dd1626d76 | 1153:4454126b4345 |
---|---|
374 args.push_back(e->toElem(gIR)->getRVal()); | 374 args.push_back(e->toElem(gIR)->getRVal()); |
375 argtypes.push_back(args.back()->getType()); | 375 argtypes.push_back(args.back()->getType()); |
376 } | 376 } |
377 | 377 |
378 // build asm function type | 378 // build asm function type |
379 llvm::FunctionType* FT = llvm::FunctionType::get(llvm::Type::VoidTy, argtypes, false); | 379 const llvm::Type* ret_type = DtoType(fd->type->nextOf()); |
380 llvm::FunctionType* FT = llvm::FunctionType::get(ret_type, argtypes, false); | |
380 | 381 |
381 // build asm call | 382 // build asm call |
382 bool sideeffect = true; | 383 bool sideeffect = true; |
383 llvm::InlineAsm* ia = llvm::InlineAsm::get(FT, code, constraints, sideeffect); | 384 llvm::InlineAsm* ia = llvm::InlineAsm::get(FT, code, constraints, sideeffect); |
384 | 385 |
385 llvm::Value* v = gIR->ir->CreateCall(ia, args.begin(), args.end(), ""); | 386 llvm::Value* v = gIR->ir->CreateCall(ia, args.begin(), args.end(), ""); |
386 | 387 |
387 // return NULL for now | 388 // return call as im value |
388 return NULL; | 389 return new DImValue(fd->type->nextOf(), v); |
389 } | 390 } |
390 | 391 |
391 | 392 |
392 | 393 |
393 | 394 |
394 | 395 |
395 | 396 |
396 | 397 |
397 | 398 |
398 | 399 |
399 | 400 |
400 | 401 |