Mercurial > projects > ldc
comparison gen/tocall.cpp @ 988:2667e3a145be
- Fixed LLVM style CL args for D2.
- Moved main() into its own file gen/main.cpp
- Fixed basic cross compilation
- removed the option for setting OS
- added support for llc's mattr, mcpu and mtriple switches
- added basic ABI abstraction for return value rewrites, it's not perfect and will probably be completely rewritten once I get to handling parameter rewrites as well.
- x86-64 extern(C) abi for cfloat returns now match (llvm-)gcc.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Thu, 26 Feb 2009 14:11:49 +0100 |
parents | f31b29eb6980 |
children | 7a0238db1962 |
comparison
equal
deleted
inserted
replaced
987:73ff89728d85 | 988:2667e3a145be |
---|---|
6 #include "gen/tollvm.h" | 6 #include "gen/tollvm.h" |
7 #include "gen/llvmhelpers.h" | 7 #include "gen/llvmhelpers.h" |
8 #include "gen/irstate.h" | 8 #include "gen/irstate.h" |
9 #include "gen/dvalue.h" | 9 #include "gen/dvalue.h" |
10 #include "gen/functions.h" | 10 #include "gen/functions.h" |
11 #include "gen/abi.h" | |
11 | 12 |
12 #include "gen/logger.h" | 13 #include "gen/logger.h" |
13 | 14 |
14 ////////////////////////////////////////////////////////////////////////////////////////// | 15 ////////////////////////////////////////////////////////////////////////////////////////// |
15 | 16 |
461 CallOrInvoke* call = gIR->CreateCallOrInvoke(callable, args.begin(), args.end(), varname); | 462 CallOrInvoke* call = gIR->CreateCallOrInvoke(callable, args.begin(), args.end(), varname); |
462 | 463 |
463 // get return value | 464 // get return value |
464 LLValue* retllval = (retinptr) ? args[0] : call->get(); | 465 LLValue* retllval = (retinptr) ? args[0] : call->get(); |
465 | 466 |
466 // swap real/imag parts on a x87 | 467 // do abi specific return value fixups |
467 if (global.params.cpu == ARCHx86 && tf->nextOf()->toBasetype()->iscomplex()) | 468 retllval = gABI->getRet(tf, retllval); |
468 { | |
469 retllval = DtoAggrPairSwap(retllval); | |
470 } | |
471 | 469 |
472 // repaint the type if necessary | 470 // repaint the type if necessary |
473 if (resulttype) | 471 if (resulttype) |
474 { | 472 { |
475 Type* rbase = resulttype->toBasetype(); | 473 Type* rbase = resulttype->toBasetype(); |