Remove STRUCTTHISREF

This commit is contained in:
kai 2013-03-05 18:44:32 +01:00
parent 1e4a8fffc2
commit c3801d65f5
3 changed files with 1 additions and 27 deletions

View file

@ -90,28 +90,12 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype,
llvm::AttrBuilder().addAttribute(llvm::Attributes::StructRet) llvm::AttrBuilder().addAttribute(llvm::Attributes::StructRet)
.addAttribute(llvm::Attributes::NoAlias) .addAttribute(llvm::Attributes::NoAlias)
#endif #endif
#if !STRUCTTHISREF
// In D2 where 'this' in structs is a reference, nocapture
// might not actually be applicable, even if it probably still
// is for all sane code from a high-level semantic standpoint.
// Specifying nocapture on a parameter but then passing it as a
// non-nocapture argument in a function call can lead to
// _silent_ miscompilations (especially in the GVN pass).
#if LDC_LLVM_VER >= 303
.addAttribute(llvm::Attribute::NoCapture)
#else
.addAttribute(llvm::Attributes::NoCapture)
#endif
#endif
#if LDC_LLVM_VER == 302 #if LDC_LLVM_VER == 302
) )
#endif #endif
); );
#else #else
fty.arg_sret = new IrFuncTyArg(rt, true, StructRet | NoAlias fty.arg_sret = new IrFuncTyArg(rt, true, StructRet | NoAlias
#if !STRUCTTHISREF
| NoCapture
#endif
); );
#endif #endif
rt = Type::tvoid; rt = Type::tvoid;
@ -1010,9 +994,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
assert(thisvar); assert(thisvar);
LLValue* thismem = thisvar; LLValue* thismem = thisvar;
#if STRUCTTHISREF
if (!f->fty.arg_this->byref) 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);

View file

@ -1514,11 +1514,7 @@ DValue* ThisExp::toElem(IRState* p)
} else } else
if (vdparent != p->func()->decl) { if (vdparent != p->func()->decl) {
Logger::println("nested this exp"); Logger::println("nested this exp");
#if STRUCTTHISREF
return DtoNestedVariable(loc, type, vd, type->ty == Tstruct); return DtoNestedVariable(loc, type, vd, type->ty == Tstruct);
#else
return DtoNestedVariable(loc, type, vd);
#endif
} }
else { else {
Logger::println("normal this exp"); Logger::println("normal this exp");

View file

@ -640,13 +640,9 @@ void TypeInfoStructDeclaration::llvmDefine()
{ {
Scope sc; Scope sc;
Parameters *arguments = new Parameters; Parameters *arguments = new Parameters;
#if STRUCTTHISREF
// arg type is ref const T // arg type is ref const T
Parameter *arg = new Parameter(STCref, tc->constOf(), NULL, NULL); Parameter *arg = new Parameter(STCref, tc->constOf(), NULL, NULL);
#else
// arg type is const T*
Parameter *arg = new Parameter(STCin, tc->pointerTo(), NULL, NULL);
#endif
arguments->push(arg); arguments->push(arg);
tfcmpptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); tfcmpptr = new TypeFunction(arguments, Type::tint32, 0, LINKd);
tfcmpptr->mod = MODconst; tfcmpptr->mod = MODconst;