Mercurial > projects > ldc
comparison gen/statements.cpp @ 1549:327eef051d50
Always emit a stop point for return statements - even for void returns.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 26 Jul 2009 18:32:25 +0200 |
parents | 7fcb72d518f6 |
children | d6e8d5db259f |
comparison
equal
deleted
inserted
replaced
1548:a326f145a57b | 1549:327eef051d50 |
---|---|
51 void ReturnStatement::toIR(IRState* p) | 51 void ReturnStatement::toIR(IRState* p) |
52 { | 52 { |
53 Logger::println("ReturnStatement::toIR(): %s", loc.toChars()); | 53 Logger::println("ReturnStatement::toIR(): %s", loc.toChars()); |
54 LOG_SCOPE; | 54 LOG_SCOPE; |
55 | 55 |
56 if (global.params.symdebug) | |
57 DtoDwarfStopPoint(loc.linnum); | |
58 | |
56 // is there a return value expression? | 59 // is there a return value expression? |
57 if (exp) | 60 if (exp) |
58 { | 61 { |
59 // if the functions return type is void this means that | 62 // if the functions return type is void this means that |
60 // we are returning through a pointer argument | 63 // we are returning through a pointer argument |
62 { | 65 { |
63 // sanity check | 66 // sanity check |
64 IrFunction* f = p->func(); | 67 IrFunction* f = p->func(); |
65 assert(f->decl->ir.irFunc->retArg); | 68 assert(f->decl->ir.irFunc->retArg); |
66 | 69 |
67 // emit dbg line | |
68 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); | |
69 | |
70 // FIXME: is there ever a case where a sret return needs to be rewritten for the ABI? | 70 // FIXME: is there ever a case where a sret return needs to be rewritten for the ABI? |
71 | 71 |
72 // get return pointer | 72 // get return pointer |
73 DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg); | 73 DValue* rvar = new DVarValue(f->type->next, f->decl->ir.irFunc->retArg); |
74 DValue* e = exp->toElem(p); | 74 DValue* e = exp->toElem(p); |
86 | 86 |
87 } | 87 } |
88 // the return type is not void, so this is a normal "register" return | 88 // the return type is not void, so this is a normal "register" return |
89 else | 89 else |
90 { | 90 { |
91 if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); | |
92 | |
93 // do abi specific transformations on the return value | 91 // do abi specific transformations on the return value |
94 LLValue* v = p->func()->type->fty.putRet(exp->type, exp->toElem(p)); | 92 LLValue* v = p->func()->type->fty.putRet(exp->type, exp->toElem(p)); |
95 | 93 |
96 if (Logger::enabled()) | 94 if (Logger::enabled()) |
97 Logger::cout() << "return value is '" <<*v << "'\n"; | 95 Logger::cout() << "return value is '" <<*v << "'\n"; |