mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-09 12:32:33 +03:00
Rename IrFunction::retArg to sretArg
This commit is contained in:
parent
879fb97d56
commit
cdb817633e
4 changed files with 7 additions and 7 deletions
|
@ -547,7 +547,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
|
||||||
|
|
||||||
if (irFty.arg_sret && !passThisBeforeSret) {
|
if (irFty.arg_sret && !passThisBeforeSret) {
|
||||||
iarg->setName(".sret_arg");
|
iarg->setName(".sret_arg");
|
||||||
irFunc->retArg = &(*iarg);
|
irFunc->sretArg = &(*iarg);
|
||||||
++iarg;
|
++iarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ void DtoDeclareFunction(FuncDeclaration *fdecl) {
|
||||||
|
|
||||||
if (passThisBeforeSret) {
|
if (passThisBeforeSret) {
|
||||||
iarg->setName(".sret_arg");
|
iarg->setName(".sret_arg");
|
||||||
irFunc->retArg = &(*iarg);
|
irFunc->sretArg = &(*iarg);
|
||||||
++iarg;
|
++iarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -884,7 +884,7 @@ void DtoVarDeclaration(VarDeclaration *vd) {
|
||||||
|
|
||||||
if (isIrLocalCreated(vd)) {
|
if (isIrLocalCreated(vd)) {
|
||||||
// Nothing to do if it has already been allocated.
|
// Nothing to do if it has already been allocated.
|
||||||
} else if (gIR->func()->retArg && gIR->func()->decl->nrvo_can &&
|
} else if (gIR->func()->sretArg && gIR->func()->decl->nrvo_can &&
|
||||||
gIR->func()->decl->nrvo_var == vd) {
|
gIR->func()->decl->nrvo_var == vd) {
|
||||||
// Named Return Value Optimization (NRVO):
|
// Named Return Value Optimization (NRVO):
|
||||||
// T f() {
|
// T f() {
|
||||||
|
@ -893,7 +893,7 @@ void DtoVarDeclaration(VarDeclaration *vd) {
|
||||||
// return ret; // NRVO.
|
// return ret; // NRVO.
|
||||||
// }
|
// }
|
||||||
assert(!isSpecialRefVar(vd) && "Can this happen?");
|
assert(!isSpecialRefVar(vd) && "Can this happen?");
|
||||||
getIrLocal(vd, true)->value = gIR->func()->retArg;
|
getIrLocal(vd, true)->value = gIR->func()->sretArg;
|
||||||
} else {
|
} else {
|
||||||
// normal stack variable, allocate storage on the stack if it has not
|
// normal stack variable, allocate storage on the stack if it has not
|
||||||
// already been done
|
// already been done
|
||||||
|
|
|
@ -145,12 +145,12 @@ public:
|
||||||
LLType::getVoidTy(irs->context())) {
|
LLType::getVoidTy(irs->context())) {
|
||||||
// sanity check
|
// sanity check
|
||||||
IrFunction *f = irs->func();
|
IrFunction *f = irs->func();
|
||||||
assert(getIrFunc(f->decl)->retArg);
|
assert(getIrFunc(f->decl)->sretArg);
|
||||||
|
|
||||||
// FIXME: is there ever a case where a sret return needs to be rewritten
|
// FIXME: is there ever a case where a sret return needs to be rewritten
|
||||||
// for the ABI?
|
// for the ABI?
|
||||||
|
|
||||||
LLValue *sretPointer = getIrFunc(f->decl)->retArg;
|
LLValue *sretPointer = getIrFunc(f->decl)->sretArg;
|
||||||
DValue *e = toElemDtor(stmt->exp);
|
DValue *e = toElemDtor(stmt->exp);
|
||||||
// store return value
|
// store return value
|
||||||
if (!e->isLVal() || DtoLVal(e) != sretPointer) {
|
if (!e->isLVal() || DtoLVal(e) != sretPointer) {
|
||||||
|
|
|
@ -484,7 +484,7 @@ struct IrFunction {
|
||||||
/// Points to the associated scope stack while emitting code for the function.
|
/// Points to the associated scope stack while emitting code for the function.
|
||||||
ScopeStack *scopes = nullptr;
|
ScopeStack *scopes = nullptr;
|
||||||
|
|
||||||
llvm::Value *retArg = nullptr; // return in ptr arg
|
llvm::Value *sretArg = nullptr; // sret pointer arg
|
||||||
llvm::Value *thisArg = nullptr; // class/struct 'this' arg
|
llvm::Value *thisArg = nullptr; // class/struct 'this' arg
|
||||||
llvm::Value *nestArg = nullptr; // nested function 'this' arg
|
llvm::Value *nestArg = nullptr; // nested function 'this' arg
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue