mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
Partial fix for #69 — LDC1 from master fails to build Tango.
Fixed regression that has been introduced in commit 9889067
.
This commit is contained in:
parent
efcbe8390a
commit
15a903580b
5 changed files with 20 additions and 18 deletions
|
@ -87,11 +87,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype,
|
||||||
// member functions
|
// member functions
|
||||||
if (thistype)
|
if (thistype)
|
||||||
{
|
{
|
||||||
bool toref = (thistype->toBasetype()->ty == Tstruct);
|
fty.arg_this = new IrFuncTyArg(thistype, thistype->toBasetype()->ty == Tstruct);
|
||||||
#if STRUCTTHISREF
|
|
||||||
fty.is_arg_this_ref = toref;
|
|
||||||
#endif
|
|
||||||
fty.arg_this = new IrFuncTyArg(thistype, toref);
|
|
||||||
lidx++;
|
lidx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +708,10 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||||
assert(thisvar);
|
assert(thisvar);
|
||||||
|
|
||||||
LLValue* thismem = thisvar;
|
LLValue* thismem = thisvar;
|
||||||
if (!f->fty.is_arg_this_ref) {
|
#if STRUCTTHISREF
|
||||||
|
if (!f->fty.arg_this->byref)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
thismem = DtoRawAlloca(thisvar->getType(), 0, "this"); // FIXME: align?
|
thismem = DtoRawAlloca(thisvar->getType(), 0, "this"); // FIXME: align?
|
||||||
DtoStore(thisvar, thismem);
|
DtoStore(thisvar, thismem);
|
||||||
irfunction->thisArg = thismem;
|
irfunction->thisArg = thismem;
|
||||||
|
@ -722,6 +721,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||||
fd->vthis->ir.irParam = new IrParameter(fd->vthis);
|
fd->vthis->ir.irParam = new IrParameter(fd->vthis);
|
||||||
fd->vthis->ir.irParam->value = thismem;
|
fd->vthis->ir.irParam->value = thismem;
|
||||||
fd->vthis->ir.irParam->arg = f->fty.arg_this;
|
fd->vthis->ir.irParam->arg = f->fty.arg_this;
|
||||||
|
fd->vthis->ir.irParam->isVthis = true;
|
||||||
|
|
||||||
DtoDwarfLocalVariable(thismem, fd->vthis);
|
DtoDwarfLocalVariable(thismem, fd->vthis);
|
||||||
|
|
||||||
|
|
|
@ -463,12 +463,19 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) {
|
||||||
if (vd->isParameter()) {
|
if (vd->isParameter()) {
|
||||||
// Parameters will have storage associated with them (to handle byref etc.),
|
// Parameters will have storage associated with them (to handle byref etc.),
|
||||||
// so handle those cases specially by storing a pointer instead of a value.
|
// so handle those cases specially by storing a pointer instead of a value.
|
||||||
assert(vd->ir.irParam->value);
|
IrParameter * irparam = vd->ir.irParam;
|
||||||
LLValue* value = vd->ir.irParam->value;
|
LLValue* value = irparam->value;
|
||||||
|
assert(value);
|
||||||
LLType* type = value->getType();
|
LLType* type = value->getType();
|
||||||
bool refout = vd->storage_class & (STCref | STCout);
|
bool refout = vd->storage_class & (STCref | STCout);
|
||||||
bool lazy = vd->storage_class & STClazy;
|
bool lazy = vd->storage_class & STClazy;
|
||||||
if (!refout && (!vd->ir.irParam->arg->byref || lazy)) {
|
bool byref = irparam->arg->byref;
|
||||||
|
#if STRUCTTHISREF
|
||||||
|
bool isVthisPtr = irparam->isVthis && !byref;
|
||||||
|
#else
|
||||||
|
bool isVthisPtr = irparam->isVthis;
|
||||||
|
#endif
|
||||||
|
if ((!refout && (!byref || lazy)) || isVthisPtr) {
|
||||||
// This will be copied to the nesting frame.
|
// This will be copied to the nesting frame.
|
||||||
if (lazy)
|
if (lazy)
|
||||||
type = type->getContainedType(0);
|
type = type->getContainedType(0);
|
||||||
|
|
|
@ -79,9 +79,6 @@ struct IrFuncTy : IrBase
|
||||||
// range of normal parameters to reverse
|
// range of normal parameters to reverse
|
||||||
bool reverseParams;
|
bool reverseParams;
|
||||||
|
|
||||||
// arg_this is reference
|
|
||||||
bool is_arg_this_ref;
|
|
||||||
|
|
||||||
IrFuncTy()
|
IrFuncTy()
|
||||||
: ret(NULL),
|
: ret(NULL),
|
||||||
args(),
|
args(),
|
||||||
|
@ -91,8 +88,7 @@ struct IrFuncTy : IrBase
|
||||||
arg_arguments(NULL),
|
arg_arguments(NULL),
|
||||||
arg_argptr(NULL),
|
arg_argptr(NULL),
|
||||||
c_vararg(false),
|
c_vararg(false),
|
||||||
reverseParams(false),
|
reverseParams(false)
|
||||||
is_arg_this_ref(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
@ -107,8 +103,7 @@ struct IrFuncTy : IrBase
|
||||||
arg_arguments(rhs.arg_arguments),
|
arg_arguments(rhs.arg_arguments),
|
||||||
arg_argptr(rhs.arg_argptr),
|
arg_argptr(rhs.arg_argptr),
|
||||||
c_vararg(rhs.c_vararg),
|
c_vararg(rhs.c_vararg),
|
||||||
reverseParams(rhs.reverseParams),
|
reverseParams(rhs.reverseParams)
|
||||||
is_arg_this_ref(rhs.is_arg_this_ref)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IrFuncTy& operator=(const IrFuncTy& rhs)
|
IrFuncTy& operator=(const IrFuncTy& rhs)
|
||||||
|
@ -122,7 +117,6 @@ struct IrFuncTy : IrBase
|
||||||
arg_argptr = rhs.arg_argptr;
|
arg_argptr = rhs.arg_argptr;
|
||||||
c_vararg = rhs.c_vararg;
|
c_vararg = rhs.c_vararg;
|
||||||
reverseParams = rhs.reverseParams;
|
reverseParams = rhs.reverseParams;
|
||||||
is_arg_this_ref = rhs.is_arg_this_ref;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,7 +38,7 @@ IrLocal::IrLocal(VarDeclaration* v) : IrVar(v)
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
IrParameter::IrParameter(VarDeclaration* v) : IrLocal(v), arg(0)
|
IrParameter::IrParameter(VarDeclaration* v) : IrLocal(v), arg(0), isVthis(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct IrParameter : IrLocal
|
||||||
{
|
{
|
||||||
IrParameter(VarDeclaration* v);
|
IrParameter(VarDeclaration* v);
|
||||||
IrFuncTyArg *arg;
|
IrFuncTyArg *arg;
|
||||||
|
bool isVthis; // true, if it is the 'this' parameter
|
||||||
};
|
};
|
||||||
|
|
||||||
// represents an aggregate field variable
|
// represents an aggregate field variable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue